tobac
tobac copied to clipboard
Adds isolation in 2d to segmentation file.
This is just an addition to the main tobac segmentation file. The additional parameter is ISO_dilate, a value by which the 2d feature is dilated in order to find the number of neighbors. 1 Neighbor value indicates the feature (which was dilated) does not have a neighbor. Values greater than 1 are the number of neighbors in addition to the base feature. Non-positive values indicate a feature area was not created for the feature id and thus no valid neighbors.
It looks like the CI failed due to switching between spacing and tabs for indents. I believe that the rest of the code uses four spaces to denote indentation rather than tabs. Looking at your code, I suspect that that may be the only issue?
I've added some comments to the code, but generally I'm happy here. I think we will want to wait to merge this until after #78 , but once that's in and this is updated to match the new style, I'm happy to merge this.
Overall this looks good, but I have a couple of thoughts/requests:
- Like Sean, I think it would be better to have this as an optional parameter to calculate, rather than being run for everyone. Perhaps it would be good to set the default value of "ISO_dilate" to 0 and only calculate the isolation metric if a value greater than 0 is provided?
- Could this be run separately from segmentation? I.e. could this be run as a separate analysis function on a previously calculated segmentation mask. This would negate the need for the first point, and allow the effects of different ISO_dilate values to be compared more easily
The merge conflict is just due to formatting, so we can fix that easily before merging.
I've marked this PR as a draft for now.