Parcourir la source

Setting loadDicom to quiet mode

Andrej Studen il y a 5 ans
Parent
commit
7a0a280f71
1 fichiers modifiés avec 7 ajouts et 3 suppressions
  1. 7 3
      labkeySlicerPythonExtension/loadDicom.py

+ 7 - 3
labkeySlicerPythonExtension/loadDicom.py

@@ -312,15 +312,18 @@ def isDicom(file):
 
 
 def dicomValue(file,tag,seqTag=None):
+    debug=False
     dcmdump=os.path.join(os.environ['SLICER_HOME'],"bin","dcmdump")
     try:
         out=subprocess.check_output([dcmdump,'+p','+P',tag,file],shell=True)
-        print("Tag {} Line '{}'").format(tag,out)
+        if debug:
+            print("Tag {} Line '{}'").format(tag,out)
         if len(out)==0:
             return out
         tag1="^\({}\)".format(tag)
         if not seqTag==None:
-            print("Tag:{} seqTag:{}").format(tag,seqTag)
+            if debug:
+                print("Tag:{} seqTag:{}").format(tag,seqTag)
             tag1="^\({}\).\({}\)".format(seqTag,tag)
         lst=out.split('\n')
         rpl=[re.sub(r'^.*\[(.*)\].*$',r'\1',f) for f in lst]
@@ -329,7 +332,8 @@ def dicomValue(file,tag,seqTag=None):
         out=out[0]
         #out=re.sub(r'^.*\[(.*)\].*\n$',r'\1',out)
         #separate out series
-        print("Tag {} Parsed value {}").format(tag,out)
+        if debug:
+            print("Tag {} Parsed value {}").format(tag,out)
         if out.find('\\')>-1:
             out=out.split('\\')