Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

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:

  1. Add the attribute to the schema
    1. It's possible to use addparams instead; there's a lot of this in HCP MR scans. This is such a common thing to do that there's a type (XnatAttrDef.AddParam) and a utility method (wrap()) to make it easy.
  2. Write the attribute conversion class
    1. This is complicated. "Attribute translation" below provides some details and lots of examples.
    2. 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.
    3. 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
  3. Add the attribute to the session/scan class (see "Attribute definition" below), as one more s.add(...) line
  4. Rebuild the dicom-xnat-mx jar, changing the version number if that makes sense for you
  5. Replace plugin-resources/repository/dcm/jars/dicom-xnat-mx-... with your modified version
  6. 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.

Attribute definition

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.

...

Attribute translation

Classes that define the translation from DICOM metadata to one XNAT attribute must implement the interface XnatAttrDef or its superclass ExtAttrDef<DicomAttributeIndex>.

...