|
34 | 34 | package net.imglib2.algorithm.morphology;
|
35 | 35 |
|
36 | 36 | import java.util.List;
|
| 37 | +import java.util.function.BiPredicate; |
| 38 | +import java.util.function.Consumer; |
37 | 39 |
|
38 |
| -import net.imglib2.Interval; |
39 |
| -import net.imglib2.IterableInterval; |
40 |
| -import net.imglib2.RandomAccessible; |
41 |
| -import net.imglib2.RandomAccessibleInterval; |
| 40 | +import net.imglib2.*; |
42 | 41 | import net.imglib2.algorithm.neighborhood.Shape;
|
43 | 42 | import net.imglib2.img.Img;
|
44 | 43 | import net.imglib2.img.ImgFactory;
|
@@ -77,7 +76,8 @@ public class BlackTopHat
|
77 | 76 | * allow for performance optimization through structuring element
|
78 | 77 | * decomposition. Each shape is processed in order as given in the list. If
|
79 | 78 | * the list is empty, the source image is returned.
|
80 |
| - * |
| 79 | + * |
| 80 | + * @implNote op name='blackTopHat', type='org.scijava.function.Function.Arity3' |
81 | 81 | * @param source
|
82 | 82 | * the source image.
|
83 | 83 | * @param strels
|
@@ -120,7 +120,8 @@ public static < T extends RealType< T >> Img< T > blackTopHat( final Img< T > so
|
120 | 120 | * image, and the converse for the max value. These normally unseen
|
121 | 121 | * parameters are required to operate on
|
122 | 122 | * {@code T extends Comparable & Type}.
|
123 |
| - * |
| 123 | + * |
| 124 | + * @implNote op name='blackTopHat', type='org.scijava.function.Function.Arity5' |
124 | 125 | * @param source
|
125 | 126 | * the source image.
|
126 | 127 | * @param strels
|
@@ -159,7 +160,8 @@ public static < T extends Type< T > & Comparable< T > & Sub< T > > Img< T > blac
|
159 | 160 | * limited to flat structuring elements, only having {@code on/off} pixels,
|
160 | 161 | * contrary to grayscale structuring elements. This allows to simply use a
|
161 | 162 | * {@link Shape} as a type for these structuring elements.
|
162 |
| - * |
| 163 | + * |
| 164 | + * @implNote op name='blackTopHat', type='org.scijava.function.Function.Arity3' |
163 | 165 | * @param source
|
164 | 166 | * the source image.
|
165 | 167 | * @param strel
|
@@ -196,7 +198,8 @@ public static < T extends RealType< T >> Img< T > blackTopHat( final Img< T > so
|
196 | 198 | * (against {@link Comparable}) than any of the value found in the source
|
197 | 199 | * image, and the converse for the max value. These normally unseen
|
198 | 200 | * parameters are required to operate on {@code T extends Comparable & Sub}.
|
199 |
| - * |
| 201 | + * |
| 202 | + * @implNote op name='blackTopHat', type='org.scijava.function.Function.Arity5' |
200 | 203 | * @param source
|
201 | 204 | * the source image.
|
202 | 205 | * @param strel
|
@@ -268,6 +271,57 @@ public static < T extends RealType< T > > void blackTopHat( final RandomAccessib
|
268 | 271 | MorphologyUtils.subAAB2( target, source, numThreads );
|
269 | 272 | }
|
270 | 273 |
|
| 274 | + /** |
| 275 | + * Performs the black top-hat (or bottom-hat) morphological operation on a |
| 276 | + * {@link RealType} source {@link RandomAccessible}, using a list of |
| 277 | + * {@link Shape}s as a structuring element, and writes the result on a |
| 278 | + * specified target which must be an {@link IterableInterval}. |
| 279 | + * |
| 280 | + * See <a href="http://en.wikipedia.org/wiki/Top-hat_transform"> Top-hat |
| 281 | + * transform</a>. |
| 282 | + * <p> |
| 283 | + * <b>Careful: Target must point to a different structure than source.</b> |
| 284 | + * In place operation will not work but will not generate an error. |
| 285 | + * <p> |
| 286 | + * It is the caller responsibility to ensure that the source is sufficiently |
| 287 | + * padded to properly cover the target range plus the shape size. See |
| 288 | + * <i>e.g.</i> {@link Views#extendValue(RandomAccessibleInterval, Type)} |
| 289 | + * <p> |
| 290 | + * It is limited to flat structuring elements, only having |
| 291 | + * {@code on/off} pixels, contrary to grayscale structuring elements. |
| 292 | + * This allows to simply use a {@link Shape} as a type for these structuring |
| 293 | + * elements. |
| 294 | + * <p> |
| 295 | + * The structuring element is specified through a list of {@link Shape}s, to |
| 296 | + * allow for performance optimization through structuring element |
| 297 | + * decomposition. Each shape is processed in order as given in the list. If |
| 298 | + * the list is empty, the target receives a copy of the source. |
| 299 | + * <p> |
| 300 | + * This method differs from |
| 301 | + * {@link #blackTopHat(RandomAccessible, IterableInterval, List, int)} |
| 302 | + * only in that its parameter order is tailored to an Op. The output comes |
| 303 | + * last, and the primary input (the input image) comes first. |
| 304 | + * </p> |
| 305 | + * |
| 306 | + * @implNote op name='blackTopHat', type='org.scijava.function.Computers.Arity3' |
| 307 | + * @param source |
| 308 | + * the {@link RandomAccessible} to operate on. |
| 309 | + * @param strels |
| 310 | + * the list of {@link Shape}s that serves as a structuring |
| 311 | + * element. |
| 312 | + * @param numThreads |
| 313 | + * the number of threads to use for calculation. |
| 314 | + * @param target |
| 315 | + * the {@link IterableInterval} to write the results on. |
| 316 | + * @param <T> |
| 317 | + * the type of the source and the result. Must extends |
| 318 | + * {@link RealType}. |
| 319 | + */ |
| 320 | + public static < T extends RealType< T > > void blackTopHat( final RandomAccessible< T > source, final List< ? extends Shape > strels, final int numThreads , final IterableInterval<T> target) |
| 321 | + { |
| 322 | + blackTopHat( source, target, strels, numThreads ); |
| 323 | + } |
| 324 | + |
271 | 325 | /**
|
272 | 326 | * Performs the black top-hat (or bottom-hat) morphological operation on a
|
273 | 327 | * source {@link RandomAccessible}, using a list of {@link Shape}s as a
|
|
0 commit comments