Commit 6a3795bd0b791ab1bddce04e5855e24c2441a87f
1 parent
b7d73f1c
Exists in
master
and in
6 other branches
EHN: The RectangleCursor is centered in the mouse position
Showing
4 changed files
with
22 additions
and
22 deletions
Show diff stats
invesalius/control.py
... | ... | @@ -7,7 +7,7 @@ import data.imagedata_utils as utils |
7 | 7 | import data.surface as surface |
8 | 8 | import data.volume as volume |
9 | 9 | import reader.dicom_reader as dicom |
10 | -import reader.analyze_reader as analyze | |
10 | +#import reader.analyze_reader as analyze | |
11 | 11 | |
12 | 12 | DEFAULT_THRESH_MODE = 0 |
13 | 13 | ... | ... |
invesalius/data/cursor_actors.py
... | ... | @@ -56,9 +56,9 @@ class CursorCircle: |
56 | 56 | Extracted equation. |
57 | 57 | http://www.mathopenref.com/chord.html |
58 | 58 | """ |
59 | - xc = 0 | |
60 | - yc = 0 | |
61 | - z = 0 | |
59 | + xc = 0.0 | |
60 | + yc = 0.0 | |
61 | + z = 0.0 | |
62 | 62 | xs, ys, zs = self.spacing |
63 | 63 | orientation_based_spacing = {"AXIAL" : (xs, ys), |
64 | 64 | "SAGITAL" : (ys, zs), |
... | ... | @@ -72,9 +72,9 @@ class CursorCircle: |
72 | 72 | # line size |
73 | 73 | line = sqrt(radius**2 - d**2) * 2 |
74 | 74 | # line initial x |
75 | - xi = xc - line/2 | |
75 | + xi = xc - line/2.0 | |
76 | 76 | # line final |
77 | - xf = line/2 + xc | |
77 | + xf = line/2.0 + xc | |
78 | 78 | yi = i |
79 | 79 | for k in utils.frange(xi,xf,xs): |
80 | 80 | self.pixel_list.append((k, yi)) |
... | ... | @@ -190,11 +190,11 @@ class CursorRectangle: |
190 | 190 | seeds_xf.SetPoint1(0, 0, 0) |
191 | 191 | seeds_xf.SetPoint2(self.x_length, 0, 0) |
192 | 192 | |
193 | - join_lines = self.join_lines | |
194 | - join_lines.AddInput(seeds_yi.GetOutput()) | |
195 | - join_lines.AddInput(seeds_yf.GetOutput()) | |
196 | - join_lines.AddInput(seeds_xi.GetOutput()) | |
197 | - join_lines.AddInput(seeds_xf.GetOutput()) | |
193 | + #join_lines = self.join_lines | |
194 | + #join_lines.AddInput(seeds_yi.GetOutput()) | |
195 | + #join_lines.AddInput(seeds_yf.GetOutput()) | |
196 | + #join_lines.AddInput(seeds_xi.GetOutput()) | |
197 | + #join_lines.AddInput(seeds_xf.GetOutput()) | |
198 | 198 | |
199 | 199 | self.__calculate_area_pixels() |
200 | 200 | |
... | ... | @@ -215,8 +215,15 @@ class CursorRectangle: |
215 | 215 | self.actor.RotateY(90) |
216 | 216 | |
217 | 217 | def SetPosition(self, position): |
218 | - self.position = position | |
219 | - self.actor.SetPosition(position) | |
218 | + x,y,z = position | |
219 | + x_half = self.x_length / 2.0 | |
220 | + y_half = self.y_length / 2.0 | |
221 | + orientation_position_based = {"AXIAL" : (x - x_half,y - y_half, z), | |
222 | + "CORONAL" : (x - x_half, y, z - y_half), | |
223 | + "SAGITAL" : (x, y - y_half, z + x_half)} | |
224 | + xc,yc,zc = orientation_position_based[self.orientation] | |
225 | + self.position = (xc,yc,zc) | |
226 | + self.actor.SetPosition(xc,yc,zc) | |
220 | 227 | |
221 | 228 | def SetEditionPosition(self, position): |
222 | 229 | self.edition_position = position | ... | ... |
invesalius/data/viewer_slice.py
... | ... | @@ -17,7 +17,6 @@ |
17 | 17 | # detalhes. |
18 | 18 | #-------------------------------------------------------------------------- |
19 | 19 | |
20 | - | |
21 | 20 | import vtk |
22 | 21 | from vtk.wx.wxVTKRenderWindowInteractor import wxVTKRenderWindowInteractor |
23 | 22 | import wx |
... | ... | @@ -121,8 +120,6 @@ class Viewer(wx.Panel): |
121 | 120 | style.AddObserver(event, |
122 | 121 | action[mode][event]) |
123 | 122 | |
124 | - | |
125 | - | |
126 | 123 | def ChangeBrushSize(self, pubsub_evt): |
127 | 124 | size = pubsub_evt.data |
128 | 125 | self._brush_cursor_size = size |
... | ... | @@ -146,8 +143,6 @@ class Viewer(wx.Panel): |
146 | 143 | self.cursor.SetColour(colour_vtk) |
147 | 144 | self.interactor.Render() |
148 | 145 | |
149 | - | |
150 | - | |
151 | 146 | def ChangeBrushActor(self, pubsub_evt): |
152 | 147 | brush_type = pubsub_evt.data |
153 | 148 | self._brush_cursor_type = brush_type |
... | ... | @@ -208,7 +203,6 @@ class Viewer(wx.Panel): |
208 | 203 | self.cursor.SetPosition(coord) |
209 | 204 | self.cursor.SetEditionPosition(self.GetCoordinateCursorEdition()) |
210 | 205 | self.__update_cursor_position(coord) |
211 | - self.ren.Render() | |
212 | 206 | |
213 | 207 | if self._brush_cursor_op == 'Erase': |
214 | 208 | evt_msg = 'Erase mask pixel' |
... | ... | @@ -221,8 +215,7 @@ class Viewer(wx.Panel): |
221 | 215 | pixels = self.cursor.GetPixels() |
222 | 216 | for coord in pixels: |
223 | 217 | ps.Publisher().sendMessage(evt_msg, coord) |
224 | - self.interactor.Render() | |
225 | - | |
218 | + self.interactor.Render() | |
226 | 219 | |
227 | 220 | def OnCrossMove(self, obj, evt_vtk): |
228 | 221 | coord = self.GetCoordinate() | ... | ... |
invesalius/reader/dicom_reader.py
... | ... | @@ -158,4 +158,4 @@ def GetDicomFiles(path, recursive = False): |
158 | 158 | result.append(files[x]) |
159 | 159 | acquisition_modality = read_dicom.GetAcquisitionModality() |
160 | 160 | # TODO!!! SUPER GAMBIARRA!!! DO THIS BETTER |
161 | - return result, acquisition_modality | |
162 | 161 | \ No newline at end of file |
162 | + return result, acquisition_modality | ... | ... |