[Insight-developers] reading Image<Matrix> as Image<SymmetricSecondRankTensor>
Matthew McCormick (thewtex)
matt at mmmccormick.com
Mon Jun 14 12:08:34 EDT 2010
On Mon, Jun 14, 2010 at 10:38 AM, Luke Bloy <luke.bloy at gmail.com> wrote:
> Matt and Karthik,
>
> I believe that Nifti format does support general 2nd rank tensors, via the
> NIFTI_INTENT_SYMMATRIX intent code or genreal matrices via
> NIFTI_INTENT_GENMATRIX intent code.
>
> see
> http://nifti.nimh.nih.gov/nifti-1/documentation/nifti1fields/nifti1fields_pages/group__NIFTI1__INTENT__CODES.html#a29for how the data is stored.
>
> -Luke
>
Hi Luke,
Thanks for the clarification and link.
Matt
>
>
> On 06/14/2010 11:21 AM, Karthik Krishnan wrote:
>
> Matt:
>
> As you've mentioned, I don't think the NRRD and NifTi formats support
> anything but 3 dimensional, 2nd rank symmetric tensors. The meta-image does
> support it, simply by virtue of the fact that a N-D, rank 2 Symmetric tensor
> derives from a fixed array and is serializable as a N*(N-1) component image.
>
> The patch logged in http://vtk.org/Bug/view.php?id=10732 looks fine to me.
>
> As you've mentioned the test to exercise your modification to
> itkImageIOBase (what I think is your real question) would need to use
> MetaImages. I would just add a separate test
> itkSymmetricSecondRankSecondDimensionTensorImageReadTest that uses MetaImage
> instead of Nrrd and then add the proposed patch in.
>
> Thanks
> --
> karthik
>
>
>
> On Mon, Jun 14, 2010 at 7:26 PM, Matthew McCormick (thewtex) <
> matt at mmmccormick.com> wrote:
>
>> Hi Luis,
>>
>> On Mon, Jun 14, 2010 at 6:47 AM, Luis Ibanez <luis.ibanez at kitware.com>wrote:
>>
>>>
>>> Hi Matt,
>>>
>>> Thanks for looking into this problem.
>>>
>>> I'm a bit confused about what you suggest in your email.
>>>
>>> Are you suggesting to change the test
>>> in order to also exercise a 2D case ?
>>>
>>
>> Yes.
>>
>>
>>>
>>> or is it the core of the change, to use an image of
>>> SymmetricSecondRankTensor instead of Matrix2x2
>>> as the source for the image ?
>>>
>>>
>> Yes. In any case, I need to write an image of SymmetricSecondRankTensor
>> to test the bug. For consistency, I should then change the 3D case too?
>> But I do not know if reading an image of Matrix as
>> SymmetricSecondRankTensor is behavior that is expected. If so, I do not
>> want to remove the test for it. Also if so, readers will need to be fixed
>> to behave this way. Personally, I would not necessarily expect this
>> behavior.
>>
>>
>>> Also, have you identified the changes that we will
>>> have to introduce in the Writer/Reader in order to
>>> get this test to pass ?
>>>
>>
>> Changing the file name on the test shows that MetaImage, NRRD, and NIfTI
>> all pass for the 3D case.
>>
>> As far as I can tell, NRRD and NIfTI do not support 3 component
>> symmetric second rank tensor. MetaImage does support it, but its behavior
>> would have to change. I am working on adding support to the VTKImageIO, but
>> it can not support generic 2x2 or 3x3 matrices.
>>
>>
>>>
>>>
>>> Could you please clarify ?
>>>
>>>
>> Hopefully this clarifies, but let me know if it is still unclear.
>>
>> Thanks,
>> Matt
>>
>>
>>>
>>> Thanks
>>>
>>>
>>> Luis
>>>
>>>
>>> ----------------------------------------------------------
>>> On Sun, Jun 13, 2010 at 12:38 AM, Matthew McCormick (thewtex) <
>>> matt at mmmccormick.com> wrote:
>>>
>>>> Hi,
>>>>
>>>> I am working on adding 2D SymmetricSecondRankTensor image write
>>>> support. The bug is here.
>>>> http://vtk.org/Bug/view.php?id=10732
>>>>
>>>> In order to add a test for the bug, I was thinking of modifying
>>>> Testing/Code/IO/itkSymmetricSecondRankTensorImageReadTest.cxx
>>>>
>>>> Currently, this test creates an Image of 3x3 itk::Matrix, writes it to
>>>> file, reads it in as an Image of SymmetricSecondRankTensor's, and checks to
>>>> ensure the content is the same.
>>>>
>>>> If I try to do the same with 2x2 itk::Matrix, the
>>>> SymmetricSecondRankTensor reader does not read the correct components:
>>>> 941: Test command: /mnt/datab/itkcvsb/bin/itkIOTests
>>>> itkSymmetricSecondRankTensorImageReadTest
>>>> /mnt/datab/itkcvsb/Testing/Temporary/testSymmetricTensor1.nrrd
>>>> /mnt/datab/itkcvsb/Testing/Temporary/testSymmetricTensor2.nrrd
>>>> 941: Test timeout computed to be: 1500
>>>> 941: Tensor read does not match expected values
>>>> 941: Index [0, 0]
>>>> 941: Tensor value
>>>> 941: 1 2 2
>>>> 941: Matrix value
>>>> 941: 1 2
>>>> 941: 2 3
>>>> 941:
>>>>
>>>> If the commented code, where an image of 2D SymmetricSecondRankTensor (
>>>> instead of itk::Matrix ) is written, is used with the MetaImage format the
>>>> test can pass.
>>>>
>>>> Is it OK to change the test as in the commented code, or are other
>>>> changes required?
>>>>
>>>> Thanks,
>>>> Matt
>>>>
>>>>
>>>>
>>>> _______________________________________________
>>>> 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://kitware.com/products/protraining.html
>>>>
>>>> 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://www.itk.org/mailman/listinfo/insight-developers
>>>>
>>>>
>>>
>>
>> _______________________________________________
>> 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://kitware.com/products/protraining.html
>>
>> 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://www.itk.org/mailman/listinfo/insight-developers
>>
>>
>
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects athttp://www.kitware.com/opensource/opensource.html
>
> Kitware offers ITK Training Courses, for more information visit:http://kitware.com/products/protraining.html
>
> 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://www.itk.org/mailman/listinfo/insight-developers
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/mailman/private/insight-developers/attachments/20100614/acdd9779/attachment.htm>
More information about the Insight-developers
mailing list