brainglobe / cellfinder

Automated 3D cell detection in very large images
https://brainglobe.info/documentation/cellfinder/index.html
BSD 3-Clause "New" or "Revised" License
181 stars 39 forks source link

Do not require an "empty" corner without tissue to set a baseline level of fluorescence. #292

Open dstansby opened 1 year ago

dstansby commented 1 year ago

I'm currently going through the 2D filter to understand how it works (and refaactoring along the way, PR incoming soon!), and noticed that the TileWalker uses data in the corner of a 2D plane to calculate a threshold, above which a tile is considered to be within the brain.

If a user tries to use a cropped brain this isn't going to work though - the threshold will be calculated based on signal data within the brain, which leaves open the possibility of tiles within the brain being discarded.

There should be a clear warning in the docs that users need to use whole brain data that includes the a corner outside the brain with very low signal.

(p.s. there might be already, I haven't checked, in which case this can just be closed)

adamltyson commented 1 year ago

I don't think there's any such warning. It's clear for cellfinder (CLI) that it needs to be a whole-brain image, which should always have an "empty" corner. For the python package (and napari plugin) there's no such instruction. TBH the approach should probably be made more general to not rely on this assumption.

adamltyson commented 5 months ago

Renaming this issue to better reflect what needs to be done.

adamltyson commented 5 months ago

Not sure how to do this without an area we know is outside the tissue, but maybe the mean of the middle plane or something?

IgorTatarnikov commented 5 months ago

That would have my vote, we can then explore dropping the brain mask and just do everything with a single pass using a threshold above the mean of the middle plane to identify signal.