[Insight-developers] Unlike in WarpImageFilter, WarpVectorImageFilter::SetDeformationField takes a non-const deformation field

Tom Vercauteren tom.vercauteren at m4x.org
Fri Mar 6 04:27:34 EST 2009


I would be inclined to think the same but you can always imagine some
weird case in which a user has overridden
  void SetDeformationField( DeformationFieldType * field );

Anyhow, such a user could get into trouble with the patch I committed.
If he was calling SetDeformationField with a const pointer, the method
that used to be executed would be his overridden method, whereas now,
it would be the new const method...

I doubt that this is reasonable scenarios though. However I feel it
very difficult to see the line between acceptable and non-acceptable
changes w.r.t. backwards compatibility...

Tom

On Thu, Mar 5, 2009 at 22:00, Bradley Lowekamp <blowekamp at mail.nih.gov> wrote:
> Are both methods needed? Can't any  DeformationFieldType* be converted
> to const DeformationFieldType* with out a problem?
> On Mar 5, 2009, at 3:11 PM, Bill Lorensen wrote:
>
> You could just add the const call and leave the old one. The Set ends
> up calling ProcessObject::SetNthInput which does not take a const
> input. This would be fully backward compatible.
>
> Bill
>
> On Thu, Mar 5, 2009 at 11:41 AM, Tom Vercauteren
> <tom.vercauteren at m4x.org> wrote:
>
> Hi,
>
> Sorry for being so noisy recently...
>
> I stumbled on the following problem. The signature of
>
> WarpVectorImageFilter::SetDeformationField is
>
>  void SetDeformationField( DeformationFieldType * field );
>
> instead of
>
>  void SetDeformationField( const DeformationFieldType * field );
>
> in WarpImageFilter.
>
> This requires me to use some const_cast that I would like to avoid.
>
> May I just fix this const-correct issue? Or would it also potentially
>
> break backwards compatibility?
>
> Tom
>
> P.S.: The const correctness change to WarpImageFilter was committed
>
> some 5 years ago:
>
> http://www.itk.org/cgi-bin/viewcvs.cgi/Code/BasicFilters/itkWarpImageFilter.h?root=Insight&r1=1.17&r2=1.18&sortby=date
>
> _______________________________________________
>
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.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
>
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.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
>
> ========================================================
>
> Bradley Lowekamp
>
> Lockheed Martin Contractor for
>
> Office of High Performance Computing and Communications
>
> National Library of Medicine
>
> blowekamp at mail.nih.gov
>
>


More information about the Insight-developers mailing list