starfish icon indicating copy to clipboard operation
starfish copied to clipboard

add 3D support to LocalMaxPeakFinder

Open neuromusic opened this issue 5 years ago • 1 comments

Currently, LocalMaxPeakFinder indicates that it does not support 3D

However, @ttung dove in and skimage's peak_local_max does support 3D! However, the border exclusion can prevent any peaks from being found if len(z) <= 2 * exclude_border:

image

By exposing the exclude_borders argument in LocalMaxPeakFinder, users can set this to 0 (or less than half the size of z) and get 3D support immediately.

  1. expose exclude_borders as an argument for starfish, leaving it default to True
  2. (optional) throw a warning if is_volume=True and len(z)<=2*exclude_borders
  3. fix the docs to clarify that this spot finder DOES support 3D if certain conditions are met

Given the nature of data starfish users are processing, it is likely that a different border exclusion would be useful for x/y vs z, but skimage does not support this. If skimage's peak_local_max function accepted tuples, we could support this.

  1. open issues on skimage to request support for tuples on exclude_borders and min_distance
  2. do the work outlined in (4) and contribute it to skimage
  3. update LocalMaxPeakFinder to accept tuples

If we can do 4-6 quickly, we should consider going straight to this solution.

neuromusic avatar Nov 26 '19 21:11 neuromusic

the footprint argument theoretically allows us to do what we want to do. It allows us to control the regions being considered for each axis. Unfortunately, it has an off-by-one error (!!), where if the footprint's shape along an axis is 1, it trims one pixel instead of 0 pixels as it ought to!

ttung avatar Nov 26 '19 22:11 ttung