I have binary label files in itk::Image. I have gone through a few examples in ITK and VTK. What I understood, we need to create the cell type object for generating a specific mesh in both ITK and Vtk. For example, I need to generate a tetrahedron mesh, and I need to choose typedef MeshType::CellType CellType; in which CellType can be various type of cells.
In VTK, there is an example that they create the mesh cells. However, I do not how to connect the data types between itk and vtk.
How can I create the mesh from itk::Image and from that generate vtkUnstructuredGrid?
Is there any example available to show some tips and tricks?
Is it like that, I need to follow the following transformation:
itk::Image ==> create the point sets (link) ==> generate the tetrahedron mesh from the point sets and save as an vtkunstructuredGrid ( MakeTetrahedron() function in this link)
I have enabled ITKVtkGlue Module and recompiled and rebuilt ITK. Then, I added, ITKVtkGlue in the cmakeList find package list, however, once I am trying to include #include "itkMeshToVTKUnstructuredGridFilter.h" in the code , what could be the reason? Should I add other modules to the cmakeList?
The ITKVtkGlue repository is ahead of the version distributed in ITK and "itkMeshToVTKUnstructuredGridFilter.h" is not yet in ITK. One option is to build the module externally; that is, clone the repository:
@matt.mccormick Thank you, Sir, I am just checking with you if the installation procedure is correct?
I tried to follow the link that you had guided a user. I set the ITK_DIR and VTK_DIR to the build directory of each application. Then, I set the following flags:
BUILD_SHARED_LIBS ON
BUILD_TESTING OFF
ITK_USE_KWSTYLE OFF
After running cmake successfully, I could build the ITKVtkGlue
~/software/vtk-itk/ITKVtkGlue-build$ sudo make -j4
Scanning dependencies of target VtkGlue-all
Scanning dependencies of target ITKData
Built target VtkGlue-all
Built target ITKData
Do you mean these files?
Where should I copy the files?
Still the #include "itkMeshToVTKUnstructuredGridFilter.h" is shown with red underline indicating has not been included yet. Or should I include any module in the CmakeListfile of my code?
Include ITKVtkGlue in the find_package(ITK [...]COMPONENTS list. For example, in your CMakeLists.txt file:
find_package(ITK REQUIRED
COMPONENTS
ITKVtkGlue
ITKImageIO
# Any other ITK modules your application requires. These can be generated with https://github.com/InsightSoftwareConsortium/ITK/blob/master/Utilities/Maintenance/WhatModulesITK.py
)
# This line adds the include directories required to use the modules listed above to any executables that follow
include(${ITK_USE_FILE})
add_executable(MyExecutable MyExecutable.cxx)
target_link_libraries(MyExecutable ${ITK_LIBRARIES})
@matt.mccormick Hi again and sorry for inconveniences. I had already included ITKVtkGlue in the ITK package. That is why I asked the reason here. Could not find any reason!