Browse Source

Changed notatation of tags in dicom dictionary

Andrej Studen 5 years ago
parent
commit
2e54b9d342
1 changed files with 40 additions and 34 deletions
  1. 40 34
      labkeySlicerPythonExtension/loadDicom.py

+ 40 - 34
labkeySlicerPythonExtension/loadDicom.py

@@ -38,39 +38,39 @@ class loadDicomLogic(slicer.ScriptedLoadableModule.ScriptedLoadableModuleLogic):
       slicer.ScriptedLoadableModule.ScriptedLoadableModuleLogic.__init__(self, parent)
 
       self.tag={
-              'studyDate': "0008,0020",
-              'studyTime': "0008,0030",
-              'seriesTime':"0008,0031",
-              'modality': "0008,0060",
-              'presentationIntentType':"0008,0068",
-              'manufacturer':"0008,0070",
-              'studyDescription': "0008,1030",
-              'seriesDescription': "0008,103e",
-              'patientName':"0010,0010",
-              'patientId':"0010,0020",
-              'patientBirthDate': "0010,0030",
-              'patientSex': "0010,0040",
-              'patientAge': "0010,1010",
-              'patientComments': "0010,4000",
-              'sequenceName':"0018,0024",
-              'kVP':"0018,0060",
-              'percentPhaseFieldOfView':"0018,0094",
-              'xRayTubeCurrent':"0018,1151",
-              'exposure':"0018,1152",
-              'imagerPixelSpacing':"0018,1164",
-              'bodyPartThickness':"0018,11a0",
-              'compressionForce':"0018,11a2",
-              'viewPosition':"0018,5101",
-              'fieldOfViewHorizontalFlip':"0018,7034",
-              'studyInstanceUid':"0020,000d",
-              'seriesInstanceUid':"0020,000e",
-              'studyId': "0020,0010",
-              'seriesNumber':"0020,0011",
-              'instanceNumber':"0020,0013",
-              'frameOfReferenceInstanceUid':"0020,0052",
-              'imageLaterality':"0020,0060",
-              'imagesInAcquisition':"0020,1002",
-              'photometricInterpretation':"0028,0004"
+              'studyDate': {'tag':"0008,0020",'VR':'DA'},
+              'studyTime': {'tag':"0008,0030",'VR':'TM'},
+              'seriesTime': {'tag':"0008,0031",'VR':'TM'},
+              'modality': {'tag':"0008,0060",'VR':'CS'},
+              'presentationIntentType': {'tag':"0008,0068",'VR':'CS'},
+              'manufacturer': {'tag':"0008,0070",'VR':'LO'},
+              'studyDescription': {'tag':"0008,1030",'VR':'LO'},
+              'seriesDescription': {'tag':"0008,103e",'VR':'LO'},
+              'patientName': {'tag':"0010,0010",'VR':'PN'},
+              'patientId': {'tag':"0010,0020",'VR':'LO'},
+              'patientBirthDate': {'tag':"0010,0030",'VR':'DA'},
+              'patientSex': {'tag':"0010,0040",'VR':'CS'},
+              'patientAge': {'tag':"0010,1010",'VR':'AS'},
+              'patientComments': {'tag':"0010,4000",'VR':'LT'},
+              'sequenceName': {'tag':"0018,0024",'VR':'SH'},
+              'kVP': {'tag':"0018,0060",'VR':'DS'},
+              'percentPhaseFieldOfView': {'tag':"0018,0094",'VR':'DS'},
+              'xRayTubeCurrent': {'tag':"0018,1151",'VR':'IS'},
+              'exposure': {'tag':"0018,1152",'VR':'IS'},
+              'imagerPixelSpacing': {'tag':"0018,1164",'VR':'DS'},
+              'bodyPartThickness': {'tag':"0018,11a0",'VR':'DS'},
+              'compressionForce': {'tag':"0018,11a2",'VR':'DS'},
+              'viewPosition': {'tag':"0018,5101",'VR':'CS'},
+              'fieldOfViewHorizontalFlip': {'tag':"0018,7034",'VR':'CS'},
+              'studyInstanceUid': {'tag':"0020,000d",'VR':'UI'},
+              'seriesInstanceUid': {'tag':"0020,000e",'VR':'UI'},
+              'studyId': {'tag':"0020,0010",'VR':'SH'},
+              'seriesNumber': {'tag':"0020,0011",'VR':'IS'},
+              'instanceNumber': {'tag':"0020,0013",'VR':'IS'},
+              'frameOfReferenceInstanceUid': {'tag':"0020,0052",'VR':'UI'},
+              'imageLaterality': {'tag':"0020,0062",'VR':'CS'},
+              'imagesInAcquisition': {'tag':"0020,1002",'VR':'IS'},
+              'photometricInterpretation': {'tag':"0028,0004",'VR':'CS'}
       }
       self.tagPyDicom={
               'studyDate': 0x00080020,
@@ -106,6 +106,12 @@ class loadDicomLogic(slicer.ScriptedLoadableModule.ScriptedLoadableModuleLogic):
       #}
       #dicom.datadict.add_dict_entries(new_dict_items)
 
+
+    def getHex(self,key):
+        #convert string to hex key;
+        fv=key.split(",")
+        return int(fv[0],16)*0x10000+int(fv[1],16)
+
     def load(self,sNet,dir,doRemove=True):
         print("Loading dir {}").format(dir)
         dicomFiles=sNet.listRelativeDir(dir)
@@ -169,7 +175,7 @@ class loadDicomLogic(slicer.ScriptedLoadableModule.ScriptedLoadableModuleLogic):
             #    fileValue=plan[self.tag[key]].value
             #except KeyError:
             #        fileValue=None
-            fileValue=dicomValue(loadable.files[0],self.tag[key])
+            fileValue=dicomValue(loadable.files[0],self.tag[key]['tag'])
 
 
             if filter[key]=="SeriesLabel":