I have a set of similar DICOM files. I need to convert them to a 3D mesh and then register them. Then I need to transform the meshes so they are both on the same coordinate system. After this I need to calculate the area of each triangle in the mesh and do things with these values.
I’ve used VTK to create the 3D isoSurface similiar to marching cubes. Then I write to a .vtk ascii file the isoSurfaces.
I’d like to read these into the DeformableRegistration7 example but I keep getting an error:
VTKImageIO(0000025A4187AD90): Not structured points, can’t read
What type of 3D Images are good for this example? Is there a better way to do this? I like using VTK but if there is a way to do this in ITK i’d go for it.
Hi Dzenan,
Thank you for the reference. I tried reading in .vtp and .vtk files like this:
constexpr unsigned int Dimension = 3;
using CoordinateType = float;
using MeshType = itk::Mesh<CoordinateType, Dimension>;
typedef itk::MeshFileReader<MeshType> MeshReaderType;
MeshReaderType::Pointer Meshreader = MeshReaderType::New();
Meshreader->SetFileName("C:\\Users\\shane\\source\\repos\\Registration-1\\Registration-1\\targetMesh.vtp");
Meshreader->Update();
And I keep getting an error saying that the file suffix is wrong or there is something wrong with the file.
I’m writing the file in VTK like this, which I believe is correct:
// Write the file
vtkSmartPointer<vtkXMLPolyDataWriter> writer = vtkSmartPointer<vtkXMLPolyDataWriter>::New();
writer->SetFileName(filename.c_str());
writer->SetInputData(mesh);
// Optional - set the mode. The default is binary.
//writer->SetDataModeToBinary();
//writer->SetDataModeToAscii();
writer->Write();
return 0;
Here is the first few lines of the header from the file generated:
ITK does not support VTK’s XMLPolyData file format. We only support the legacy file format (usual extension .vtk). I think vtkPolyDataWriter is the right class to use.
Hi Dzenan,
Tried the polyDataWriter and still have the same issue (both Ascii and binary formats)
Could it be a .vtk version issue? I read that ITK only supports version 3.0 but not sure if this is still accurate.
Here is the .vtk header with polyDataWriter:
Hi Dzenan,
This ITKMeshToPolyData remote module. did work but I’m doubtful of a good conversion. I’m going to try the ITK method of reading in Dicom files.
Thanks for the help so far!
~Shane