[ITK-dev] regarding ImageFileReader::GenerateOutputInformation()

Bradley Lowekamp blowekamp at mail.nih.gov
Thu Aug 13 15:11:32 EDT 2015


Hello Rashad,

If you call ImageFileReader::UpdateOutputInformation() 2 times is "should" only call GenerateOutputInformation once.

The key to this behavior is the management of the timestamps in the process object classes done here [1].

What is required for this to work correctly is that the only the correct object get modified in these pipeline methods. When an object is modified the timestamp should be updated, and downstream processes get marked as out of date.

The best way to make sure your ImageSource does not get call twice is to write a test, that makes sure the process object's MTime does not change in GenerateOutputInformation call.

HTH,
Brad

[1] https://github.com/InsightSoftwareConsortium/ITK/blob/9f88e4e3b388ee2f1c1c006ae36de0613d305284/Modules/Core/Common/src/itkProcessObject.cxx#L1431-L1542

On Aug 13, 2015, at 2:55 PM, Rashad M <mohammedrashadkm at gmail.com> wrote:

> Hello all,
> 
> The documentation of   itk::ProcessObject::GenerateOutputInformation( )  says
> Generate the information describing the output data. [1]. The GenerateOutputInformation() in itkImageFileReader first create all instances of ImageIO and setup direction, spacing, etc.. 
> 
> If I understand correctly, the GenerateOutputInformation in the image file reader is  called by UpdateOutputInformation( )
> 
> To my question, 
> If I call reader->UpdateOutputInformation() for first time it calls 
> reader->GenerateOutputInformation() as described in docs[2]. 
> 
> Now If I have a second call to reader->UpdateOutputInformation( ) ?
> 
> Will it again go to GenerateOutputInformation() and createAllInstances of imageio , do the same thing again!
> 
> In itkProcessObject.cxx, there is the below documentation
> 
>    * Call GenerateOutputInformation for subclass specific information.
>    * Since UpdateOutputInformation propagates all the way up the pipeline,
>    * we need to be careful here to call GenerateOutputInformation only if
>    * necessary. Otherwise, we may cause this source to be modified which
>    * will cause it to execute again on the next update.
> 
> How can I prevent it from calling it again in class sub class of itk::ImageSource?
> 
> [1]http://www.itk.org/Doxygen/html/classitk_1_1ProcessObject.html#abe61fb6b7de8c443e7af1561bd722736
> 
> 
> -- 
> Regards,
>    Rashad
> _______________________________________________
> 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.php
> 
> 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://public.kitware.com/mailman/listinfo/insight-developers

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/insight-developers/attachments/20150813/a15e8e0b/attachment.html>


More information about the Insight-developers mailing list