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

Luis Ibanez luis.ibanez at kitware.com
Fri Dec 11 17:44:51 EST 2009


Hi Brad,

Thanks for pointing this out and for posting a fix.

The solution sounds reasonable to me.

    Luis


---------------------------------------------------
On Tue, Dec 8, 2009 at 9:41 AM, Bradley Lowekamp <blowekamp at mail.nih.gov> wrote:
> 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
>
>
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Kitware offers ITK Training Courses, for more information visit:
> http://kitware.com/products/protraining.html
>
> Please keep messages on-topic and check the ITK FAQ at:
> http://www.itk.org/Wiki/ITK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.itk.org/mailman/listinfo/insight-developers
>
>


More information about the Insight-developers mailing list