[Insight-developers] Streaming with SliceBySliceImageFilter

Gaëtan Lehmann gaetan.lehmann at jouy.inra.fr
Thu Aug 5 09:42:47 EDT 2010


Hi Brad,


Le 4 août 10 à 23:51, Bradley Lowekamp a écrit :

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

that sounds nice :-)

You're right, the input requested region is wrong. One more bug from  
me! Your fix looks nice.

The GetSliceIndex() is public on purpose: it is there to allow to get  
the slice number during the filter execution, for example to change  
some parameter in the internal pipeline.

Regards,

Gaëtan


>
> 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
>
>
> _______________________________________________
> 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

-- 
Gaëtan Lehmann
Biologie du Développement et de la Reproduction
INRA de Jouy-en-Josas (France)
tel: +33 1 34 65 29 66    fax: 01 34 65 29 09
http://voxel.jouy.inra.fr  http://www.itk.org
http://www.mandriva.org  http://www.bepo.fr

-------------- next part --------------
A non-text attachment was scrubbed...
Name: PGP.sig
Type: application/pgp-signature
Size: 203 bytes
Desc: Ceci est une signature ?lectronique PGP
URL: <http://www.itk.org/mailman/private/insight-developers/attachments/20100805/3dd1f52a/attachment.pgp>


More information about the Insight-developers mailing list