[Insight-developers] Const Inputs in ImageFilters

Luis Ibanez luis.ibanez@kitware.com
Mon, 25 Mar 2002 23:54:37 -0500


The corrections for  managing  ConstPointers in ImageFilters
have been checked in.  An Experimental build was made on
Linux first  (Terminus : 0 errors, 71 warnings ).

The basic change is related to the SetInput() method which
is accepting now : ( ImageType * ) as parameter.     Any
SmartPointer< ImageType > refering to Input images has
been made ConstPointer.  

In  most of the filters the types

- InputImageConstPointer
- ImageConstIterator

were introduced to declare the Pointer to an input image and
the associated Iterator to walk over the image.

The typical start of a GenerateData() method is now:

   InputImageConstPointer  inputImage = this->GetInput();
   InputImageConstIterator  itr(  inputImage, 
inputImage->GetRequestedRegion() );

Those metods that require to modify the Regions on Input images
are down casting constness through the const_cast<> operator, like:

 InputImagePointer  image =
   const_cast< InputImageType * >(  this->GetInput().GetPointer()  );

 image->SetLargestPossibleRegion( region );




ProcessObject and DataObject remain unchanged.



   Luis