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

paulus joo paulusjoo at hotmail.com
Thu Jun 17 05:12:34 EDT 2004


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;
}

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://public.kitware.com/pipermail/insight-users/attachments/20040617/d4100d80/attachment.htm


More information about the Insight-users mailing list