MantisBT - ITK
View Issue Details
0011993ITKITKpublic2011-03-21 13:002011-03-21 15:44
Simon Rit 
Bradley Lowekamp 
normalmajoralways
assignedopen 
WindowsWindows7
ITK-3-20 
 
backlog
0011993: Streaming and InPlaceImageFilter
Problem with InPlaceImageFilter when using streaming. When connecting the input of an InPlaceImageFilter to a filter that has been updated and try to write the output of this filter with SetNumberOfStreamDivisions set e.g. to 2, only the first half of the filter is updated.
Compile the test program:
//////////////////////////////////////////////////////////////
#include <itkImageFileReader.h>
#include <itkImageFileWriter.h>
#include <itkMultiplyByConstantImageFilter.h>

int main(int argc, char * argv[])
{
 typedef double PixelType;
 const unsigned int Dimension = 3;
 typedef itk::Image< PixelType, Dimension > ImageType;

 typedef itk::ImageFileReader<ImageType> ReaderType;
 ReaderType::Pointer reader = ReaderType::New();
 reader->SetFileName(argv[1]);
 reader->Update();

 typedef itk::MultiplyByConstantImageFilter< ImageType, PixelType,
ImageType > FilterType;
 FilterType::Pointer filter = FilterType::New();
 filter->SetInput(reader->GetOutput());
 filter->SetConstant(0.);
 filter->SetInPlace(atoi(argv[2]));

 typedef itk::ImageFileWriter< ImageType > WriterType;
 WriterType::Pointer writer = WriterType::New();
 writer->SetInput(filter->GetOutput());
 writer->SetFileName(argv[3]);
 writer->SetNumberOfStreamDivisions(2);
 writer->Update();

 return EXIT_SUCCESS;
}
//////////////////////////////////////////////////////////////

Use a test image input.mha and run successively:
$ testPgm input.mha 0 output0.mha
$ testPgm input.mha 1 output1.mha

output0.mha and output1.mha should be the same but are not: only half of output1.mha is set to 0 instead of the full image.
No tags attached.
Issue History
2011-03-21 13:00Simon RitNew Issue
2011-03-21 15:42Bradley LowekampAssigned To => Bradley Lowekamp
2011-03-21 15:42Bradley LowekampStatusnew => assigned
2011-03-21 15:44Bradley LowekampNote Added: 0025849

Notes
(0025849)
Bradley Lowekamp   
2011-03-21 15:44   
I believe this issue is related to the InPlaceImageFilter not checking that the input buffered region, equals the output buffer.