[Insight-users] A combination between ITK and VTK, read a series of the medical CT images and incorrect run of the vtkRenderWindowInteractor

Luis Ibanez luis.ibanez at kitware.com
Sat Jun 19 10:13:30 EDT 2004


Hi Paulus,

ITK is N-Dimensional. Almost all of the algorithms in ITK
have been implemented for N dimensions. With a few exceptions,
all the segmentation methods can be run in 2D, 3D, 4D images
just by instantiating the image templates for the appropriate
dimension. Registration algorithms are also all implemented
in N-Dimensions, with the single exception of the 3D/2D registration
algorithms that are very specify for image guided surgery and
computer assisted diagnosis.



About your processing:

1) Combining ITK and VTK is certainly a good idea.
    Processing the image with ITK and then displaying with VTK
    is a good way of taking advantage of the best functionalities
    available on each toolkit.

2) You don't need to process 2D slices one by one. It is better
    to do native 3D processing, unless your datasets is too big
    for fitting in memory.

3) The vtkImageActor is actually used inside the vtkImageViewer.
    The vtkImageViewer simply provides a convinient packaging for
    a group of classes needed for image display. You will find a
    lot more about this in the vtkusers list.

4) For a good example on how to visualize orthogonal slices from
    the same voluem, please look at the code of the demo application:


              InsightApplications/
                       LiverTumorSegmentation

    In particular look at the class:

             ImageSliceViewer

    You will see there a convenient way of using VTK for image display.
    This will also answer your questions about mouse interaction.


5) If any of your windows keeps displaying an outdated image, this
    indicates that you are missing to invoke Render() on them.

    Keep in mind that VTK by default does not do push through the
    pipeline. Instead you must pull data from the last element in
    the pipeline which is usually a RenderWindow or a FileWriter.

    A visit to the application recommended above will help you.

    You may also want to look to SNAP. Although you should be
    aware that SNAP is a much more sophisticated application and
    following its code may require additional coffee.





Unless you have good reasons for using MFC, I would strongly
suggest you to use FLTK instead.



Regards,



    Luis




----------------
paulus joo wrote:

> Dear Luis, vtk users and itk users
>  
> Luis, thank you for your great guidance in your reply of my previous 
> mail. I hope you still have enough power to answer my another questions :-)
>  
> I sent this mail below to the vtk mailing list but there is no reply 
> yet, so I compile it again and send it to this mailing list.
> Please ignore (forgive me :)  ) the VTK part if you think it doesn't 
> appropriate to mention here.
>  
>  
>  
> Forgive me for just asking you without giving any contribution yet, 
> since I am still newbie in ITK and VTK.  Hope you can still enough time 
> to help me to answer my questions.
> I want to read a series of CT medical images (Dicom) format, apply image 
> processing methods to obtain the desired quality of images and render 
> the volume using volume rendering or surface rendering. For these 
> purposes I  will combine VTK and ITK since as far as I know these two 
> brother is suitable for these tasks.  I develop the application with MS 
> VC (MFC based). Below are the steps I will do:
> 1. Read Dicom files (using ITK)
> 2. Apply image processing methods on each 2D images (using ITK). I hope 
> there are several methods work on 3D volume directly also.
> 3. Apply segmentation process (using ITK) on each 2D images or in a 3D 
> volume. The result of this step feed to surface rendering step.
> 4. Use the itkImageToVTKImageFilter to convert the 2D images or 3D 
> volume to the format recognized by VTK.
> 5. Apply volume rendering or surface rendering.
> 6. Make a render window that contains 4 different renderers, one 
> renderer to display volume or surface rendering result, and the rest (3 
> renderers) are used to display the 3 desired slices.  
>  
> Here are the list of what I've done:
> 1. Try to open image file by ITK function and convert it to VTK format 
> and display it with VTK. I tried this and succeed to open one image file 
> as illustrated in the code below.
> 2. Convert medical3.cxx example of VTK to MFC based so I can add control 
> button (slider, spinner, checkbox,etc). I succeed to do this although 
> the speed is slower than its original version.
> 3. Modify the result where there are 4 vtkRenderer instead of one, so 
> the 3D is displayed in one vtkRenderer, and the rest will displays the 
> slices in axial, sagittal, coronal plane. The result is not like what I 
> expect since the 3 renderer display the same image. I also add two 
> button to navigate from one slice to another.
>  
> Here  are my questions and the problems I have:
> 1. Is the step mention above are correct to achieve the goal I need?
> 2. Apply image processing methods of ITK, then feed the result to the 
> VTK. Is this correct? Or do with VTK functions is enough? 
> 3. Based on the book, milist and the result of the trial I made, I make 
> an assumption that to display the resliced images from a volume, it is 
> used vtkImageActor instead of vtkImgeViewer. Is this correct?
> 4. I have a difficulties to find a good way how to reslice the volume 
> and display it in 3 renderer, since these 3 renderers produce the same 
> images, and I cannot navigate from one slice to another slice in each 
> direction (sagittal,axial,coronal). Please show me what the mistakes 
> I've done in the code?  
> 5. As I mentioned above I have 4 renderer, lets say ren1,ren2,ren3,ren4. 
> The ren1 is used for the 3D visualization, and the other are used to 
> display the 3 resliced images. I want to change the default interaction 
> mode of the vtkRenderWindowInteractor in ren2,ren3 and ren4 by issuing 
> ren2->interactiveOff(). This function run incorrectly since when I click 
> the mouse on ren2 area it influence ren1 so the 3D object in ren1 is 
> moving. How to avoid this problem so 3D object is moving just by the 
> interaction in ren1. 
> 6.In the dialog module that contains VTK and ITK part, sometimes 
> unexpected image (image from the previous running also) appears when the 
> dialog window is displayed. The image should appears when I push the 
> button. This is not happend in a dialog module that contains only VTK 
> code. Is this because I didn't pay attention to the Smart Pointer or 
> there was a mistake on my code. 
>  
>  
> Thank you in advance.
> Paulus
>  
>  
>  
> // THE CODE TO READ IMAGE AND CONVERT ITK TO  VTK
>  
> #include "itkImage.h"
> #include "itkImageFileReader.h"
> #include "itkImageFileReader.h"
> #include "vtkImageViewer.h"
> #include "vtkRenderWindowInteractor.h"
> #include "itkImageToVTKImageFilter.h"
>  
> 
> int main( int argc, char ** argv )
> {
>   typedef unsigned short      PixelType;
>   const   unsigned int        Dimension = 2;
>  
>   typedef itk::Image< PixelType, Dimension >   ImageType;
>   typedef itk::ImageFileReader< ImageType >    ReaderType;
>   typedef itk::ImageToVTKImageFilter< ImageType > ConnectorType;
>  
>   ReaderType::Pointer reader = ReaderType::New();
>   ConnectorType::Pointer connector = ConnectorType::New();
>   reader->SetFileName( argv[1] );
>   //reader->Update();
>  
>   connector->SetInput(reader->GetOutput());   
>  
>   vtkImageViewer *viewer=vtkImageViewer::New();
>   vtkRenderWindowInteractor 
> *renderWindowInteractor=vtkRenderWindowInteractor ::New();
>   viewer->SetupInteractor(renderWindowInteractor);
>   viewer->SetInput(connector->GetOutput());
>   viewer->Render();
>   viewer->SetColorWindow(255);
>   viewer->SetColorLevel(128);
>   //renderWindowInteractor->Start();
>  
>   return 0;
> }
>  
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> Insight-users mailing list
> Insight-users at itk.org
> http://www.itk.org/mailman/listinfo/insight-users





More information about the Insight-users mailing list