Skip to content

Instantly share code, notes, and snippets.

@rherrick
Created October 20, 2014 15:51
Show Gist options
  • Save rherrick/a75ad4f91897d0379c07 to your computer and use it in GitHub Desktop.
Save rherrick/a75ad4f91897d0379c07 to your computer and use it in GitHub Desktop.
import org.dcm4che2.data.Tag
logger.info("Now running the splitPetMrSession script for project ${projectId}, I was passed ${defaultValue}")
def sopClassUID = dicom.getString(Tag.SOPClassUID)
def modality = dicom.getString(Tag.Modality)
def seriesDescription = dicom.getString(Tag.SeriesDescription)
def isPet = "PT".equals(modality) || ("1.3.12.2.1107.5.9.1".equals(sopClassUID) && "PET Start".equals(seriesDescription))
logger.info("Found sopClassUID: ${sopClassUID}")
logger.info("Found modality: ${modality}")
logger.info("Found seriesDescription: ${seriesDescription}")
logger.info("Found isPet: ${isPet}")
def returnValue = isPet ? defaultValue.reverse().replaceFirst("RM", "TEP").reverse() : defaultValue
logger.info("Result: ${returnValue}")
"${returnValue}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment