Skip to content

Commit a530315

Browse files
committed
Change Weakreferences to strong references
When using weak references sometimes the garbage collector would clean up constant arguments to ops before the ops were called.
1 parent 942493a commit a530315

11 files changed

Lines changed: 1184 additions & 1210 deletions

File tree

src/main/java/net/imagej/ops/segment/detectRidges/DefaultDetectRidges.java

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -43,14 +43,12 @@
4343
import net.imglib2.img.Img;
4444
import net.imglib2.outofbounds.OutOfBoundsConstantValueFactory;
4545
import net.imglib2.roi.geom.real.DefaultWritablePolyline;
46-
import net.imglib2.roi.geom.real.WritablePolyline;
4746
import net.imglib2.type.numeric.RealType;
4847
import net.imglib2.type.numeric.real.DoubleType;
4948

5049
import org.scijava.ops.OpDependency;
5150
import org.scijava.ops.core.Op;
5251
import org.scijava.ops.function.Computers;
53-
import org.scijava.ops.function.Computers;
5452
import org.scijava.ops.function.Functions;
5553
import org.scijava.param.Parameter;
5654
import org.scijava.plugin.Plugin;
@@ -69,7 +67,7 @@
6967
@Parameter(key = "ridgeLengthMin")
7068
@Parameter(key = "ridges", itemIO = ItemIO.OUTPUT)
7169
public class DefaultDetectRidges<T extends RealType<T>> implements
72-
Functions.Arity5<RandomAccessibleInterval<T>, Double, Double, Double, Integer, List<? extends WritablePolyline>> {
70+
Functions.Arity5<RandomAccessibleInterval<T>, Double, Double, Double, Integer, List<DefaultWritablePolyline>> {
7371

7472
/**
7573
* The diameter of the lines to search for.
@@ -95,16 +93,16 @@ public class DefaultDetectRidges<T extends RealType<T>> implements
9593
* threshold.
9694
*/
9795
double angleThreshold = 100;
98-
96+
9997
@OpDependency(name = "create.img")
10098
private BiFunction<Dimensions, DoubleType, RandomAccessibleInterval<DoubleType>> createOp;
101-
99+
102100
@OpDependency(name = "convert.float64")
103101
private Computers.Arity1<RandomAccessibleInterval<T>, RandomAccessibleInterval<DoubleType>> convertOp;
104-
102+
105103
@OpDependency(name = "copy.rai")
106104
private Function<RandomAccessibleInterval<DoubleType>, RandomAccessibleInterval<DoubleType>> copyOp;
107-
105+
108106
@OpDependency(name = "filter.derivativeGauss")
109107
private Computers.Arity3<RandomAccessibleInterval<DoubleType>, double[], int[], RandomAccessibleInterval<DoubleType>> partialDerivativeOp;
110108

@@ -232,9 +230,9 @@ private void getNextPoint(RandomAccess<DoubleType> gradientRA, RandomAccess<Doub
232230
}
233231

234232
@Override
235-
public List<? extends WritablePolyline> apply(final RandomAccessibleInterval<T> input, final Double width,
233+
public List<DefaultWritablePolyline> apply(final RandomAccessibleInterval<T> input, final Double width,
236234
final Double lowerThreshold, final Double higherThreshold, final Integer ridgeLengthMin) {
237-
235+
238236
this.width = width;
239237
this.lowerThreshold = lowerThreshold;
240238
this.higherThreshold = higherThreshold;

0 commit comments

Comments
 (0)