The session builder is normally run by XNAT when the C-STORE session timeout expires, or when the upload applet indicates that session transfer is complete. The session builder can also be invoked on archived sessions via the REST API, by issuing a (blank entity) PUT to the session resource with the query parameter pullDataFromHeaders=true .
Customizing metadata translation
To add a new XNAT attribute:
- Add the attribute to the schema
- Write the attribute conversion class
- This is complicated. "Attribute translation" below provides some details and lots of examples.
- Often there's a class that already does what you want. Be sure to look through XnatAttrDef and the various attribute lists to see if what you need is already implemented.
- If you're doing simple text conversion, you won't even need a class, you can just provide the XNAT attribute name and the DICOM tag
- Add the attribute to the session/scan class (see "Attribute definition" below), as one more s.add(...) line
- Rebuild the dicom-xnat-mx jar, changing the version number if that makes sense for you
- Replace plugin-resources/repository/dcm/jars/dicom-xnat-mx-... with your modified version
- Update and restart the webapp
Mechanics of metadata translation
The heart of the DICOM-to-XNAT metadata translation code is the class DICOMSessionBuilder, defined in the project dicom-xnat-mx. Most of the action takes place in the method call(), which returns a modality-specific subclass of XnatImagesessiondataBean:
As a practical matter, most metadata translation customization can be done without modifying any of this base functionality. Changing the details of file storage (e.g., by replacing the current catalog file structure) will likely require changes to at least DICOMScanBuilder.
The translation operations that build individual XNAT attributes from DICOM metadata are specified in modality- (MR, PET, CT) and level- (session, scan, image) specific classes in the package org.nrg.dcm.xnat of dicom-xnat-mx.
- set of attributes starts with generic image attribute definitions in ImageScanAttributes
- most attributes are simple (coil, parameters/sequence, parameters/imageType, ...)
- some are complicated, and those translations are implemented in their own classes (VoxelResAttribute, OrientationAttribute, ...)