[vtkusers] connecting vtkKWImage & vtkKWImageIO to itkFilters

Bryn Lloyd blloyd at vision.ee.ethz.ch
Fri Mar 20 03:51:37 EDT 2009

Hello Sergio,

The vtkKWImage and vtkKWImageIO classes are mainly useful for:

1. read (nearly) all the image formats that ITK can read using 
vtkKWImageIO -> returns a vtkKWImage, which has the method "GetVTKImage".

2. at the end of an itk pipeline, pass the itk image to the vtkKWImage 
object using "SetITKImageBase" and get the vtkImageData for your 
visualization pipeline.

If you want to read an image and pass it to an itkImage for image 
processing, an itkImageReader is more straightforward.

BTW: I am not sure if the vtkKWImageIO class can read Dicom images. I 
would suggest following:

1. Read dicom images using an itk reader, which can handle dicom
2. pass itkImage to vtkKWImage
3. pass vtkImageData from vtkKWImage to your viewer (e.g. vtkImageViewer2).

If you have 3D images and want to move between slices, and if you maybe 
even want to select pixels (seed points), then you could use my own 
image viewer.



Sergio Aguirre wrote:
> Hello
> I am trying to do a simple 2D Dicom series reader and viewer using ITK 
> and VTK.
> Initially I used the itk GDCM class and successfully read a DICOM series 
> and using the itk-vtk imoprter and exporter classes was able to connect 
> the pipelines so that I would write an XML file (VTI) using vtk classes. 
> Then read the vti file and display it in VTK.
> I would prefer to it without writing the XML file. If I use a different 
> than the vtkXMLwriter class, say vtkImageShifScale or vtkImageViewer2 to 
> catch the DICOM stack I get a segmentation fault.
> Recently I found the vtkKWImage and vtkKWImageIO classes and was 
> successfull at reading the DICOM files and connecting them to both vtk 
> classes I mentioned (shifter and viewer). 
> http://insight-journal.org/dspace/handle/1926/495
> BUT I don't know if I could use an itk filter (say 
> itkCurvatureFlowImageFilter) before displaying them since I only found 
> the "Setfilename" and "Setdirectory" options for the vtkKWImage class.
> Can you use vtkKWImage and vtkKWImageIO in combination with itk Filters?
> If not, is there an explanation for the segmentation fault I get when 
> not using the XML writer?
> Thank you,
> Sergio
> ------------------------------------------------------------------------
> _______________________________________________
> Powered by www.kitware.com
> Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
> Please keep messages on-topic and check the VTK FAQ at: http://www.vtk.org/Wiki/VTK_FAQ
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers

Bryn Lloyd
Computer Vision Laboratory
ETH Zürich, Sternwartstrasse 7
CH - 8092 Zürich, Switzerland
Tel: +41 44 63 26668
Fax: +41 44 63 21199

More information about the vtkusers mailing list