[Insight-users] Load Vector Image with itk-Python

Oscar Esteban oesteban at die.upm.es
Mon Jun 27 12:32:32 EDT 2011


Hi Dženan,

Thank you very much for your answer, I will try it as 4D image. Probably it
will work :)

The problem is that I selected the component vector because I didn't find a
way to add a new timestep to a 4D image in ITK-Python :( . Any clue?

Bests, and thank you all again :)

Oscar Esteban


*______________________________________*
*Oscar Esteban*
PhD Student / Researcher
Biomedical Image Technologies (Universidad Politécnica de Madrid)

ETSI Telecomunicación (Lab. C203)
Av. Complutense s/n - E-28040 Madrid (Spain)
+34 915 495 700 ext.4234



On 27 June 2011 09:43, Dženan Zukić <dzenanz at gmail.com> wrote:

> Well your file was written as a 4D image, the vector components being the
> 4th dimension.
>
> It should not be hard to convert the 4th dimension to 62-component vectors
> in 3D image. I do not have any code excerpts which would help you though.
>
> HTH,
> Dženan
>
> On Mon, Jun 27, 2011 at 09:18, Oscar Esteban <oesteban at die.upm.es> wrote:
>
>> Hi Gaëtan,
>>
>> "print r" gives me the next output:
>>
>> <C itk::SmartPointer<(itk::ImageFileReader<(itk::VectorImage<(unsigned
>>> short,3u)>,itk::DefaultConvertPixelTraits<(unsigned short)>)>)> instance at
>>> _8058f60600000000_p_itk__SmartPointerTitk__ImageFileReaderTitk__VectorImageTunsigned_short_3u_t_itk__DefaultConvertPixelTraitsTunsigned_short_t_t_t>
>>
>>
>>  These are the headers:
>>
>>> $ mri_info DTI.nii.gz
>>> Volume information for DTI.nii.gz
>>>           type: nii
>>>     dimensions: 128 x 128 x 44 x 62
>>>    voxel sizes: 2.0000, 2.0000, 3.0000
>>>           type: FLOAT (3)
>>>            fov: 256.000
>>>            dof: 0
>>>         xstart: -128.0, xend: -128.0
>>>         ystart: -128.0, yend: -128.0
>>>         zstart: -66.0, zend: -66.0
>>>             TR: 5043.00 msec, TE: 0.00 msec, TI: 0.00 msec, flip angle:
>>> 0.00 degrees
>>>        nframes: 62
>>>        PhEncDir: UNKNOWN
>>> ras xform present
>>>     xform info: x_r =  -1.0000, y_r =   0.0000, z_r =   0.0000, c_r =
>>> 6.7797
>>>               : x_a =   0.0000, y_a =   1.0000, z_a =   0.0000, c_a =
>>>  50.8135
>>>               : x_s =   0.0000, y_s =   0.0000, z_s =   1.0000, c_s =
>>>  21.9552
>>> Orientation   : LAS
>>> Primary Slice Direction: axial
>>>
>>> voxel to ras transform:
>>>                -2.0000   0.0000   0.0000   134.7797
>>>                 0.0000   2.0000   0.0000   -77.1865
>>>                 0.0000   0.0000   3.0000   -44.0448
>>>                 0.0000   0.0000   0.0000     1.0000
>>>
>>> voxel-to-ras determinant -12
>>>
>>> ras to voxel transform:
>>>                -0.5000   0.0000   0.0000    67.3898
>>>                -0.0000   0.5000  -0.0000    38.5932
>>>                -0.0000  -0.0000   0.3333    14.6816
>>>                 0.0000   0.0000   0.0000     1.0000
>>
>>
>> $ mri_info test.nii.gz
>>> Volume information for test.nii.gz
>>>           type: nii
>>>     dimensions: 128 x 128 x 44
>>>    voxel sizes: 2.0000, 2.0000, 3.0000
>>>           type: FLOAT (3)
>>>            fov: 256.000
>>>            dof: 0
>>>         xstart: -128.0, xend: -128.0
>>>         ystart: -128.0, yend: -128.0
>>>         zstart: -66.0, zend: -66.0
>>>             TR: 0.00 msec, TE: 0.00 msec, TI: 0.00 msec, flip angle: 0.00
>>> degrees
>>>        nframes: 1
>>>        PhEncDir: UNKNOWN
>>> ras xform present
>>>     xform info: x_r =  -1.0000, y_r =   0.0000, z_r =   0.0000, c_r =
>>> 6.7797
>>>               : x_a =   0.0000, y_a =  -1.0000, z_a =   0.0000, c_a =
>>>  -205.1865
>>>               : x_s =   0.0000, y_s =   0.0000, z_s =   1.0000, c_s =
>>>  21.9552
>>> Orientation   : LPS
>>> Primary Slice Direction: axial
>>> voxel to ras transform:
>>>                -2.0000   0.0000   0.0000   134.7797
>>>                 0.0000  -2.0000   0.0000   -77.1865
>>>                 0.0000   0.0000   3.0000   -44.0448
>>>                 0.0000   0.0000   0.0000     1.0000
>>> voxel-to-ras determinant 12
>>> ras to voxel transform:
>>>                -0.5000   0.0000   0.0000    67.3898
>>>                 0.0000  -0.5000   0.0000   -38.5932
>>>                -0.0000  -0.0000   0.3333    14.6816
>>>                 0.0000   0.0000   0.0000     1.0000
>>
>>
>> I'm sorry about the delay, but the list rejected previous emails
>> containing image captures.
>>
>> Thanks. Best Regards,
>>
>>
>>
>> *______________________________________*
>> *Oscar Esteban*
>> PhD Student / Researcher
>> Biomedical Image Technologies (Universidad Politécnica de Madrid)
>>
>> ETSI Telecomunicación (Lab. C203)
>> Av. Complutense s/n - E-28040 Madrid (Spain)
>> +34 915 495 700 ext.4234
>>
>>
>>
>> 2011/6/21 Gaëtan Lehmann <gaetan.lehmann at jouy.inra.fr>
>>
>>>
>>> Hi,
>>>
>>> Le 21 juin 11 à 17:52, Oscar Esteban a écrit :
>>>
>>>
>>>  Hi all,
>>>>
>>>> I'm trying to load a 62 component vector image with itk using the Python
>>>> wrapping. I executed this:
>>>>
>>>> 1: import itk
>>>> 2: r = itk.ImageFileReader.VIUS3.New( FileName='DTI.nii.gz' )
>>>>
>>>
>>> can you run
>>>
>>>  r.Update()
>>>  print r
>>>
>>> at this point, and give us the result?
>>>
>>>
>>>  3: im = r.GetOutput()
>>>> 4: im.SetVectorLength(62)
>>>> 5: w = itk.ImageFileWriter.VIUS3.New( im, FileName='test.nii.gz' )
>>>> 6: w.Update()
>>>>
>>>> I also tried with im.SetNumberOfPixelCompoents( 62 )
>>>>
>>>>  But test.nii.gz only contains 1 component (and, I think it is written
>>>> as if it were a 62-component file).
>>>>
>>>>
>>> can you show us the header of that file, or even better, the actual file?
>>>
>>>
>>>  How should I configure the FileReader to get the 62 components?
>>>>
>>>
>>> It should read the image with the right number of components...
>>>
>>> Regards,
>>>
>>> Gaëtan
>>>
>>>
>>>  How should I add new components?
>>>>
>>>> thanks. Best Regards,
>>>>
>>>> Oscar Esteban
>>>>
>>>>
>>>> ______________________________**________
>>>> Oscar Esteban
>>>> PhD Student / Researcher
>>>> Biomedical Image Technologies (Universidad Politécnica de Madrid)
>>>>
>>>> ETSI Telecomunicación (Lab. C203)
>>>> Av. Complutense s/n - E-28040 Madrid (Spain)
>>>> +34 915 495 700 ext.4234
>>>> +34 659 639 123
>>>>
>>>> ______________________________**_______
>>>> Powered by www.kitware.com
>>>>
>>>> Visit other Kitware open-source projects at
>>>> http://www.kitware.com/**opensource/opensource.html<http://www.kitware.com/opensource/opensource.html>
>>>>
>>>> Kitware offers ITK Training Courses, for more information visit:
>>>> http://www.kitware.com/**products/protraining.html<http://www.kitware.com/products/protraining.html>
>>>>
>>>> Please keep messages on-topic and check the ITK FAQ at:
>>>> http://www.itk.org/Wiki/ITK_**FAQ <http://www.itk.org/Wiki/ITK_FAQ>
>>>>
>>>> Follow this link to subscribe/unsubscribe:
>>>> http://www.itk.org/mailman/**listinfo/insight-users<http://www.itk.org/mailman/listinfo/insight-users>
>>>>
>>>
>>> --
>>> Gaëtan Lehmann
>>> Biologie du Développement et de la Reproduction
>>> INRA de Jouy-en-Josas (France)
>>> tel: +33 1 34 65 29 66    fax: 01 34 65 29 09
>>> http://mima2.jouy.inra.fr  http://www.itk.org
>>> http://www.bepo.fr
>>>
>>>
>>
>> _____________________________________
>> 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.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-users
>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20110627/4fe126ee/attachment.htm>


More information about the Insight-users mailing list