Commit 10945a2a454c47cf3c253b19f92e28965a368719

Authored by Thiago Franco de Moraes
1 parent 3ee7eebe

Removed duplicated code from CrossInteractorStyle

Showing 1 changed file with 2 additions and 40 deletions   Show diff stats
invesalius/data/styles.py
... ... @@ -218,12 +218,12 @@ class CrossInteractorStyle(DefaultInteractorStyle):
218 218  
219 219 # Get in what slice data the click occurred
220 220 # pick to get click position in the 3d world
221   - coord_cross = self.get_coordinate_cursor()
  221 + coord_cross = self.viewer.get_coordinate_cursor(self.picker)
222 222 position = self.slice_actor.GetInput().FindPoint(coord_cross)
223 223 # Forcing focal point to be setted in the center of the pixel.
224 224 coord_cross = self.slice_actor.GetInput().GetPoint(position)
225 225  
226   - coord = self.calcultate_scroll_position(position)
  226 + coord = self.viewer.calcultate_scroll_position(position)
227 227 Publisher.sendMessage('Update cross position', coord_cross)
228 228 self.ScrollSlice(coord)
229 229 Publisher.sendMessage('Set ball reference position based on bound',
... ... @@ -233,32 +233,6 @@ class CrossInteractorStyle(DefaultInteractorStyle):
233 233  
234 234 iren.Render()
235 235  
236   -
237   - def calcultate_scroll_position(self, position):
238   - # Based in the given coord (x, y, z), returns a list with the scroll positions for each
239   - # orientation, being the first position the sagital, second the coronal
240   - # and the last, axial.
241   -
242   - if self.orientation == 'AXIAL':
243   - image_width = self.slice_actor.GetInput().GetDimensions()[0]
244   - axial = self.slice_data.number
245   - coronal = position / image_width
246   - sagital = position % image_width
247   -
248   - elif self.orientation == 'CORONAL':
249   - image_width = self.slice_actor.GetInput().GetDimensions()[0]
250   - axial = position / image_width
251   - coronal = self.slice_data.number
252   - sagital = position % image_width
253   -
254   - elif self.orientation == 'SAGITAL':
255   - image_width = self.slice_actor.GetInput().GetDimensions()[1]
256   - axial = position / image_width
257   - coronal = position % image_width
258   - sagital = self.slice_data.number
259   -
260   - return sagital, coronal, axial
261   -
262 236 def ScrollSlice(self, coord):
263 237 if self.orientation == "AXIAL":
264 238 Publisher.sendMessage(('Set scroll position', 'SAGITAL'),
... ... @@ -276,18 +250,6 @@ class CrossInteractorStyle(DefaultInteractorStyle):
276 250 Publisher.sendMessage(('Set scroll position', 'SAGITAL'),
277 251 coord[0])
278 252  
279   - def get_coordinate_cursor(self):
280   - # Find position
281   - x, y, z = self.picker.GetPickPosition()
282   - bounds = self.viewer.slice_data.actor.GetBounds()
283   - if bounds[0] == bounds[1]:
284   - x = bounds[0]
285   - elif bounds[2] == bounds[3]:
286   - y = bounds[2]
287   - elif bounds[4] == bounds[5]:
288   - z = bounds[4]
289   - return x, y, z
290   -
291 253  
292 254 class WWWLInteractorStyle(DefaultInteractorStyle):
293 255 """
... ...