[Insight-developers] Streaming with SliceBySliceImageFilter

Bradley Lowekamp blowekamp at mail.nih.gov
Wed Aug 4 17:51:58 EDT 2010


Hello,

I worked on this filter a bit this afternoon. In addition to making it streamable, I also improved the performance significantly by using image iterator instead of image indices for copying slice regions. The application pipeline when from taking 880 to 350 seconds!  (4Kx4Kx300 image) Fat loops with lots of conditionals are not as efficient as tight Image iterator loops. Other optimization were made too.

I have the changes on my github account:

http://github.com/blowekamp/ITK/network

I have a few little things to tie up with it, and I reserve the right to rebase the branches on github ( you have been warned! ) I will also long this into mantis as well.

Brad

On Aug 4, 2010, at 11:49 AM, Lowekamp, Bradley (NIH/NLM/LHC) [C] wrote:

> Hello Gaetan,
> 
> First let me thank you for all you IJ contributions, I am trying to use a surprising number of them with the pipeline I am assembling: 
> 
> reader->SliceBySlice( GrayscaleMorphologicalOpeningImageFilter )->ProjectionImageFilter( EntropyAccumulator )->StreamingImageFilter
> 
> At any rate the documentation for SliceBySliceImageFilter says:
> 
>  * The requested region is always enlarged by the filter to cover entirely
>  * the whole slice - however, only the slice in the requested region are
>  * processed (the requested region is not enlarged to the whole image if
>  * not needed).
>  *
> 
> That lead me to believe that this filter should stream in a nice fashion slice by slice. I observed that is was not streaming, because we have the following implementation:
> 
> ::GenerateInputRequestedRegion()
> {
>   // call the superclass' implementation of this method
>   Superclass::GenerateInputRequestedRegion();
> 
>   for( unsigned int i = 0; i < this->GetNumberOfInputs(); i++ )
>     {
>     InputImagePointer  inputPtr = const_cast< InputImageType * >( this->GetInput( i ) );
>   
>     if ( !inputPtr )
>       { 
>       return;
>       }
>   
>     inputPtr->SetRequestedRegion(inputPtr->GetLargestPossibleRegion());
>     }
> }
> 
> 
> This looks easily fixed, which I will begin on. Just wondering if there were problem that you encountered or was there another reason for not streaming?
> 
> Thanks,
> Brad
> 
> ========================================================
> Bradley Lowekamp  
> Lockheed Martin Contractor for
> Office of High Performance Computing and Communications
> National Library of Medicine 
> blowekamp at mail.nih.gov
> 
> 
> <ATT00001..txt>

========================================================
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/20100804/915fdd33/attachment.htm>


More information about the Insight-developers mailing list