Commit 3b5cb43a7749920844b6ace4283f5a70a97e6667

Authored by Paulo Henrique Junqueira Amorim
1 parent 9ea636e5

ADD:Window & Level default from DICOM

Showing 1 changed file with 13 additions and 6 deletions   Show diff stats
invesalius/control.py
... ... @@ -46,10 +46,13 @@ class Controller():
46 46  
47 47 # Select medical images from directory and generate vtkImageData
48 48 output = dicom.LoadImages(dir_)
  49 + proj = prj.Project()
  50 + proj.name = "Untitled"
49 51  
50 52 if output:
51   - imagedata, acquisition_modality, tilt_value, orientation = output
52   - print orientation
  53 + imagedata, acquisition_modality, tilt_value, orientation,\
  54 + window, level = output
  55 +
53 56 if (orientation == "CORONAL"):
54 57 orientation = const.CORONAL
55 58 elif(orientation == "SAGITTAL"):
... ... @@ -70,17 +73,21 @@ class Controller():
70 73 #TODO: Verify if all Analyse is AXIAL orientation
71 74 orientation = const.AXIAL
72 75  
  76 + proj.SetAcquisitionModality(acquisition_modality)
  77 + proj.imagedata = imagedata
  78 + proj.original_orientation = orientation
  79 + proj.window = const.WINDOW_LEVEL['Bone'][0]
  80 + proj.level = const.WINDOW_LEVEL['Bone'][1]
  81 +
73 82 if not imagedata:
74 83 print "Sorry, but there are no medical images supported on this dir."
75 84 else:
76 85 # Create new project
77   - proj = prj.Project()
78   - proj.name = "Untitled"
79 86 proj.SetAcquisitionModality(acquisition_modality)
80 87 proj.imagedata = imagedata
81 88 proj.original_orientation = orientation
82   - proj.window = const.WINDOW_LEVEL['Bone'][0]
83   - proj.level = const.WINDOW_LEVEL['Bone'][1]
  89 + proj.window = float(window)
  90 + proj.level = float(level)
84 91  
85 92  
86 93 threshold_range = proj.imagedata.GetScalarRange()
... ...