XNAT Plugin Error

18 views
Skip to first unread message

Martijn Starmans

unread,
Jan 2, 2017, 5:16:02 AM1/2/17
to Fastr Users
Dear All,

I tried using the XNAT plugin (on the newest FASTR release) for my project, but came up with the following error:

Encountered error (FastrValueError): Cannot matching value /tmp/fastr_WORC_IbohSD/segmentation_m2/id_0/result/patient-003/fastr_xnat_71886_tmpS_1MFy/patient-003/scans/9-T2W/resources/MASK/files/ [str] to any of frozenset([<URLType: MetaImageFile class [Loaded]>, <URLType: NiftiImageFileCompressed class [Loaded]>, <URLType: AnalyzeImageFile class [Loaded]>, <URLType: NiftiImageFileUncompressed class [Loaded]>, <URLType: TifImageFile class [Loaded]>]) (/usr/local/lib/python2.7/dist-packages/fastr/datatypes.py:338)

Hence the XNAT plugin returns a string instead of the actual image which I'm expecting, thereby creating a type error. The error seems to be in the scan ID of the XNAT interface: the correct link seems to be .../scans/9/resources/MASK/files/(mask.nii.gz) instead of .../scans/9-T2W/resources/MASK/files/(mask.nii.gz). 9 is the scan series number, T2W the description. I assume that if this reference would be correct, the plugin would be able to find the mask.nii.gz file automatically as it is the only file in the resource?

The following string was used to create the source string, following the structure on the FASTR documentary:


I was therefore wondering if this is an error in the XNAT plugin and if so, if it could be fixed or if someone could suggest a workaround using the plugin? I could off course use something like PyXNAT/XNATPy to create the correct references, but this is more cumbersome. Or off course if the error is due to something external like my XNAT structure or my source string.

Thanks in advance.

Kind regards,

Martijn

Hakim Achterberg

unread,
Jan 2, 2017, 6:24:37 AM1/2/17
to Fastr Users
Hi Martijn,

You managed to find a new bug/missing feature in the XNAT IOPlugin. The problem is that the search does not (yet) support a file within the resource. This is fine when you want to download the entire resource directory (e.g. for DICOMs), but is a problem when you want a specific file, as the last portion (the actual filename) is missing.

I will create an issue and we will fix it in the next release. For the time being you can use the ioplugin to do the search, modify the urls and use that as your source data:

result = fastr.ioplugins['xnat'].expand_url('xnat://......')
result = {k: v + 'filename.ext' for k, v in result}

Cheers,
Hakim

Martijn Starmans

unread,
Jul 27, 2017, 4:13:15 AM7/27/17
to Fastr Users
I was wondering if this feature would be added in the next fastr update? I think it is quite a restriction to only be able to use DICOMs in the XNAT plugin. Furthermore, the provided solution only works if 'filename.ext' is the same for all source files. It would be nice if you could also use a search string/wildcards in the resources folders.

Op maandag 2 januari 2017 12:24:37 UTC+1 schreef Hakim Achterberg:
Reply all
Reply to author
Forward
0 new messages