SBC-Utrecht / pytom-match-pick

GPU-accelerated template matching for cryo-ET
https://sbc-utrecht.github.io/pytom-match-pick/
GNU General Public License v2.0
29 stars 9 forks source link

Tophat filter doesn't work with float16 output #233

Open asarnow opened 1 month ago

asarnow commented 1 month ago

I have scipy 1.13 and scipy.ndimage.white_tophat throws RuntimeError: array type not supported at pytom_tm/extract.py:72. If I add score_volume.astype(float) in the call, it runs but no particles are extracted (star file is empty). My tomograms are float16 and so are the score volumes.

~The white_tophat in cupy actually works with float16, maybe that is a solution~ It doesn't work with a structuring element. (Or casting to float for scipy, but maybe something has to be rescaled).

The command I tried (with or without .astype(float). pytom_extract_candidates.py -j pytom/matching/23dec02b_ts10_10.96Apx_job.json -c 0 -n 5000 --number-of-false-positives 1 -r 6 --log info --tophat-filter

McHaillet commented 1 month ago

Hi @asarnow, thanks for reporting and a possible fix! Casting to float32 sounds like a good solution. If you want you can make a pull request to solve the issue, otherwise I will make one. Let me know!