Add options to segment_3d_image for removing objects touching borders#139
Add options to segment_3d_image for removing objects touching borders#139lguerard wants to merge 2 commits intoimcf:develfrom
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## devel #139 +/- ##
====================================
Coverage 25% 25%
====================================
Files 25 25
Lines 1771 1763 -8
====================================
+ Hits 437 443 +6
+ Misses 1334 1320 -14 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
| Defaults to None. | ||
| remove_touching_borders : bool, optional | ||
| Whether to remove objects that touch the borders in X and Y. Defaults to False. | ||
| remove_touching_borders_z : bool, optional |
There was a problem hiding this comment.
This won't have an effect if the non-z parameter is false, as far as I can see.
Either document this or automatically set the non-z to true if the z one is true inside the function. I prefer the latter approach as it seems less surprising.
There was a problem hiding this comment.
I checked this morning and there isn't a function in the 3DImageJSuite that could filter out only objects in Z but not XY.
There is a method in MorpholibJ that I could use though, should I switch to that ?
There was a problem hiding this comment.
Let me clarify what I'm trying to say.
From reading the docstring, what would an innocent developer think 🤔 will happen with this call?
label_imp = segment_3d_image(binary_imp, remove_touching_borders_z=True)I believe the expectation is that at least some filtering would be happening, which is not the case given the current code execution path.
I don't know if we need a function that purely filters objects in Z, but if the Z-filtering is requested explicitly (without the XY-filtering), it will be silently ignored. My suggestion is to implicitly enable XY-filtering if Z-filtering is requested and to explain this in the docstring.
Would you think we should rather go for the MorphoLibJ approach that allows to only filter in Z? If you foresee any use-cases for this, it's clearly the better approach.
There was a problem hiding this comment.
Yes, I agree.
At the moment, using only the Image3DSuite, there is no way to only filter in Z. If the user wants to do that, then it has to also filter in XY. I'm not happy about this, users might want to filter objects that aren't fully imaged in a stack and remove objects that are in slide 1 or slide max.
I'll improve this using MorpholibJ
Fix #138