[Insight-users] itk + vtk + fltk + itkImageseriesreader

W. Storteboom W.Storteboom at student.rug.nl
Wed Jun 8 08:49:43 EDT 2005


I have a problem with showing a series of images that are 
read using itkImageSeriesReader. For the visualization VTK 
is used in combination with FLTK for the GUI.
The converting of the images from ITK to VTK is 
successfull. The connector between ITK and VTK returns a 
vtkImageData that has the correct dimensions of the images 
and the correct number of images that are read in.
After this I want to show the volume of images. I tried to 
use the imagesliceviewer from the insight applications and 
also tried the vtkImageActor. Every time I try, the 
application shuts down (crash) even bypassing the error 
handling.

For showing images in FLTK I used the 
vtkFLRenderWindowInteractor that is shipped with the 
insight applications 2.0.1. For building my application I 
use VTK 4.4, ITK 2.0.1 and FLTK 1.1.6. I also tried it 
with VTK 4.2, ITK 1.8.1 and FLTK 1.1.6. The same crash 
occurs every time. I looked at the 
DeformableModelSimplexMesh example and others from the 
insight applications. I also looked in the books on ITK 
and VTK. Tried the mailing of ITK, VTK, FLTK and CMake. 
Also looked at the tutorials on connecting ITK with VTK. 
The itkImageFileReader example works and I could also get 
the itkImageSeriesReader to work with it but that was 
without FLTK, which I want to use for adding a GUI to the 
program. I have a suspicion that maybe the 
vtkFLRenderWindowInteractor can not cope with the data 
because the crash happens as soon as the slice of the 
volume should be rendered either by a redraw or render.

---------

typedef itk::Image<unsigned char,2> ImageTypeFile;
typedef itk::Image<unsigned char,3> ImageTypeSerie;
typedef itk::ImageFileReader<ImageTypeFile> 
FileReaderType;
typedef itk::ImageSeriesReader<ImageTypeSerie> 
SerieReaderType;
typedef itk::ImageToVTKImageFilter<ImageTypeFile> 
FileConnectorType;
typedef itk::ImageToVTKImageFilter<ImageTypeSerie> 
SerieConnectorType;

try {
   SerieReaderType::Pointer seriereader = 
SerieReaderType::New();
   SerieConnectorType::Pointer serieconnector = 
SerieConnectorType::New();

   seriereader->DebugOn();
   serieconnector->DebugOn();

   seriereader->AddFileName("grey1.png");
   seriereader->AddFileName("grey2.png");

   seriereader->Update();

   serieconnector->SetInput( seriereader->GetOutput() );
   serieconnector->Update();
   serieconnector->GetOutput()->Print(std::cerr);
   //NOTE: m_AxialViewer2 is an imageSliceViewer
   m_AxialViewer2.SetInput( serieconnector->GetOutput() );
   m_AxialViewer2.SelectSlice(0);

   //NOTE: axialview2 is a vtkFlRenderWindowInteractor
   axialview2->redraw();

   Fl::check();
} catch(...) {
   std::cerr << "Error reading the series " << std::endl;
   return;
}

---------
Note by code: this snippet was added to the 
DeformableModelSimplexMesh insight application together 
with an extra axialview (axialview2 & m_AxialViewer2). So 
the setup of VTK, FLTK and ITK elements are correct.

I hope someone knows the answer to this because I have 
seen similar questions to this (but not as specific as 
this) but with no real answer as to a solution. I am 
working on Windows XP sp2 with Microsoft Visual Studio 6 
sp6.

Greetings Wouter Storteboom.
Student Rijksuniversiteit Groningen


More information about the Insight-users mailing list