[Insight-developers] Vector & CovariantVector

Arnaud Gelas arnaud_gelas at hms.harvard.edu
Fri Mar 27 11:43:05 EDT 2009


Hi Luis,

While fixing the "assert" issue in itkCrossHelper, I read your message 
stating that normals should be represented as CovariantVector.

First could you remind why CovariantVector are important (I know it is 
related to AffineTransformation)? I remember there is a mathematical 
reason why this is, i just do not remember what the reason is.

Then, practically, the introduction of covariant vectors in ITK is quite 
recent, with regard to itk lifespan. Some parts of the toolkits (the 
most recent ones) use covariant vectors where they should, but older 
parts are still using the original design where everything is made of 
vectors.

Practically, when working with low level operations, you don't really 
have choice if you don;t want to rewrite everything:

    * itk::Point - itk::Point = itk::Vector
    * itk::Point as one method GetVectorFromOrigin() which returns one
      itk::Vector
    * itk::Point + itk::Vector = itk::Point
    * and few more operators in itk::Point (+=, -=, /etc/...)

Now, if the basic operations, such as,  but not limited to, those listed 
above, were to return covariant vectors, it would be of course my 
pleasure to support covariant vectors.
Now, the modifications we are speaking about here, are not for the faint 
of heart, as it touches itk kernel and would most surely impact a lot of 
classes. Did I heard the word "backward compatibility" before? Would 
there be any magical design pattern that would allow us to work around 
this? I'm very junior with design patterns, to say the less, but would 
an adaptor or decorator be possible? I am willing to help implement 
solutions, I just cannot figure what the good solution is. Would you 
think about anything?

arnaud & alex.




More information about the Insight-developers mailing list