[ITK-users] Silly question on itk::Matrix

Jim Miller millerjv at gmail.com
Sat Aug 23 08:12:10 EDT 2014


Matrices and images are row major order.  Points and vectors are column vectors. 

No transpose is necessary.  You can index element by element directly to set the column you want. 

Row major ordering is more popular than column major ordering. I think there are regional preferences as to the"proper" way. I also think electrical engineers prefer one way whereas mechanical engineers prefer the other. Probably is partially based on how disciplines view the composition of coordinate frames (inside out or outside in). 

Some systems allow you to use either convention. We found that leads to a lot of confusion and errors. So 15 years ago, when we started ITK, we chose to pick a single standard for the code. 

Jim

> On Aug 22, 2014, at 9:49 PM, vincent ngai <vincent.ngai at gmail.com> wrote:
> 
> Ah yes, so my question is why is the [] accessor not column major? If points are columns, the matrix elements for the Tx,Ty,Tz translation components should also be columnar? It just seems like extra work to need to get the matrix transpose just to do a Mat * P
> 
> Regards,
> Vincent
> 
> 
>> On Fri, Aug 22, 2014 at 7:14 PM, Jim Miller <millerjv at gmail.com> wrote:
>> ITK standard is that points are column vectors. Thus, matrix times a point a point is defined as Mat * P
>> 
>> Jim
>> 
>> > On Aug 22, 2014, at 3:30 AM, vincent ngai <vincent.ngai at gmail.com> wrote:
>> >
>> > Hi all, pardon me for this silly question on itk::Matrix. Why do I need to transpose a translation matrix after I copy the [x,y,z] translation values to the matrix[3].
>> >
>> > I know conceptually it should not really matter whether its row or col major so long as you can
>> > post multiply or pre multiply with another vector. But the way operator*() works only allows for
>> > Matrix * P, and when I test the simple case of TranslationMatrix * Point, I would have to transpose the matrix. If I could also do Point * TranslationMatrix, then i wouldn't need to transpose.
>> >
>> > Any ideas?
>> >
>> > --
>> > Regards,
>> > Vincent
>> > _____________________________________
>> > Powered by www.kitware.com
>> >
>> > Visit other Kitware open-source projects at
>> > http://www.kitware.com/opensource/opensource.html
>> >
>> > Kitware offers ITK Training Courses, for more information visit:
>> > http://www.kitware.com/products/protraining.php
>> >
>> > 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://public.kitware.com/mailman/listinfo/insight-users
> 
> 
> 
> -- 
> Regards,
> Vincent
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/insight-users/attachments/20140823/56303acb/attachment.html>


More information about the Insight-users mailing list