VtkKWImage
From KitwarePublic
Jump to navigationJump to search
vtkKWImage is a convenient class that stores a handle to an image both in VTK and ITK format. Here is a simple example to get a handle to the ITK image stored in this class. This is not covered in the original Insight Journal article and is posted here for reference. This example will also use the vtkKWImageIO class to read an image. The image is read in the native format stored on disk. It is up to the user to check the data type and cast the image properly.
Here is the CMakeLists.txt file for the project
PROJECT(KWLoadImageTest) INCLUDE(${CMAKE_ROOT}/Modules/FindITK.cmake) IF (USE_ITK_FILE) INCLUDE(${USE_ITK_FILE}) ENDIF (USE_ITK_FILE) IF(NOT VTK_FOUND) FIND_PACKAGE(VTK REQUIRED) INCLUDE(${VTK_USE_FILE}) ENDIF(NOT VTK_FOUND) INCLUDE_DIRECTORIES(${KWLoadImageTest_SOURCE_DIR} ${KWLoadImageTest_BINARY_DIR}) ADD_EXECUTABLE(KWLoadImageTest KWLoadImageTest.cxx vtkKWImage.cxx vtkKWImageIO.cxx) TARGET_LINK_LIBRARIES(KWLoadImageTest ITKCommon ITKIO ITKBasicFilters vtkCommon vtkImaging vtkIO itkzlib itksys )