[Insight-developers] Re: Vector image pixel type ?
Luis Ibanez
luis.ibanez at kitware.com
Sat Sep 24 12:27:07 EDT 2005
Hi Kris,
Please keep in mind that ITK is wrapped for Tcl, Python
and Java, and that the wrapping process is equivalent to
explicit instantiation.
Due to this, it is not appropriate to have operators that
we count on not being compiled. Instead, we are bounded to
have a design where all the methods of a class are instantiated
and tested.
Regards,
Luis
---------------------
Kris Thielemans wrote:
> Hi Karthik
>
> it's probably too late by now, but I do have a comment on this thread. Feel
> free to ignore it.
>
>
>> Image< P, 3 >
>>
>>It would make sense for P to have a bunch of operations defined, so
>>filters can work just as usual with it.
>>
>>For instance
>>P1 + P2, P1*P2, P1*scalar, etc.....
>>
>>I would hesitate to add these operations to itk::Array, since its too
>>general. People could for instance be using an Array of images or an
>>array of transforms. You can't define any operations here. It the same
>>reason why there is both itk::Vector and itk::FixedArray.
>
>
> In another library, I was faced with exactly the same design decision. Do I
> add operator+ etc to the Array class or not?
>
> At first go, I didn't, essentially because I didn't want to compilation to
> break when using a non-numeric type for P, which I believe is what you are
> saying as well. Then I remembered that as all this is with templates, and
> templated classes have the very useful property that their members are NOT
> compiled, unless you call them (or you instantiate the whole class
> explicitly obviously).
> So, you can add operator+ to Array, and it won't break anything, even if you
> use std::vector for P.
>
> So, I reversed my first design. I got rid of my 2nd class (let's call it
> NumericArray) and moved all its numerical operators to the Array class.
> Result: 1 class less to worry about, less lines of code, and exactly the
> same functionality. I still think that's the best thing to do.
>
> PS: if you reply, please CC to my email address. I'm travelling and have
> disabled the list.
>
> All the best
>
> Kris Thielemans
> Hammersmith Imanet, part of GE Healthcare London, UK
>
> _______________________________________________
> 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