Skip to content

Instantly share code, notes, and snippets.

@pwighton
Last active November 25, 2017 20:09
Show Gist options
  • Save pwighton/581f4515658aafb5872d2ce97b9ade9d to your computer and use it in GitHub Desktop.
Save pwighton/581f4515658aafb5872d2ce97b9ade9d to your computer and use it in GitHub Desktop.
  1. Description of the platform/product:
  • name and version of the software: FreeSurfer 6.0
  • free?: yes
  • commercial?: no
  • open source?: yes
  • what DICOM library do you use?: DCMQI to write DICOM-SEG
  • Description of the relevant features of the platform: Freesurfer's subcortical segmentation results can be converted to DICOM-SEG using fs-aseg.json that has been kindly provided by Emily Lindemer.
  • are both single and multiple segments supported?: Yes, however Freesurfer's subcortical segmentation process assumes a mutually exclusive label set.
  • do you support both BINARY and FRACTIONAL segmentation types? BINARY only.
  • do you support compressed objects? I beleive itkimage2segimage can read compressed itk objects but does not write compressed DICOM objects(?)
  • do you render the segment using the color specified in the DICOM object? N/A (write-only), however Freesurfer's recoomended color scheme is preserved.
  • how do you communicate segment semantics to the user? The fs-aseg.json maps freesurfer's subcortical labels to SNOMED codes.
  • how do you support the user in defining the semantics of the object at the time segmentation is created? Freesurfer's subcortical label set is predefined, so this is pre-computed.
  1. Read task: Not supported

  2. Write task:

The file dcmqi-fs-aseg.example.tar.gz contains the following:

  • ./dicom-anon: Direcotry containting input dicoms for a FreeSurfer-compatible T1 weighted MPRAGE sequence.
  • aseg-t1space.nii.gz: FreeSurfer 6.0 subcortical segmentations (this is aseg.mgz output from FreeSurfer transformed back to the original input DICOM coordinate system and converted to nifti)
  • fs-aseg.json: Mappings from FreeSurfer aseg labels to SNOMED codes provided by Emily Lindemer.

Running the example:

tar -zxvf ./dcmqi-fs-aseg.example.tar.gz
cd ./dcmqi-fs-aseg-example
docker pull qiicr/dcmqi
docker run \
  -v $PWD:/tmp/dcmqi/ \
  qiicr/dcmqi \
  itkimage2segimage \
    --inputDICOMDirectory /tmp/dcmqi/dicom-anon \
    --inputMetadata /tmp/dcmqi/fs-aseg.json \
    --inputImageList /tmp/dcmqi/aseg.nii.gz \
    --outputDICOM /tmp/dcmqi/aseg.dcm

Verifying the output:

dciodvfy ./aseg.dcm &> dciodvfy-output.txt

Currently dciodvfy genertes the following errors:

  • Thousands of erros that look like:
Error - Illegal root for UID - "5.555.5.2017.3.22.??.?.??????" in (0x0008,0x1155) Referenced SOP Instance UID
  • Other errors:
Error - Value invalid for this VR - (0x0008,0x0050) SH Accession Number  SH [0] = <Accession Number 1> - Length invalid for this VR = 18, expected <= 16
Warning - Value dubious for this VR - (0x0008,0x0090) PN Referring Physician's Name  PN [0] = <Referring Physician's Name 1> - Retired Person Name form
Warning - Value dubious for this VR - (0x0010,0x0010) PN Patient's Name  PN [0] = <Patient's Name 1> - Retired Person Name form
Warning - Value dubious for this VR - (0x0070,0x0084) PN Content Creator's Name  PN [0] = <Reader1> - Retired Person Name form
Error - Dicom dataset contains invalid data values for Value Representations
Segmentation
Error - Unrecognized enumerated value <CLEANED> for value 1 of attribute <Patient's Sex>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment