Closed hanslovsky closed 6 years ago
OK to merge @axtimwalde @tpietzsch @StephanPreibisch?
@axtimwalde has a use case in which it would be helpful if connected components analysis would produce the same id as if connected components analysis was run on the full volume for any fully contained connected component in an arbitrary subvolume. As an example, let
final RandomAccessibleInterval< B > mask = ...
final RandomAccessibleInterval< B > subVolume1 = Views.interval( mask, ... );
final RandomAccessibleInterval< B > subVolume2 = Views.interval( mask, ... );
Any connected component that is fully contained in subVolume1
should have the same label as it would have in mask
. As a consequence, if that same connected component is fully contained in subVolume2
, as well, it will be labeled with the same id in that sub-volume, too.
I implemented this extension in a separate branch: https://github.com/hanslovsky/imglib2-algorithm/tree/connected-components-more-general Example: https://github.com/hanslovsky/sandbox-with-ij/blob/master/src/main/kotlin/org/janelia/saalfeldlab/labels/ConnectedComponentsExample.kt If @axtimwalde thinks that this extension helps his use case, I will rebase that extension into this PR.
@axtimwalde I rebased that branch as mentioned above.
This PR adds a new version of connected component analysis
DiamondShape
with unit rangeExecutorService
required (useful for running wihin parallelization frameworks like Spark)Shape
to allow for arbitrary neighborhoods.Integer.MAX_VALUE
foreground pixels. For large pixels, the task should be divided and parallelized anyway.I suggest we wait until a new release of pom-imglib2 before merging so we can avoid overriding the managed version of imglib2 dependency.