MantisBT - ITK
View Issue Details
0010008ITKpublic2009-12-07 17:582010-10-21 12:31
Bradley Lowekamp 
Bradley Lowekamp 
normalmajoralways
closedfixed 
 
 
0010008: Unable to stream with JoinSeriesImageFilter, due to 0 sized requested region causing updates
When a JoinSeriesImageFilter is requested to stream, not all of it's inputs need to be updated. To accomplish this the filter sets the input's requested regions to the buffered region ( which is size 0 ). This results in propagation and execution of the upstream pipeline with said 0 sized region. Which then causes excessive execution at best but likely exceptions of erroneous behavior for upstream filters.

Many filters do not handle 0 size regions correctly, including ImageFileReader. Also the ImageRegion appears not to be robust with empty sizes regions as well.

I contend that the pipeline should not execute ProcessObjects who's output has a zero size requested region. But the UpdateOutputInformation and PropagateRequestedRegion should.

By setting the Image's requested region to 0 size a filter is explicitly requesting that no pixel be updated. Therefore, there is no need to execute the up stream filters.

The attach test shows how this bug results in the source image being read N^2 times where N is the number of z slices. ( the input and output must be of metaImage type for IO streaming to work).
The bug can be resolved by adding the following method to ImageBase::

template<unsigned int VImageDimension>
void
ImageBase<VImageDimension>
::UpdateOutputData()
{
  if( this->GetRequestedRegion().GetNumberOfPixels() > 0
      || this->GetLargestPossibleRegion().GetNumberOfPixels() == 0 )
    {
    this->Superclass::UpdateOutputData();
    }
  else
    {
    // itkWarningMacro(<<"Not executing UpdateOutputData RequestedRegion:" << this->GetRequestedRegion() << " BufferedRegion: " << this->GetBufferedRegion());
    }
}

The check for the empty LargestPossibleRegion's size is needed because, some test expect UpdateOutputData to throw an exception when no input has been set.
No tags attached.
cxx itkJoinSeriesImageFilterStreamingTest.cxx (3,421) 2009-12-07 17:58
https://public.kitware.com/Bug/file/2709/itkJoinSeriesImageFilterStreamingTest.cxx
Issue History
2009-12-07 17:58Bradley LowekampNew Issue
2009-12-07 17:58Bradley LowekampFile Added: itkJoinSeriesImageFilterStreamingTest.cxx
2009-12-07 18:01Bradley LowekampDescription Updated
2009-12-07 18:01Bradley LowekampAdditional Information Updated
2009-12-07 18:02Bradley LowekampAdditional Information Updated
2009-12-14 10:45Bradley LowekampStatusnew => assigned
2009-12-14 10:45Bradley LowekampAssigned To => Bradley Lowekamp
2009-12-14 14:41Bradley LowekampNote Added: 0018871
2009-12-23 10:31Bradley LowekampNote Added: 0018986
2010-01-15 09:26Bradley LowekampNote Edited: 0018986
2010-01-15 09:27Bradley LowekampNote Added: 0019146
2010-01-15 09:27Bradley LowekampStatusassigned => resolved
2010-01-15 09:27Bradley LowekampResolutionopen => fixed
2010-10-21 12:31Gabe HartStatusresolved => closed

Notes
(0018871)
Bradley Lowekamp   
2009-12-14 14:41   
Committed Patch:

http://public.kitware.com/cgi-bin/viewcvs.cgi/Code/Common/itkImageBase.txx.diff?cvsroot=Insight&r1=1.60&r2=1.61 [^]
http://public.kitware.com/cgi-bin/viewcvs.cgi/Code/Common/itkImageBase.h.diff?cvsroot=Insight&r1=1.82&r2=1.83 [^]

Committed Test (not enabled yet):
http://public.kitware.com/cgi-bin/viewcvs.cgi/Testing/Code/BasicFilters/itkJoinSeriesImageFilterStreamingTest.cxx?cvsroot=Insight&rev=1.1&view=markup [^]
(0018986)
Bradley Lowekamp   
2009-12-23 10:31   
(edited on: 2010-01-15 09:26)
Committed patch to ImageFileReader so that is will not throw an exception with a zero sized region:
http://public.kitware.com/cgi-bin/viewcvs.cgi/Code/IO/itkImageFileReader.txx?root=Insight&r1=1.88&r2=1.89&sortby=date [^]

(0019146)
Bradley Lowekamp   
2010-01-15 09:27   
The committed patch appears to have fixed the issue.