[Insight-developers] Change to ImageBase, the zero sized region issue

Bradley Lowekamp blowekamp at mail.nih.gov
Tue Dec 8 09:41:17 EST 2009


Hello,

I have reported the following issue http://www.itk.org/Bug/view.php?id=10008:

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).

I have also have a solution:

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.


Does anyone see any potential problems with this solution? 

========================================================
Bradley Lowekamp  
Lockheed Martin Contractor for
Office of High Performance Computing and Communications
National Library of Medicine 
blowekamp at mail.nih.gov


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/mailman/private/insight-developers/attachments/20091208/b4445897/attachment.htm>


More information about the Insight-developers mailing list