[Insight-users] wrap_itk, python, and dicom

Mario Ceresa mrceresa at gmail.com
Tue Apr 27 10:11:29 EDT 2010


Hello David!
I use 3.16 as well. I think the difference might be the version of
wrapitk. The one that comes with itk is outdated. The newest one can
be found at:

http://code.google.com/p/wrapitk/

Please let me know if that solves your problem,

Mario

On 26 April 2010 17:33, David Fuentes <fuentesdt at gmail.com> wrote:
>
> Cool. thank you very much Mario!
>
> What version of ITK are you using ?
>
>
> my GetKeys() is just returning a string
>
>
> print metad.GetKeys()
> '_30a1941b00000000_p_std__vectorTstd__basic_stringTchar_std__char_traitsTchar_t_std__allocatorTchar_t_t_std__allocatorTstd__basic_stringTchar_std__char_traitsTchar_t_std__allocatorTchar_t_t_t_t'
>
>
>
> I am using ITK 3.16.
>
>
>
> thanks again,
> df
>
>
>
>
>
>
>
> On Mon, 26 Apr 2010, Mario Ceresa wrote:
>
>> Hello David,
>>
>> Which kind of information do you need to extract from the dicom header?
>>
>> Basic info such as the dimensions or spacing are already available in
>> the getter methods of the image object (ex. image.GetSpacing() ).
>>
>> To access the full dictionary my first thought was something like:
>>
>> ------------------------------------------------
>> import itk
>>
>> reader = itk.ImageFileReader.ISS3.New(FileName='test_image.dcm')
>> reader.Update()
>>
>> metad = reader.GetMetaDataDictionary()
>>
>> print "List of all the key in the dictionary:"
>> print [str(key) for key in metad.GetKeys()]
>>
>> print "Print the dictionary"
>> metad.Print(itk.cout)
>> ------------------------------------------------
>>
>> I can see the list of all the keys, but instead of printing their
>> value, the last method only shows:
>>
>> [UNKNOWN_PRINT_CHARACTERISTICS]
>>
>> Then I realized that gdcm comes with python binding itself. It might
>> be easier to read the dicom tag using directly those bindings.
>>
>> Hope this helps,
>>
>> Mario
>>
>>
>> On 22 April 2010 18:15, David Fuentes <fuentesdt at gmail.com> wrote:
>>>
>>> Hello,
>>>
>>> Is there an example python script showing how to extract header
>>> information
>>> from a dicom file using the wrapper functions ?
>>>
>>>
>>> thank you,
>>> David
>>> _____________________________________
>>> 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
>>>
>>
>


More information about the Insight-users mailing list