Slicer batch dicom processing

Batch dicom processing w/ Slicer

Base on script from SlicerRT. Use DICOM implementation of DICOM parsing in python.

Check attributes of a dicom object:

dir(object)

Find attributes that containt pattern:

[x for x in dir(object) if x.find('pattern')>-1]

Select a plugin and use examineForImport and load to load the segmentation as MRMLnode to Slicer:

import DICOMLib
import os
plugin=slicer.modules.dicomPlugins['DicomRtImportExportPlugin']()
f=os.getenv("HOME")+"/labkeyCache/Matej/studija/%40files/Konture/LJU001/RS/DICOM/RS.1.2.246.352.71.4.2138488846.2033.20090504131636_an"
filelist=[f]
filelists=[]
filelists.append(filelist)
loadables=plugin.examineForImport(filelists)
for loadable in loadables:
    plugin.load(loadable)

To do this, SlicerRT must be installed.

Now, let's look at segmentations stored:

segmentationNodes=slicer.util.getNodes('vtkMRMLSegmentationNode*')
segmentationNodes
OrderedDict([('8: RTSTRUCT: M.vrat', (vtkCommonCorePython.vtkMRMLSegmentationNode)0x7fee0c25cef0)])

To read a volume, do:

plugin1=slicer.modules.dicomPlugins['DICOMScalarVolumePlugin']()
dicomDir=os.getenv("HOME")+"/labkeyCache/Matej/studija/%40files/Konture/LJU001/ANAT/DICOM"
filelist=[dicomDir+os.sep+x for x in os.listdir(dicomDir)]

Convert transfer syntax of DICOM file to little endian:

dcmconv +te dicom.in dicom.out

links

social