[Insight-users] Using an ITK reader multiple times

Dirk Boye body at nabla.org
Fri Oct 9 06:04:04 EDT 2009


Dear listmembers,
I am trying to use the ITK reader multiple times and the dimensions wont
get updated.

typedef itk::ImageFileReader<ImageType>  		ReaderType;
typedef itk::ImageToVTKImageFilter<ImageType>   	ConnectorType;

...
// member pointers of a class a
mp_readeritk = ReaderType::New();
mp_connector = ConnectorType::New();

a::loadImage(fileName) {
mp_readeritk->ResetPipeline();
mp_readeritk->SetFileName( fileName.toStdString().c_str() );

mp_readeritk->UpdateLargestPossibleRegion();
mp_readeritk->Update();
mp_readeritk->GetOutput()->Update();
mp_readeritk->GetOutput()->UpdateOutputInformation();

mp_connector->ResetPipeline();
mp_connector->SetInput( mp_readeritk->GetOutput() );

mp_connector->UpdateLargestPossibleRegion();
mp_connector->Update();
mp_connector->UpdateOutputInformation();
mp_connector->GetOutput()->UpdateData();
mp_connector->GetOutput()->UpdateInformation();
mp_connector->GetOutput()->Update();

mp_connector->GetOutput()->GetDimensions(m_dimensions);
// m_dimensions is of type int[3]
}

As you can see I tried alot of Updates :-)
When i load the first image, m_dimensions is correct. When i load
the second image later on, m_dimensions still has the values from the
first time. If i load the second image again (calling load a third time)
the values are correct. If i load (1st image, 2nd image, 1st image) the
values are always the ones of the 1st image.

To sum up:
(1st image) -> m_dimensions = 1st image dim
(1st image, 2nd image) -> m_dimensions= 1st image dim
(1st , 2nd, 1st) -> m_dimensions=1st image dim
(1st , 2nd, 2nd) -> m_dimensions=2nd image dim

Has it something to do with the update extent?

I don't understand it.


Thank you!

Cheers,
Dirk




More information about the Insight-users mailing list