Commit 9c7b39bdba51c6d01c8ffdccc92470941c2b5d0f
1 parent
25b57760
Exists in
master
and in
6 other branches
ADD: Volume Orientation detected original orientation, and add Project() original orientation
Showing
5 changed files
with
29 additions
and
7 deletions
Show diff stats
invesalius/constants.py
... | ... | @@ -37,6 +37,11 @@ CORONAL_VOLUME_CAM_POSITION = {"FRONT":(0,0,-1), "BACK":(0,0,1), "RIGHT":(-1,0,0 |
37 | 37 | "LEFT":(1,0,0), "TOP":(0,-1,0), "BOTTOM":(0,1,0),\ |
38 | 38 | "ISOMETRIC":(-0.5,-0.5,-1)} |
39 | 39 | |
40 | +VOLUME_POSITION = {AXIAL: [AXIAL_VOLUME_CAM_VIEW_UP, AXIAL_VOLUME_CAM_POSITION], | |
41 | + SAGITAL: [SAGITAL_VOLUME_CAM_VIEW_UP, SAGITAL_VOLUME_CAM_POSITION], | |
42 | + CORONAL: [CORONAL_VOLUME_CAM_VIEW_UP, CORONAL_VOLUME_CAM_POSITION]} | |
43 | + | |
44 | + | |
40 | 45 | # Mask threshold options |
41 | 46 | proj = Project() |
42 | 47 | THRESHOLD_RANGE = proj.threshold_modes["Bone"] | ... | ... |
invesalius/control.py
... | ... | @@ -44,7 +44,15 @@ class Controller(): |
44 | 44 | output = dicom.LoadImages(dir_) |
45 | 45 | |
46 | 46 | if output: |
47 | - imagedata, acquisition_modality, tilt_value = output | |
47 | + imagedata, acquisition_modality, tilt_value, orientation = output | |
48 | + print orientation | |
49 | + if (orientation == "CORONAL"): | |
50 | + orientation = const.CORONAL | |
51 | + elif(orientation == "SAGITTAL"): | |
52 | + orientation = const.SAGITAL | |
53 | + else: | |
54 | + orientation = const.AXIAL | |
55 | + | |
48 | 56 | if (tilt_value): |
49 | 57 | #TODO: Show dialog so user can set not other value |
50 | 58 | tilt_value *= -1 |
... | ... | @@ -54,7 +62,10 @@ class Controller(): |
54 | 62 | "No DICOM files were found. Trying to read with ITK..." |
55 | 63 | imagedata = analyze.ReadDirectory(dir_) |
56 | 64 | acquisition_modality = "MRI" |
57 | - | |
65 | + | |
66 | + #TODO: Verify if all Analyse is AXIAL orientation | |
67 | + orientation = const.AXIAL | |
68 | + | |
58 | 69 | if not imagedata: |
59 | 70 | print "Sorry, but there are no medical images supported on this dir." |
60 | 71 | else: |
... | ... | @@ -63,7 +74,8 @@ class Controller(): |
63 | 74 | proj.name = "Untitled" |
64 | 75 | proj.SetAcquisitionModality(acquisition_modality) |
65 | 76 | proj.imagedata = imagedata |
66 | - | |
77 | + proj.original_orientation = orientation | |
78 | + | |
67 | 79 | threshold_range = proj.imagedata.GetScalarRange() |
68 | 80 | const.THRESHOLD_OUTVALUE = threshold_range[0] |
69 | 81 | const.THRESHOLD_INVALUE = threshold_range[1] | ... | ... |
invesalius/data/viewer_volume.py
... | ... | @@ -24,6 +24,7 @@ import vtk |
24 | 24 | from vtk.wx.wxVTKRenderWindowInteractor import wxVTKRenderWindowInteractor |
25 | 25 | import wx.lib.pubsub as ps |
26 | 26 | import constants as const |
27 | +import project as prj | |
27 | 28 | |
28 | 29 | class Viewer(wx.Panel): |
29 | 30 | def __init__(self, parent): |
... | ... | @@ -127,8 +128,11 @@ class Viewer(wx.Panel): |
127 | 128 | cam = self.ren.GetActiveCamera() |
128 | 129 | cam.SetFocalPoint(0,0,0) |
129 | 130 | |
130 | - xv,yv,zv = const.AXIAL_VOLUME_CAM_VIEW_UP[position] | |
131 | - xp,yp,zp = const.AXIAL_VOLUME_CAM_POSITION[position] | |
131 | + proj = prj.Project() | |
132 | + orig_orien = proj.original_orientation | |
133 | + | |
134 | + xv,yv,zv = const.VOLUME_POSITION[orig_orien][0][position] | |
135 | + xp,yp,zp = const.VOLUME_POSITION[orig_orien][1][position] | |
132 | 136 | |
133 | 137 | cam.SetViewUp(xv,yv,zv) |
134 | 138 | cam.SetPosition(xp,yp,zp) | ... | ... |
invesalius/project.py
invesalius/reader/dicom_reader.py
... | ... | @@ -109,7 +109,7 @@ def LoadImages(dir_): |
109 | 109 | read.Update() |
110 | 110 | |
111 | 111 | #Resample image in x,y dimension |
112 | - img = ResampleImage2D(read.GetOutput(), 200) | |
112 | + img = ResampleImage2D(read.GetOutput(), 256) | |
113 | 113 | |
114 | 114 | #Stack images in Z axes |
115 | 115 | img_app.AddInput(img) |
... | ... | @@ -124,7 +124,7 @@ def LoadImages(dir_): |
124 | 124 | |
125 | 125 | img_axial.Update() |
126 | 126 | |
127 | - return img_axial, acquisition_modality, tilt | |
127 | + return img_axial, acquisition_modality, tilt, orientation | |
128 | 128 | |
129 | 129 | def GetDicomFiles(path, recursive = False): |
130 | 130 | # TODO!!! SUPER GAMBIARRA!!! DO THIS BETTER | ... | ... |