InsightSoftwareConsortium / itk_cucim

ITK Python filters accelerated with cuCIM
Apache License 2.0
3 stars 3 forks source link

Add signed Maurer distance map #20

Closed grlee77 closed 1 year ago

grlee77 commented 1 year ago

related to feature request #13

Please first review #19 as the first commit here corresponds to that PR.

This MR adds an implementation for itk.signed_mauerer_distance_map_image_filter. The implementation here is based on subtraction of two unsigned distance transforms (with an additional 1 pixel erosion needed to get equivalent boundary behavior). The use of non-unit pixel/voxel "spacing" will require cuCIM >= 2022.12.00 which added support for pixel spacings to the Euclidean distance transform. Without spacing, cuCIM >= 2022.08.00 can be used (although performance will be better with >= 2022.12.00).

The horse image added here for testing corresponds to skimage.data.horse(). I included in the repository to avoid having to include a scikit-image dependency to run the test suite. It is permissively licensed, as listed in the scikit-image docstring:

Black and white silhouette of a horse. This image was downloaded from openclipart <http://openclipart.org/detail/158377/horse-by-marauder> No copyright restrictions. CC0 given by owner (Andreas Preuss (marauder)).

grlee77 commented 1 year ago

I see that #19 was merged while I was writing the desciption above. Super fast @thewtex!

grlee77 commented 1 year ago

Also, I forgot to mention that the implementation here will support only 2D and 3D images. Currently, the tests are only implemented for 2D. I could add some randomly generated binary blobs for a 3D test case unless you have a different suitable data set we could use?

grlee77 commented 1 year ago

Some benchmarks were done previously for cuCIM 22.08.01 and 22.12.00 relative to ITK here: https://github.com/rapidsai/cucim/pull/406#issue-1363453513

scroll down to the faster results under heading "Proposed Implementation" for results from cuCIM 2022.12.00

I think those were for the unsigned transform, so relative performance may need to be divided by ~2 for the signed implementation as done here.

dzenanz commented 1 year ago

A bunch of data exists for Maurer filter test. You can download it from here: https://data.kitware.com/#folder/5b6b681c8d777f06857c2952.

thewtex commented 1 year ago

I see that #19 was merged while I was writing the desciption above. Super fast @thewtex!

I got pulled away in the meantime -- sorry for the delay on the follow-up on this one @grlee77 ! :gem: :rabbit2: