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

implement the sato filter in pyclesperanto (equivalent of fiji tubeness) #320

Open
thawn opened this issue Aug 26, 2023 · 0 comments
Open
Labels
enhancement New feature or request

Comments

@thawn
Copy link
Collaborator

thawn commented Aug 26, 2023

It would be great to implement the skimage.filters.sato filter in pyclesperanto.

the filter takes an image and a range of sigmas (by default range(1,10,2))
It then calculates the hessian matrix eigenvalues for each sigma in descending order. For each sigma, it computes normalized tubeness (eqs. (9) and (22), ref. [1]_) as the geometric mean of eigvals other than the lowest one, clipped to 0, multiplied by sigma^2. Then it returns the maximum tubeness from all the different sigmas for each pixel (->source.

Could we try to implement this using cle.hessian_eigenvalues()?
cle.hessian_eigenvalues() does not support a sigma parameter. Can we circumvent this by scaling the image according to the sigma before calculating the eigenvalues?

roughly like this:

tubeness = cle.zeros_like(image)
for sigma in sigmas:
    blurred = cle.gaussian_blur(image, sigma_z=sigma/2, sigma_y=sigma/2, sigma_x=sigma/2)
    cle.scale(blurred, scale_z=1/sigma,scale_y=1/sigma,scale_x=1/sigma)
    # calculate geometric mean of middle and large eigenvalues returned by cle.hessian_eigenvalues(), 
    # clip to 0 and multiply by sigma ** 2
    mean_eigenvalues = ...
    mean_eigenvalues = cle.scale(mean_eigenvalues, scale=sigma)
    tubeness = cle.max_images(mean_eigenvalues, tubeness)
return tubeness

do we do the gaussian blur with sigma/2 or do we scale by 1/(sigma * 2)?

@thawn thawn added the enhancement New feature or request label Aug 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant