[Insight-developers] Confused about persistance of filter outputs

Luis Ibanez luis.ibanez@kitware.com
Mon, 28 Apr 2003 11:10:30 -0400


Hi Hans,

About your second set of examples:

All of them are missing the SmartPointers.

Is this intentional in the code you want to
illustrate or is it just an omission ?

For example, and STL list of <itk::Image<>>
will not work. You could only use raw pointers
to images or smart pointers to images.

Default constructors have been declared protected
in order to prevent images from being declared as
static variables.

The same goes for filters.


Luis


-------------------------
Hans Johnson wrote:
> Luis,


> ...
> 
> 2) A common pitfalls appendix with examples
>      -) All of the images in MyNewImagesList will have a smart pointer 
> to the same image.
> 
>         std::list<itk::Image<>> MyImagesList;
>         std::list<itk::Image<>> MyNewImagesList;
>         itk::FilterX X=itk::FilterX::New()
>         for( currImage in MyImagesList )
>         {
>             X.SetInput(currImage);
>             X.Update();
>             MyNewImagesList.push_back(X.GetOutput);
>          }
> 
>       -) This will cause errors because MyNewImage was never allocated.
> 
>         itk::Image<> MyImage;
>         itk::Image<> MyNewImage;
>         {
>            itk::FilterX X=itk::FilterX::New()
>            X.SetInput(MyImage);
>            //NOTE: No UpdateCommand
>            MyNewImage=X.GetOutput();
>          }
>          itk::FilterY Y=itk::FilterY::New();
>          Y.SetInput(MyNewImage);
>          Y.Update();
> 
> 
> Both of these issues are closely related to not fully understanding the 
> pipeline, and making improper assumptions about it's behavior.
> 
> Again, Thanks for all your help.
> 
> Hans
> 
> 
> 
>