Simon,
I wish I had a simple answer for you. Unfortunately, the DICOM to XNAT metadata translation is all specified in Java code, in its own library (https://bitbucket.org/nrg/dicom-xnat, in dicom-xnat-mx). It’s generally straightforward to add a new field, except that then you have to rebuild the dicom-xnat-mx jar, substitute it into plugin-resources/repository/dcm/jars, and run update.sh. I’ve done this for the Human Connectome Project, where I’ve changed the jar name to indicate the customization version. You can see the sorts of changes I’ve made at https://bitbucket.org/hcp/dicom-xnat-intradb . The webapp changes are not as easy to show off, because the HCP build process is deeply idiosyncratic, but that’s really just change the jar, and change plugin-resources/originals/project.xml if you’re changing the jar name to indicate a customization version (which I recommend).
That’s all just for changing the fields in a data type where we’re already doing a translation. Extracting DICOM metadata into a distinct type is another kettle of fish. I can’t think of an example of doing this since we moved the DICOM and session building into XNAT (for version 1.5). I’m vaguely thinking that GradualDicomImporter might be the right place to do all this, but I don’t have concrete ideas. Tim or Rick might have something smart to say.
- Kevin
--
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.
For more options, visit https://groups.google.com/groups/opt_out.
XNATRestClient -host http://central.xnat.org -u USERNAME -p PASSWORD -m PUT -remote "/data/archive/projects/YOURTEST/subjects/1000?xnat:subjectData/demographics@xsi:type=xnat.demographicData/gender=male |
XNATRestClient ... -m GET -remote "/data/archive/projects/YOURTEST/subjects/1000?xnat:subjectData/demographics@xsi:type=xnat.demographicData/gender&format=xml" |
XNATRestClient ... -m GET -remote /data/archive/projects/YOURTEST/subjects/1000?format=xml |
org.nrg.xnat.turbine.modules.actions.EditSubjectAction - Error Storing xnat:subjectData
org.postgresql.util.PSQLException: ERROR: function ie_xnat_demographicdata(integer, integer, boolean, boolean, boolean) does not exist
Tim
This works…
-m PUT -remote /data/archive/projects/T041913/subjects/case001?xnat:subjectData/demographics[@xsi:type=xnat:demographicData]/gender=male
Working with XML Path in the URL can be especially tricky. I’ve found curl to be a little easier there. With curl, you can use the -d parameter to pass properties as part of an url encoded form in the body (like a browser would). It makes it easier to deal with escaping the []@:= characters. But, that said, the above command works on my localhost.
Tim
--
Simon,
Sorry. Evidently, I can only think through one problem at a time.
#2 isn’t supported. It sounds great. But, we don’t currently support that.
#4 should work. But… There is a bug in the current release of XNAT that prevents it from working. The problem is related to the [@xsi:type=xnat:demographicData]. This isn’t being properly encoded, and is getting all messed up. The work around would be that you should encode the = manually. But, there is a bug, which prevents that from being properly decoded on the server side. I’ve fixed that bug on the tip:
https://bitbucket.org/nrg/xnat_builder_1_6dev/commits/b3c31e0d9e0b8626e4c4960aa0313140f8f2826e
But, I’m not sure if you can pull from the tip or not. If you can (or if you introduce the same change to your repository), then this command should work.
-remote "/data/projects/T041913/subjects?columns=ID,xnat:subjectData/demographics[@xsi:type%3Dxnat:demographicData]/gender&format=csv" -m GET
I’ll be reviewing other similar code and fixing the same bug elsewhere next week. If you can’t update your repository for some reason, you could get around the = encoding issue by using the XML Path shortcut for that field:
-remote "/data/projects/T041913/subjects?columns=ID,gender&format=csv" -m GET
More about XML path shortcuts here:
https://wiki.xnat.org/display/XNAT/XNAT+REST+XML+Path+Shortcuts
Also, using #4 will work even better if you use the filtering feature too.
-remote "/data/projects/T041913/subjects?columns=ID,gender&format=csv&ID=XNAT_S00015" -m GET