[Insight-developers] NIfTI, DiffusionTensor3D Pixels, SymmetricSecondRankTensor

kent williams norman-k-williams at uiowa.edu
Wed Mar 11 16:08:50 EDT 2009


I've managed to get myself confused and throw myself on the mercy of the
more mathematically inclined.

Luke logged this bug http://public.kitware.com/Bug/view.php?id=7485 a while
back.  In essence the problem is that ITK and NIfTI disagree about the order
of values when storing a DiffusionTensor3D, and one presumes
SymmetricSecondRankTensor as well. ITK stores upper-triangular and NIfTI
stores lower-triangular.

In the case of DiffusionTensor3D, a symmetric 3x3 matrix, the ordering for a
matrix

A B C
B D E is A B C D E F for ITK, and A B D C E F for NIfTI.
C E F

Given how the NIfTI filter works when it's copying pixels to and from ITK
images, I handle this with an ordering array.  In other words I have an
array
    int niftiorder[9] = { 0,1,3,2,4,5,6 };
and in essence, NIfTIPixel[i] = ITKPixel[order[i]];

That's good for DiffusionTensor3D, but the general case of
SymmetricSecondRankTensor is baffling me. For a 4x4 symmetric matrix
 int niftiorder[10] = { 0, 1, 4, 2, 5, 7, 3, 6, 8, 9 };

and 5x5 is even crazier.
 int niftiorder[15] = { 0, 1, 5, 2, 6, 9, 3, 7, 10, 2, 4, 8, 11, 13, 14 };

So I'm not seeing how I would go about deriving this ordering.  I.e. I don't
know what general purpose code would handle re-ordering the scalars from an
upper triangular to a lower triangular or vice verse.

Does anyone have a suggestion on how to go about this?

And while I'm on the subject, why is the VNL Symmetric Matrix lower
triangular, yet ITK is upper triangular?

 



Notice: This UI Health Care e-mail (including attachments) is covered by the Electronic Communications Privacy Act, 18 U.S.C. 2510-2521, is confidential and may be legally privileged.  If you are not the intended recipient, you are hereby notified that any retention, dissemination, distribution, or copying of this communication is strictly prohibited.  Please reply to the sender that you have received the message in error, then delete it.  Thank you.



More information about the Insight-developers mailing list