Skip to content

Commit 9c3afe2

Browse files
committed
Fix RidgeDetectionMetadata
1 parent 2980909 commit 9c3afe2

1 file changed

Lines changed: 4 additions & 9 deletions

File tree

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

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -32,17 +32,16 @@
3232
import java.util.function.BiFunction;
3333
import java.util.function.Function;
3434

35-
import net.imagej.ops.OpService;
3635
import net.imglib2.Cursor;
3736
import net.imglib2.Dimensions;
37+
import net.imglib2.FinalDimensions;
3838
import net.imglib2.RandomAccess;
3939
import net.imglib2.RandomAccessibleInterval;
4040
import net.imglib2.img.Img;
4141
import net.imglib2.type.numeric.RealType;
4242
import net.imglib2.type.numeric.real.DoubleType;
4343
import net.imglib2.view.Views;
4444

45-
import org.scijava.Context;
4645
import org.scijava.ops.core.computer.Computer;
4746
import org.scijava.ops.core.computer.Computer3;
4847

@@ -80,10 +79,6 @@ public <T extends RealType<T>> RidgeDetectionMetadata(
8079
final Function<RandomAccessibleInterval<DoubleType>, RandomAccessibleInterval<DoubleType>> copyOp,
8180
final Computer3<RandomAccessibleInterval<DoubleType>, double[], int[], RandomAccessibleInterval<DoubleType>> partialDerivativeOp)
8281
{
83-
// create op service for metadata generation
84-
final Context context = new Context();
85-
final OpService opService = context.getService(OpService.class);
86-
8782
// convert input to doubleType
8883
final RandomAccessibleInterval<DoubleType> converted = createOp.apply(input, new DoubleType());
8984
convertOp.compute(input, converted);
@@ -96,11 +91,11 @@ public <T extends RealType<T>> RidgeDetectionMetadata(
9691
valuesArr[valuesArr.length - 1] = 2;
9792

9893
// create metadata images and randomAccesses
99-
pValues = opService.create().img(valuesArr);
94+
pValues = (Img<DoubleType>) createOp.apply(new FinalDimensions(valuesArr), new DoubleType());
10095
final RandomAccess<DoubleType> pRA = pValues.randomAccess();
101-
nValues = opService.create().img(valuesArr);
96+
nValues = (Img<DoubleType>) createOp.apply(new FinalDimensions(valuesArr), new DoubleType());
10297
final RandomAccess<DoubleType> nRA = nValues.randomAccess();
103-
gradients = opService.create().img(input, new DoubleType());
98+
gradients = (Img<DoubleType>) createOp.apply(input, new DoubleType());
10499
final RandomAccess<DoubleType> gradientsRA = gradients.randomAccess();
105100

106101
// create a cursor of the input to direct all of the randomAccesses.

0 commit comments

Comments
 (0)