|
47 | 47 | import net.imglib2.view.Views; |
48 | 48 |
|
49 | 49 | import org.scijava.function.Functions; |
| 50 | +import org.scijava.ops.spi.Nullable; |
50 | 51 |
|
51 | 52 | /** |
52 | 53 | * An N-dimensional box counting that can be used to estimate the fractal |
@@ -103,11 +104,15 @@ private BoxCount() { |
103 | 104 | * @return A list of (log(foreground count), -log(section size)) |
104 | 105 | * {@link ValuePair} objects for curve fitting |
105 | 106 | */ |
106 | | - public static <B extends BooleanType<B>> |
107 | | - List<ValuePair<DoubleType, DoubleType>> apply( |
108 | | - final RandomAccessibleInterval<B> input, final Long maxSize, |
109 | | - final Long minSize, final Double scaling, final Long gridMoves) |
110 | | - { |
| 107 | + public static <B extends BooleanType<B>> // |
| 108 | + List<ValuePair<DoubleType, DoubleType>> apply( // |
| 109 | + final RandomAccessibleInterval<B> input, // |
| 110 | + final Long maxSize, // |
| 111 | + final Long minSize, // |
| 112 | + final Double scaling, // |
| 113 | + final Long gridMoves // |
| 114 | + ) { |
| 115 | + |
111 | 116 | if (scaling <= 1.0) { |
112 | 117 | throw new IllegalArgumentException( |
113 | 118 | "Scaling must be > 1.0 or algorithm won't stop."); |
@@ -344,10 +349,25 @@ class DefaultBoxCount<B extends BooleanType<B>> implements |
344 | 349 | * @return the output |
345 | 350 | */ |
346 | 351 | @Override |
347 | | - public List<ValuePair<DoubleType, DoubleType>> apply( |
348 | | - RandomAccessibleInterval<B> input, Long maxSize, Long minSize, |
349 | | - Double scaling, Long gridMoves) |
350 | | - { |
| 352 | + public List<ValuePair<DoubleType, DoubleType>> apply( // |
| 353 | + final RandomAccessibleInterval<B> input, // |
| 354 | + @Nullable Long maxSize, // |
| 355 | + @Nullable Long minSize, // |
| 356 | + @Nullable Double scaling, // |
| 357 | + @Nullable Long gridMoves // |
| 358 | + ) { |
| 359 | + if (maxSize == null) { |
| 360 | + maxSize = 48L; |
| 361 | + } |
| 362 | + if (minSize == null) { |
| 363 | + minSize = 5L; |
| 364 | + } |
| 365 | + if (scaling == null) { |
| 366 | + scaling = 1.2; |
| 367 | + } |
| 368 | + if (gridMoves == null) { |
| 369 | + gridMoves = 0L; |
| 370 | + } |
351 | 371 | return BoxCount.apply(input, maxSize, minSize, scaling, gridMoves); |
352 | 372 | } |
353 | 373 |
|
|
0 commit comments