]> AND Private Git Repository - myo-class.git/blobdiff - totraindir.py
Logo AND Algorithmique Numérique Distribuée

Private GIT Repository
applied mask horizontally
[myo-class.git] / totraindir.py
index 8d90c144aade6b664502cac42ace7c611de5a8da..1fbaf08481a790594b088fe442c69e71ae9651c8 100644 (file)
@@ -4,8 +4,8 @@ import pydicom
 from os.path import join
 
 # locals
 from os.path import join
 
 # locals
-from topng import topng
-from regularjson import search, RT_PATH, JSON_GTS, INFA_STR
+from topng import topng, mask
+from regularjson import search, RT_PATH, JSON_GTS, INFA_STR, EPI_STR
 
 # constants
 GLOB_DIR = '../../Data/Images_anonymous/'
 
 # constants
 GLOB_DIR = '../../Data/Images_anonymous/'
@@ -68,15 +68,10 @@ if __name__ == '__main__':
                                ref = join(r, l2[i]) # logically, should be the json ref of i dicom image
 
                                infarctus = search(ref, INFA_STR)
                                ref = join(r, l2[i]) # logically, should be the json ref of i dicom image
 
                                infarctus = search(ref, INFA_STR)
-                               if infarctus:
-                                       # print("infarctus:", infarctus) # Testing..
-                                       # topng(join(caspath, dic), '%/%-%' % (join(OUT_DIR, 'infarctus'), cas, dic)
-                                       # print(join(caspath, dic), '{}/{}-{}'.format(join(OUT_DIR, 'infarctus'), cas, dic)) # Testing..
-                                       w, h = topng(join(caspath, dic), '{}/{}-{}'.format(join(OUT_DIR, 'infarctus'), cas, dic))
-                               else:
-                                       # print("no infarctus:", infarctus) # Testing..
-                                       # print(join(caspath, dic), '{}/{}-{}'.format(join(OUT_DIR, 'noinfarctus'), cas, dic)) # Testing..
-                                       w, h = topng(join(caspath, dic), '{}/{}-{}'.format(join(OUT_DIR, 'noinfarctus'), cas, dic))
+                               # epimask = mask(ref, EPI_STR)
+                               # print("infarctus:", infarctus) # Testing..
+                               # topng(join(caspath, dic), '%/%-%' % (join(OUT_DIR, 'infarctus'), cas, dic)
+                               w, h = topng(join(caspath, dic), '{}/{}-{}'.format(join(OUT_DIR, 'infarctus' if infarctus else 'noinfarctus'), cas, dic))
 
                                # search maximums
                                if wmax < w: wmax = w 
 
                                # search maximums
                                if wmax < w: wmax = w