Commit 3b5cb43a7749920844b6ace4283f5a70a97e6667
1 parent
9ea636e5
Exists in
master
and in
68 other branches
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,10 +46,13 @@ class Controller(): | ||
46 | 46 | ||
47 | # Select medical images from directory and generate vtkImageData | 47 | # Select medical images from directory and generate vtkImageData |
48 | output = dicom.LoadImages(dir_) | 48 | output = dicom.LoadImages(dir_) |
49 | + proj = prj.Project() | ||
50 | + proj.name = "Untitled" | ||
49 | 51 | ||
50 | if output: | 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 | if (orientation == "CORONAL"): | 56 | if (orientation == "CORONAL"): |
54 | orientation = const.CORONAL | 57 | orientation = const.CORONAL |
55 | elif(orientation == "SAGITTAL"): | 58 | elif(orientation == "SAGITTAL"): |
@@ -70,17 +73,21 @@ class Controller(): | @@ -70,17 +73,21 @@ class Controller(): | ||
70 | #TODO: Verify if all Analyse is AXIAL orientation | 73 | #TODO: Verify if all Analyse is AXIAL orientation |
71 | orientation = const.AXIAL | 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 | if not imagedata: | 82 | if not imagedata: |
74 | print "Sorry, but there are no medical images supported on this dir." | 83 | print "Sorry, but there are no medical images supported on this dir." |
75 | else: | 84 | else: |
76 | # Create new project | 85 | # Create new project |
77 | - proj = prj.Project() | ||
78 | - proj.name = "Untitled" | ||
79 | proj.SetAcquisitionModality(acquisition_modality) | 86 | proj.SetAcquisitionModality(acquisition_modality) |
80 | proj.imagedata = imagedata | 87 | proj.imagedata = imagedata |
81 | proj.original_orientation = orientation | 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 | threshold_range = proj.imagedata.GetScalarRange() | 93 | threshold_range = proj.imagedata.GetScalarRange() |