Hi all,
I have .obj files of arteries and veins that I successfully imported into blender and now I need to create centerlines for them as well. I've learned how to convert the .obj files to .vtp (VTK polydata format) using VTK software. Then I learned how to use VMTK (vascular modeling toolkit) to generate centerlines, which are also in .vtp format. Now the last step - converting them back into something blender can import. I've managed to convert them to .ply but those came in as dots along the centerline, rather than a line segment. VTK has a script called vtkObjExporter but I've been unable to get it to work. Anybody have any other suggestions?
Thank you,
Greg
Xiaoli,
Thanks for the suggestion. I was able to convert trachea.vtp to trachea.stl using the following command:
vmtksurfacewriter -ifile "C:/Users/Greg/Documents/VMTK/trachea.vtp" -ofile "C:/Users/Greg/Documents/VMTK/trachea.stl"
and it imported into blender ok.
Next I used the following command to convert it's centerline:
vmtksurfacewriter -ifile "C:/Users/Greg/Documents/VMTK/trachea_centerline.vtp" -ofile "C:/Users/Greg/Documents/VMTK/trachea_centerline.stl"
It created a file but when I imported into blender, nothing showed up. Maybe .stl files only handle polygons and not line segments?
Any other suggestions?
Greg
--
You received this message because you are subscribed to the Google Groups "vmtk-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vmtk-users+...@googlegroups.com.
To post to this group, send email to vmtk-...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
Hello Arjan,
When I open trachea_centerline.vtp in paraview it shows the name in the Pipeline Browser but I don't see anything but an xyz coorsys at bottom left and a bigger unlabeled one in the center. Rotating or zooming does not bring anything else into view.
It shows up fine in vmtk using the following command:
vmtkrenderer --pipe vmtksurfaceviewer -opacity 0.25 -ifile "C:/Users/Greg/Documents/VMTK/trachea.vtp" --pipe vmtkcenterlineviewer -ifile "C:/Users/Greg/Documents/VMTK/trachea_centerline.vtp"
Does paraview have trouble with line segments too, or am I missing something obvious?
Greg
Hello Jason,
The area where you show an eye is completely blank for me. I am using ParaView 4.0.1 32-bit on a windows 8 machine. I looked around in Settings and View Settings but could not find anything about visibility. Right-clicking on the object in the Pipeline Browser also did not have any visibility options.
Greg
Arjan,
Indeed, that worked. Thanks so much for your help! You too Jason.
Greg
From: vmtk-...@googlegroups.com [mailto:vmtk-...@googlegroups.com] On Behalf Of Arjan Geers
Sent: Monday, September 16, 2013 3:57 PM
To: vmtk-...@googlegroups.com
Hi Xiaoli,
I modified an existing script to do the following:
#include <vtkSmartPointer.h>
#include <vtkPolyDataMapper.h>
#include <vtkActor.h>
#include <vtkRenderWindow.h>
#include <vtkRenderer.h>
#include <vtkRenderWindowInteractor.h>
#include <vtkOBJReader.h>
#include <vtkUnstructuredGrid.h>
#include <vtkCell.h>
#include <vtkCellArray.h>
#include <vtkIdList.h>
#include <vtkUnsignedCharArray.h>
#include <vtkPointData.h>
#include <string>
#include <vtkXMLPolyDataWriter.h>
int main(int argc, char *argv[])
{
// Parse command line arguments
if(argc != 2)
{
std::cout << "Usage: " << argv[0] << " Filename(.obj)" << std::endl;
return EXIT_FAILURE;
}
std::string InputFilename = argv[1];
char path_buffer[_MAX_PATH];
char drive[_MAX_DRIVE];
char dir[_MAX_DIR];
char fname[_MAX_FNAME];
char ext[_MAX_EXT];
_splitpath( InputFilename.c_str(), drive, dir, fname, ext );
_makepath( path_buffer, drive, dir, fname, ".vtp" );
std::string OutputFilename = path_buffer;
vtkSmartPointer<vtkOBJReader> reader = vtkSmartPointer<vtkOBJReader>::New();
reader->SetFileName(InputFilename.c_str());
reader->Update();
// Visualize
vtkSmartPointer<vtkPolyDataMapper> mapper = vtkSmartPointer<vtkPolyDataMapper>::New();
mapper->SetInputConnection(reader->GetOutputPort());
vtkSmartPointer<vtkActor> actor = vtkSmartPointer<vtkActor>::New();
actor->SetMapper(mapper);
vtkSmartPointer<vtkRenderer> renderer = vtkSmartPointer<vtkRenderer>::New();
vtkSmartPointer<vtkRenderWindow> renderWindow = vtkSmartPointer<vtkRenderWindow>::New();
renderWindow->AddRenderer(renderer);
vtkSmartPointer<vtkRenderWindowInteractor> renderWindowInteractor = vtkSmartPointer<vtkRenderWindowInteractor>::New();
renderWindowInteractor->SetRenderWindow(renderWindow);
renderer->AddActor(actor);
renderer->SetBackground(.3, .6, .3); // Background color green
renderWindow->Render();
renderWindowInteractor->Start();
vtkSmartPointer<vtkXMLPolyDataWriter> writer = vtkSmartPointer<vtkXMLPolyDataWriter>::New();
writer->SetFileName(OutputFilename.c_str());
writer->SetInputConnection(reader->GetOutputPort());
writer->Write();
return EXIT_SUCCESS;
}
I compiled it in Microsoft Visual Studio Express 2012 for Windows Desktop.
Greg
From: vmtk-...@googlegroups.com [mailto:vmtk-...@googlegroups.com] On Behalf Of zhangx29
Sent: Friday, October 11, 2013 8:48 PM
To: vmtk-...@googlegroups.com
Subject: [vmtk-users] Re: converting .vtp to .obj
Hi Greg,
--
Hi Xiaoli,
I opened it in ParaView, hit Apply button, then Zoom to Data. I could see no geometry.
Next I imported into Blender and also could see nothing.
Next I opened it in 3D Object Converter v5.20 and got the error message "Unrecognized or unsupported file type! (or no valid object found !)
So evidently, there is something bad about the data.
Greg
From: vmtk-...@googlegroups.com [mailto:vmtk-...@googlegroups.com] On Behalf Of zhangx29
Sent: Saturday, October 12, 2013 7:25 AM
To: vmtk-...@googlegroups.com