Thanks again for your helpful links. I've had a chance to have a bit more of a play with this, but while I feel like I can see the outline of a solution, there's still aspects that are confusing me.
- In the JSON command file, for each scan you want added define:
- An output specifying the scan XML file
- An output specifying the directory of DICOM images for the scan
- Matched output handlers for the above, with the scan XML having type Scan as a child of the session, and the images having type Resource as a child of the scan output handler
- The container is then responsible for generating the scan XML files and DICOM images in the correct locations on the container mounts so they are picked up by the outputs/output handlers
- Some XNAT automagic occurs to create new XNAT objects within the session
And previously this required a bespoke version of the container service but now this is implemented in the main version (although the container docs still say the output handlers can only have type Resource I tried running with an output handler set to Scan it while it didn't complete, it did at least launch so using type Scan seems to parse ok).
Is that right so far?
If so, the bit that is confusing me is how to complete the scan XML file, and specifically what the container needs to complete and what the automagic in the last step will do. Looking in the filesystem of our test XNAT instance I pulled off the XML file for a series that had been uploaded from the desktop client (scan_1201_catalog.xml).
The general structure, and some of the field details are easy enough to generate from a script in the container. However there are certain fields that AFAICT can only be completed *after* the XNAT objects have been built, so I don't understand how the container can generate them.
Specifically on line 2, the DCMCatalog UID looks like an ID automatically generate by the import
Then the entry for each image slice contains (among other fields that are easy to complete):
ID (sample value from attached XML "1.3.46.670589.11.22117.5.0.1560.2009120213165950016-1201-6-195xh2d.dcm"
UID
( "1.3.46.670589.11.22117.5.0.6228.2009120213340110721"
URI
( "1.3.46.670589.11.22117.5.0.1560.2009120213165950016-1201-6-195xh2d.dcm"
createdEventId
( "29" the same for all entries)
digest
( "81a93cb5c0d9f39d930d96ab5c7eb0fd" )
In each case ID and URI appear to be the same and are the filename of the image slice on the filesystem. If the DICOM files will keep their name as they are created by the container when they are imported to the session (as session resources do) this is fine. But if not how does the container know what the file names should be? Will the container output-handler automatically handle this?
UID I'm guessing is a unique identifier for the slice in the XNAT database - what should the container include here? Nothing? Include the UID field but set the value empty?
digest: I can't find documentation on what this is. The values look like hexidecimals, so I'm guessing a bytestring of some sort?
createEventID from looking at multiple scan XML files, this appears to be shared across multiple series that are included in the same upload.
I'm trying to work through this with a bit of trial and error but if you could help explain things a bit more concretely, or point to documentation that does, that would be really helpful. In general, if you can point me to a resource that explains the details of exactly what happens under the hood when Scan objects are created that would be really helpful. I suspect my mental model of what is going on might not be correct.
Finally, all of the above assumes that the command JSON files require explicit, separate output handlers for each series added to the session. While this isn't an insurmountable problem it would be limiting in terms of the general solution we are trying to put together. Do you know if there is another way to achieve this, so a single output handler can process multiple series saved to a mount point in the container (eg in the same way the import tool allows)?
Many thanks again for your help
Michael