[Insight-developers] Const-Correctness problem in itk::ImageToImageMetric?

Luis Ibanez luis.ibanez at kitware.com
Sat Jul 29 17:22:55 EDT 2006


Hi Henning,

As explained in the reply to Kent, the reason for lacking full
const-correctness in ITK is the fact that the underlying pipeline
was not developed in a const-correct manner.

We could fix the API offered to users, but internally we still
will have to remove the constness in order to satisfy the current
API of the pipeline. We could also fix the API of the pipeline,
but that represents a mayor effort. If you consider that this is
a high priority you are welcome to include it in the list of
tasks that developers could undertake in the schedule of maintenance
for the following year.


I'm not sure that I understand your statement:

        "I also dislike,
         that there is no automatic non const
         to const cast avialable."


You can always pass a non-const object to a function that expects
a const. There is no need for casting in that case.

Could you indicate more specifically in what case do you think
and automatic casting is needed ?, and what exactly do you mean
by "automatic casting" ?



    Thanks


       Luis


----------------------
Henning Meyer wrote:
> Many of the filters take nonconst input even though most of them
> shouldn't modify their input.
> I also dislike, that there is no automatic non const to const cast 
> avialable.
> I think const correctness is really an issue in ITK.
> 
> Henning
> 
> 2006/7/25, Kent Williams <kent at psychiatry.uiowa.edu>:
> 
>> This came up when I was working on setting masks for image registration.
>>
>> Is there a reason that itk::ImageToImageMetric::SetFixedImageMask takes
>> a non-const pointer to an Image mask type?  Given that the class is
>> never going to modify the Mask, shouldn't it be const?
>>
>> _______________________________________________
>> Insight-developers mailing list
>> Insight-developers at itk.org
>> http://www.itk.org/mailman/listinfo/insight-developers
>>
> _______________________________________________
> Insight-developers mailing list
> Insight-developers at itk.org
> http://www.itk.org/mailman/listinfo/insight-developers
> 
> 




More information about the Insight-developers mailing list