imglib / imglib2-algorithm

Image processing algorithms for ImgLib2
http://imglib2.net/
Other
22 stars 20 forks source link

Connected components #54

Closed hanslovsky closed 6 years ago

hanslovsky commented 6 years ago

This PR adds a new version of connected component analysis

I suggest we wait until a new release of pom-imglib2 before merging so we can avoid overriding the managed version of imglib2 dependency.

hanslovsky commented 6 years ago

OK to merge @axtimwalde @tpietzsch @StephanPreibisch?

hanslovsky commented 6 years ago

@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.

hanslovsky commented 6 years ago

@axtimwalde I rebased that branch as mentioned above.