Embedding specimen metadata into the 3D volume

Dear all,

As part of a project we will be converting large number of 3D high-resolution scans of biological specimens into volumetric format. Currently most of them are in DICOM or some sort of a image sequence, and we want to use something like NRRD to facilitate easier data exchange and increase usability of these data with 3D Slicer.

However, we also need to make sure we can trace the provenance of the dataset (museum specimen/accession number is the absolute minimum, and possibly few other tags, for example species designation or sex). I am hoping to have a better and more robust method than simply naming the volume with this number and keeping the metadata external. One idea was to use NRRD with a detached text header and keep some of this information as comments. But I am not sure what would happen to them if the user accidentally checkmarks the save option. Would this be retained? Are there other formats more suitable for our use case?

I appreciate any feedback.

content: Skull CT
# Specimen No: 627546 
# Institution: USNM
# Genus: Homo
# Species: sapiens
# Specimen DOI/URL: where data is stored
dimension: 3
type: short
space: RAS
space directions: (0.5, 0, 0) (0, 0.5, 0) (0, 0, 1)
sizes: 512 512 256
data file: ./USNM627546_Skull_CT.raw.gz
encoding: gzip

Currently, you can only save custom metadata for a segment and not for the entire segmentation:

segmentationNode.GetSegmentation().GetNthSegment(0).SetTag("SomeCustomAttribute","This is a value")

It would be useful and should be quite easy to add custom tags/attributes in the segmentation object itself. @cpinter what do you think? Was there any particular reason why we did not implement this?

Thank Andras,
So would this this work only with Segment editor? Just to be clear, I am looking into something that I can embed in the volume file, and that these tags are read into Slicer when they are loaded into scene.

You can embed custom metadata in nrrd files, but you would need to write custom importer and exporter for that. We could implement reading/writing of all or some custom metadata fields into volume nodes, but in general metadata is not saved into volume files. Instead, these two approaches are often used: