Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

blob throws error when run with no reference_image and is_volume=False #1870

Open
mattcai opened this issue Apr 13, 2020 · 2 comments
Open
Labels
bug An issue with an existing feature
Milestone

Comments

@mattcai
Copy link
Contributor

mattcai commented Apr 13, 2020

Description

When using BlobDetector to find spots in an ImageStack without using a reference_image and with is_volume=False error is thrown because BlobDetector is hard coded to parse the result of skimage.feature.blob_log run on 3D numpy array.

Using a reference_image doesn't throw this error because it ignores the is_volume argument and runs everything like is_volume=True.

Steps/Code to Reproduce

code to reproduce error

Expected Results

Expect to return an IntensityTable

Actual Results

---------------------------------------------------------------------------
IndexError                                Traceback (most recent call last)
<ipython-input-57-d5060f4c30ec> in <module>
      7     measurement_type='mean',
      8 )
----> 9 bd_spots = bd.run(image_stack=wth_imgs)

~/starfish-CI/starfish/starfish/core/pipeline/algorithmbase.py in helper(*args, **kwargs)
     21         @functools.wraps(func)
     22         def helper(*args, **kwargs):
---> 23             result = func(*args, **kwargs)
     24             if result is not None:
     25                 method_class_str = str(args[0].__class__)

~/starfish-CI/starfish/starfish/core/spots/FindSpots/blob.py in run(self, image_stack, reference_image, n_processes, *args)
    193                 func=spot_finding_method,
    194                 group_by=determine_axes_to_group_by(self.is_volume),
--> 195                 n_processes=n_processes
    196             )
    197             results = SpotFindingResults(imagestack_coords=image_stack.xarray.coords,

~/starfish-CI/starfish/starfish/core/imagestack/imagestack.py in transform(self, func, group_by, verbose, n_processes, *args, **kwargs)
    947             # Note: results is [None, ...] if executing an in-place workflow
    948             # Note: this return must be inside the context manager or the Pool will deadlock
--> 949             return list(zip(results, selectors))
    950 
    951     @staticmethod

/usr/local/Cellar/python/3.7.5/Frameworks/Python.framework/Versions/3.7/lib/python3.7/concurrent/futures/_base.py in result_iterator()
    596                     # Careful not to keep a reference to the popped future
    597                     if timeout is None:
--> 598                         yield fs.pop().result()
    599                     else:
    600                         yield fs.pop().result(end_time - time.monotonic())

/usr/local/Cellar/python/3.7.5/Frameworks/Python.framework/Versions/3.7/lib/python3.7/concurrent/futures/_base.py in result(self, timeout)
    433                 raise CancelledError()
    434             elif self._state == FINISHED:
--> 435                 return self.__get_result()
    436             else:
    437                 raise TimeoutError()

/usr/local/Cellar/python/3.7.5/Frameworks/Python.framework/Versions/3.7/lib/python3.7/concurrent/futures/_base.py in __get_result(self)
    382     def __get_result(self):
    383         if self._exception:
--> 384             raise self._exception
    385         else:
    386             return self._result

/usr/local/Cellar/python/3.7.5/Frameworks/Python.framework/Versions/3.7/lib/python3.7/concurrent/futures/thread.py in run(self)
     55 
     56         try:
---> 57             result = self.fn(*self.args, **self.kwargs)
     58         except BaseException as exc:
     59             self.future.set_exception(exc)

~/starfish-CI/starfish/starfish/core/imagestack/imagestack.py in _processing_workflow(worker_callable, data_array, args, kwargs, selectors)
    962 
    963         # pass worker_callable a view into the backing array, which will be overwritten
--> 964         return worker_callable(sliced, *args, **kwargs)  # type: ignore
    965 
    966     @property

~/starfish-CI/starfish/starfish/core/spots/FindSpots/blob.py in image_to_spots(self, data_image)
    135         y_inds = fitted_blobs_array[:, 1].astype(int)
    136         x_inds = fitted_blobs_array[:, 2].astype(int)
--> 137         radius = np.round(fitted_blobs_array[:, 3] * np.sqrt(3))
    138         data_image = np.asarray(data_image)
    139         intensities = data_image[tuple([z_inds, y_inds, x_inds])]

IndexError: index 3 is out of bounds for axis 1 with size 3
@mattcai mattcai added the bug An issue with an existing feature label Apr 13, 2020
@neuromusic neuromusic added this to the 0.3.0 milestone Jun 8, 2020
@mattcai
Copy link
Contributor Author

mattcai commented Jul 23, 2020

starfish user trying to find spots in 3D images runs out of memory when using is_volume=True. Her workaround seems analogous to setting is_volume=False. Fixing this bug would allow her to use BlobDetector as intended.

@nickeener
Copy link
Contributor

This is fixed in #1985

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug An issue with an existing feature
Projects
None yet
Development

No branches or pull requests

3 participants