SainsburyWellcomeCentre / lasagna

3-D imaging visualisation through slicing
http://sainsburywellcomecentre.github.io/lasagna/
GNU General Public License v3.0
29 stars 7 forks source link

add_line_plugin crashed finding nearest point #219

Open raacampbell opened 5 years ago

raacampbell commented 5 years ago

Added two tracks. Went to add third one: clicked the point and added it. Then the plugin crashed Lasagna with error:

Error running plugin method <bound method plugin.hook_axisClicked of <add_line_plugin.plugin object at 0x1373d19d8>>; main error operands could not be broadcast together with shapes (0,) (1,3) 
Traceback (most recent call last):
  File "/Users/rob/Dropbox (UCL - SWC)/work/Anatomy/code/lasagna/lasagna/lasagna_object.py", line 1077, in axisClicked
    self.runHook(self.hooks["axisClicked"], self.axes2D[axis_id])
  File "/Users/rob/Dropbox (UCL - SWC)/work/Anatomy/code/lasagna/lasagna/lasagna_object.py", line 418, in runHook
    hook(*args)
  File "/Users/rob/work/Anatomy/code/lasagna/lasagna/plugins/annotation_plugins/add_line_plugin.py", line 146, in hook_axisClicked
    self.get_points_coord(), hLightCoords
  File "/Users/rob/work/Anatomy/code/lasagna/lasagna/plugins/annotation_plugins/add_line_plugin.py", line 224, in find_nearest_point_in_array
    delta = np.sum((array_to_search - vector_to_find) ** 2, axis=1) ** 0.5
ValueError: operands could not be broadcast together with shapes (0,) (1,3)

Seems like the point was not yet added to the array. Odd that I've not seen this bug before.