this doesn't work: sc.attrs.mget(['type','quality','xnat:mrScanData/parameters/te'])

34 views
Skip to first unread message

Sason Torosean

unread,
May 16, 2013, 5:49:40 PM5/16/13
to xnat_di...@googlegroups.com
Hello All
I am trying to execute the following code hoping to get both type and te from scan level.

    for sc  in interface.select.project(ss[0]).subject(ss[1]).experiment(ss[2]).scans('*'):
         print sc.attrs.mget(['type','quality','xnat:mrScanData/parameters/te'])

but this is the result I get...

>>>
['ncanda-localizer-v1', 'unknown', 'ncanda-localizer-v1']
['ncanda-calibration-v1', 'unknown', 'ncanda-calibration-v1']
['ncanda-t1spgr-v1', 'usable', 'ncanda-t1spgr-v1']
['ncanda-t2fse-v1', 'usable', 'ncanda-t2fse-v1']
['ncanda-dti6b500pepolar-v1', 'usable', 'ncanda-dti6b500pepolar-v1']
['ncanda-dti60b1000-v1', 'usable', 'ncanda-dti60b1000-v1']
['ncanda-grefieldmap-v1', 'usable', 'ncanda-grefieldmap-v1']
['ncanda-rsfmri-v1', 'usable', 'ncanda-rsfmri-v1']
>>>

now if I change 'te' with 'tr' it works just fine.
>>>
['ncanda-localizer-v1', 'unknown', '830.952']
['ncanda-calibration-v1', 'unknown', '150.0']
['ncanda-t1spgr-v1', 'usable', '5.904']
['ncanda-t2fse-v1', 'usable', '2500.0']
['ncanda-dti6b500pepolar-v1', 'usable', '8000.0']
['ncanda-dti60b1000-v1', 'usable', '8000.0']
['ncanda-grefieldmap-v1', 'usable', '1000.0']
['ncanda-rsfmri-v1', 'usable', '2200.0']
>>>


 I am hoping not to resort to getting this info from xml file, just because te isn't giving me the correct result!.
 Any help would be much appreciated.
Thanks

Sason Torosean

unread,
May 17, 2013, 12:47:21 PM5/17/13
to xnat_di...@googlegroups.com
Ok so here is the "fix:"
If I remove 'type' from print sc.attrs.mget(['type','quality','xnat:mrScanData/parameters/te'])
and just put sc.attrs.mget(['quality','xnat:mrScanData/parameters/te'])
I get the right answer for 'te'

David Gutman

unread,
May 17, 2013, 3:39:45 PM5/17/13
to xnat_di...@googlegroups.com
Sason there's something screwy with this... I had a very similar issue......  not sure how to trace this down but there must be something about the "type" label that breaks things.... under certain circumstances...






Has any one ever observed weird behavior when using XML shortcuts and an mget in pyxnat?  I am running 0.9.3... 


Basically it's overwriting one of the fields with the "type"....  I haven't gone through every iteration... but I can pull the parameter if I do it using simple the get..

It seems like specifically the "type" parameter and not the frames is "breaking" things... and when I switched it from the first to the second requested attribute it still was broken...




In [17]: xnat.select.project('NBIA_TCGA_PROD').subject('TCGA-02-0003').experiment('CCI_XNAT_PROD_E00001').scan('2').attrs.mget(['xnat:mrScanData/parameters/te'])
Out[17]: ['4.2']

In [18]: xnat.select.project('NBIA_TCGA_PROD').subject('TCGA-02-0003').experiment('CCI_XNAT_PROD_E00001').scan('2').attrs.mget(['type','frames','xnat:mrScanData/parameters/tr','xnat:mrScanata/parameters/te'])
Out[18]: ['Anatomy', '14', '80.0', 'Anatomy']

In [19]: xnat.select.project('NBIA_TCGA_PROD').subject('TCGA-02-0003').experiment('CCI_XNAT_PROD_E00001').scan('2').attrs.mget(['frames','xnat:mrScanData/parameters/tr','xnat:mrScanData/parameters/te'])
Out[19]: ['14', '80.0', '4.2']


In [20]: xnat.select.project('NBIA_TCGA_PROD').subject('TCGA-02-0003').experiment('CCI_XNAT_PROD_E00001').scan('2').attrs.mget([type,'frames','xnat:mrScanData/parameters/tr','xnat:mrScanData/parameters/te'])



In [26]: xnat.select.project('NBIA_TCGA_PROD').subject('TCGA-02-0003').experiment('CCI_XNAT_PROD_E00001').scan('2').attrs.mget(['frames','type','xnat:mrScanData/parameters/tr','xnat:mrScanData/parameters/te'])
Out[26]: ['14', 'Anatomy', '80.0', 'Anatomy']





In [24]: pyxnat.__version__
Out[24]: '0.9.3'


--
You received this message because you are subscribed to the Google Groups "xnat_discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to xnat_discussi...@googlegroups.com.
To post to this group, send email to xnat_di...@googlegroups.com.
Visit this group at http://groups.google.com/group/xnat_discussion?hl=en-US.
For more options, visit https://groups.google.com/groups/opt_out.
 
 



--
David A Gutman, M.D. Ph.D.
Assistant Professor of Biomedical Informatics
Senior Research Scientist, Center for Comprehensive Informatics
Emory University School of Medicine

Sason Torosean

unread,
May 20, 2013, 12:31:03 PM5/20/13
to xnat_di...@googlegroups.com
Hi
It seems like I can't get
sc.attrs.get('xnat:mrScanData/parameters/fov')
 
sc.attrs.get('xnat:mrScanData/parameters/voxelRes')

to work either.....Are you able to get these parameters David ( or anyone else),  using just 'get'.
Thanks
S

Sason Torosean

unread,
May 20, 2013, 4:12:49 PM5/20/13
to xnat_di...@googlegroups.com
[SOLVED] Ok I got it for the case of getting FOV, I need to ask for
sc.attrs.get('xnat:mrScanData/parameters/fov/x') instead, to get a number.
S
Reply all
Reply to author
Forward
0 new messages