Upload of non-DICOM data to XNAT with XNAT Desktop

 <folder ID="root_fold" pattern=".*" treeRoot="1">

Here, we describe the root folder where the rule should be applied. We assignes it an ID, and define pattern which the folder name should match to qualify. We also want objects with ID equal to "subj_dir" to be detected as immediate children of the root.

 <folder ID="subj_dir" pattern="CONV.*" treeRoot="1">
  <tag name="Subject" pattern=".*" recursive="fixed"/>
  <tag name="Project" value="default" recursive="fixed"/>
  <tag name="Modality" value="CT" recursive="fixed"/>

We set "treeRoot=1" again in folder definition for the rule to be applicable at individual (CONVN) directory level as well as upper (OIS) level. But now the regex pattern is more specific: anything that starts with CONV will be qualified as a directory that the naming rule will treat as "subj_dir". Now we list tags that will be assigned to the contents of this dir. We want the Subject tag to match the directory name exactly (and thus pattern is just generic .*), and all children should have the same tag value (recursive="fixed"). Similarly, we tag everything with Project=default and Modality=CT. We also let the rule know that subj_dir can contain two object types: auxiliary_file and tiff_file. These two objects will be defined later.

So in summary, that's what happens when this snippet is applied at the directory level:

  • Subject="<directory name>", Project="default" and Modality="CT" tags are assigned to everything inside this directory.

 <file ID="auxiliary_file" pattern=".*\.mat">
  <tag name="Experiment" pattern="(?i)([0-9]+-CONV[0-9]+)-.*" recursive="none"/>
  <tag name="ExperimentResource" value="AUXILIARY" recursive="none"/>

And here they are, we define a file of type (ID) = auxiliary_file. But from the pattern we see that it's just another name for .mat files. So, we want  the .mat files be an experiment resource, so for that both Experiment and ExperimentResource tags (together with Project and Subject that were defined at higher subj_dir level and propagated down). We assign ExperimentResource a fixed name, and Experiment is derived from the first two pieces of the filename separated by "-", i.e. Experiment("150118-CONV1-breathing_rate.mat")="150118-CONV1"

In summary, all .mat files in the directory described in the rule xml under the ID="subj_dir", are assigned:

  • ExperimentResource=AUXILIARY
  • Experiment(NNNN-CONVN-*.mat)=NNNN-CONVN

 <file ID="tiff_file" pattern="(?i).*\.tiff">
      <tag name="Experiment" pattern="(?i)([0-9]+-CONV[0-9]+)-.*" recursive="none"/>
    <tag name="Scan"  pattern="(?i).*-[a-z]+([0-9]+).tiff" recursive="none"/>
     <tag name="ScanResource" value="TIFF"/>
     <!-- Scan_Type is bound to xnat:imageScanData/type (see xnat_thesaurus.xml) -->
     <tag name="Scan_Type" pattern="(?i).*-([a-z]+)[0-9]+.TIFF"/>

Now we want the TIFF files to contribute to experiment scan resources. Each TIFF file is numbered, and this number will be also the name of the scan, so Scan and ScanResource tags are generated. We also set Experiment tag again, because it was not defined at a higher directory level.

In summary, all .TIFF files are assigned:

  • Experiment("150118-CONV1-fc1.TIFF")="150118-CONV1"
  • Scan("150118-CONV1-fc1.TIFF")="1"
  • ScanResource("150118-CONV1-fc1.TIFF")="TIFF"
  • Scan_Type("150118-CONV1-fc1.TIFF")="fc"

Tagging and uploading the data

Now, we add naming_rule.xml document to XND's rule collection via View->Preferences->Ontology and rules->Add rule from file. We run the "apply custom rule"->"naming_ois" context menu command on the OIS directory, and switch to Tag View tab:

When we ensure that the structure and tags are as expected, and run the "upload" context menu command on the "Subject:CONV1" level. The REST calls are tracked in the XND Console:

Then, we check the XNAT experiment online:

Further steps

To upload additional metadata to the newly created session, the recommended method is to prepare spreadsheets that list information at each level for each experiment, and use the Spreadsheet Uploader.