Skip to content

Commit 6ba88a9

Browse files
committed
imagej-ops2: fully purge scijava-common dependency
* Replace org.scijava.util with scijava-collections and scijava-meta. * Use scijava-priority for priority constants. * Stop implementing the old Cancelable and SingletonPlugin interfaces. We will need to provide a suitable replacement for cancelation later. * Remove obsolete POM and module-info configuration.
1 parent e1acdd9 commit 6ba88a9

14 files changed

Lines changed: 29 additions & 109 deletions

‎imagej/imagej-ops2/pom.xml‎

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -216,15 +216,6 @@
216216
<therapi.packages />
217217
</properties>
218218

219-
<build>
220-
<plugins>
221-
<plugin>
222-
<groupId>com.alexecollins.maven.plugin</groupId>
223-
<artifactId>script-maven-plugin</artifactId>
224-
</plugin>
225-
</plugins>
226-
</build>
227-
228219
<repositories>
229220
<repository>
230221
<id>scijava.public</id>
@@ -287,11 +278,6 @@
287278
<artifactId>scijava-types</artifactId>
288279
<version>${project.version}</version>
289280
</dependency>
290-
<dependency>
291-
<!-- Do not remove - Maven incorrectly identifies it as an unused dependency! -->
292-
<groupId>org.scijava</groupId>
293-
<artifactId>scripting-javascript</artifactId>
294-
</dependency>
295281

296282
<!-- Third party dependencies -->
297283
<dependency>

‎imagej/imagej-ops2/src/main/java/module-info.java‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -143,20 +143,21 @@
143143
opens net.imagej.ops2.types.maxValue to therapi.runtime.javadoc, org.scijava.ops.engine;
144144
opens net.imagej.ops2.types.minValue to therapi.runtime.javadoc, org.scijava.ops.engine;
145145

146-
requires java.xml; // TEMP: for org.scijava:scijava-common org.scijava.util.POM
147146
requires java.scripting;
148147
requires net.imagej.mesh2;
149148
requires net.imglib2;
150149
requires net.imglib2.algorithm;
151150
requires net.imglib2.algorithm.fft2;
152151
requires net.imglib2.roi;
153152
requires org.joml;
154-
requires org.scijava;
153+
requires org.scijava.collections;
155154
requires org.scijava.function;
155+
requires org.scijava.meta;
156156
requires org.scijava.ops.api;
157157
requires org.scijava.ops.engine;
158158
requires org.scijava.ops.spi;
159159
requires org.scijava.parsington;
160+
requires org.scijava.priority;
160161
requires org.scijava.types;
161162

162163
// FIXME: these module names derive from filenames and are thus unstable

‎imagej/imagej-ops2/src/main/java/net/imagej/ops2/About.java‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@
2929

3030
package net.imagej.ops2;
3131

32-
import org.scijava.util.POM;
33-
import org.scijava.util.VersionUtils;
32+
import org.scijava.meta.POM;
33+
import org.scijava.meta.Versions;
3434

3535
/**
3636
* Main entry point which displays information about the component.
@@ -43,7 +43,7 @@ private static String about(final Class<?> c, final String groupId,
4343
final String artifactId)
4444
{
4545
final POM pom = POM.getPOM(c, groupId, artifactId);
46-
final String version = VersionUtils.getVersion(c, groupId, artifactId);
46+
final String version = Versions.getVersion(c, groupId, artifactId);
4747
final StringBuilder sb = new StringBuilder();
4848

4949
final String projectName = pom.getProjectName();

‎imagej/imagej-ops2/src/main/java/net/imagej/ops2/coloc/maxTKendallTau/MTKT.java‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,10 +46,10 @@
4646
import net.imglib2.util.Util;
4747
import net.imglib2.view.Views;
4848

49+
import org.scijava.collections.IntArray;
4950
import org.scijava.function.Computers;
5051
import org.scijava.function.Functions;
5152
import org.scijava.ops.spi.OpDependency;
52-
import org.scijava.util.IntArray;
5353

5454
/**
5555
* This algorithm calculates Maximum Trunctated Kendall Tau (MTKT) from Wang et

‎imagej/imagej-ops2/src/main/java/net/imagej/ops2/filter/tubeness/DefaultTubeness.java‎

Lines changed: 5 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@
4848
import net.imglib2.type.numeric.real.DoubleType;
4949
import net.imglib2.view.Views;
5050

51-
import org.scijava.Cancelable;
5251
import org.scijava.function.Computers;
5352
import org.scijava.ops.spi.OpDependency;
5453

@@ -93,32 +92,20 @@
9392
*@implNote op names='filter.tubeness'
9493
*/
9594
public class DefaultTubeness<T extends RealType<T>> implements
96-
Computers.Arity4<RandomAccessibleInterval<T>, ExecutorService, Double, double[], IterableInterval<DoubleType>>,
97-
Cancelable {
95+
Computers.Arity4<RandomAccessibleInterval<T>, ExecutorService, Double, double[], IterableInterval<DoubleType>>
96+
{
9897

99-
/** Reason for cancelation, or null if not canceled. */
100-
private String cancelReason;
101-
10298
@OpDependency(name = "create.imgFactory")
10399
private Function<Dimensions, ImgFactory<DoubleType>> createFactoryOp;
104-
100+
105101
//TODO: make sure this works
106102
@OpDependency(name = "project")
107103
private Computers.Arity3<RandomAccessibleInterval<DoubleType>, Computers.Arity1<Iterable<DoubleType>, DoubleType>, Integer, IterableInterval<DoubleType>> projector;
108104

109-
/**
110-
* TODO
111-
*
112-
* @param input
113-
* @param executorService
114-
* @param sigma
115-
* @param calibration
116-
* @param output
117-
*/
118105
@Override
119106
public void compute(final RandomAccessibleInterval<T> input, ExecutorService es, final Double sigma,
120-
final double[] calibration, final IterableInterval<DoubleType> tubeness) {
121-
cancelReason = null;
107+
final double[] calibration, final IterableInterval<DoubleType> tubeness)
108+
{
122109

123110
final int numDimensions = input.numDimensions();
124111
// Sigmas in pixel units.
@@ -156,16 +143,10 @@ public void compute(final RandomAccessibleInterval<T> input, ExecutorService es,
156143
HessianMatrix.calculateMatrix(Views.extendBorder(input), gaussian, gradient, hessian,
157144
new OutOfBoundsBorderFactory<>(), nThreads, es, sigma);
158145

159-
if (isCanceled())
160-
return;
161-
162146
// Hessian eigenvalues.
163147
final RandomAccessibleInterval<DoubleType> evs = TensorEigenValues.calculateEigenValuesSymmetric(hessian,
164148
TensorEigenValues.createAppropriateResultImg(hessian, factory, new DoubleType()), nThreads, es);
165149

166-
if (isCanceled())
167-
return;
168-
169150
final Computers.Arity1<Iterable<DoubleType>, DoubleType> method;
170151
switch (numDimensions) {
171152
case 2:
@@ -205,7 +186,6 @@ public void compute(final Iterable<DoubleType> input, final DoubleType output) {
205186
output.setZero();
206187
else
207188
output.set(sigma * sigma * Math.abs(val));
208-
209189
}
210190
}
211191

@@ -228,28 +208,8 @@ public void compute(final Iterable<DoubleType> input, final DoubleType output) {
228208
output.setZero();
229209
else
230210
output.set(sigma * sigma * Math.sqrt(val1 * val2));
231-
232211
}
233212
}
234-
235-
// -- Cancelable methods --
236-
237-
@Override
238-
public boolean isCanceled() {
239-
return cancelReason != null;
240-
}
241-
242-
/** Cancels the command execution, with the given reason for doing so. */
243-
@Override
244-
public void cancel(final String reason) {
245-
cancelReason = reason == null ? "" : reason;
246-
}
247-
248-
@Override
249-
public String getCancelReason() {
250-
return cancelReason;
251-
}
252-
253213
}
254214

255215
/**
@@ -261,18 +221,9 @@ class DefaultTubenessWithoutCalibration<T extends RealType<T>> implements
261221
@OpDependency(name = "filter.tubeness")
262222
Computers.Arity4<RandomAccessibleInterval<T>, ExecutorService, Double, double[], IterableInterval<DoubleType>> tubenessOp;
263223

264-
/**
265-
* TODO
266-
*
267-
* @param input
268-
* @param executorService
269-
* @param sigma
270-
* @param output
271-
*/
272224
@Override
273225
public void compute(RandomAccessibleInterval<T> in1, ExecutorService in2, Double in3,
274226
IterableInterval<DoubleType> out) {
275227
tubenessOp.compute(in1, in2, in3, new double[] {}, out);
276228
}
277-
278229
}

‎imagej/imagej-ops2/src/main/java/net/imagej/ops2/morphology/thin/ThinningStrategy.java‎

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,15 +32,13 @@
3232
import net.imglib2.RandomAccessible;
3333
import net.imglib2.type.logic.BitType;
3434

35-
import org.scijava.plugin.SingletonPlugin;
36-
3735
/**
3836
* An interface for a simple thinning strategy employed by the thinningOp.
3937
*
4038
* @author Andreas Burger, University of Konstanz
4139
*/
4240

43-
public interface ThinningStrategy extends SingletonPlugin {
41+
public interface ThinningStrategy {
4442

4543
/**
4644
* This method should determine whether to keep a foreground pixel or not.

‎imagej/imagej-ops2/src/main/java/net/imagej/ops2/types/ImgFactoryTypeExtractor.java‎

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
import net.imglib2.img.ImgFactory;
3535
import net.imglib2.img.array.ArrayImg;
3636

37+
import org.scijava.priority.Priority;
3738
import org.scijava.types.TypeExtractor;
3839
import org.scijava.types.TypeReifier;
3940

@@ -63,12 +64,9 @@ public Class<ImgFactory<?>> getRawType() {
6364
return (Class) ImgFactory.class;
6465
}
6566

66-
/**
67-
* Corresponds to org.scijava.Priority.LOW_PRIORITY
68-
*/
6967
@Override
7068
public double priority() {
71-
return -100;
69+
return Priority.LOW;
7270
}
7371

7472
}

‎imagej/imagej-ops2/src/main/java/net/imagej/ops2/types/ImgLabelingTypeExtractor.java‎

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
import net.imglib2.roi.labeling.ImgLabeling;
3636
import net.imglib2.view.Views;
3737

38+
import org.scijava.priority.Priority;
3839
import org.scijava.types.TypeExtractor;
3940
import org.scijava.types.TypeReifier;
4041

@@ -73,12 +74,9 @@ public Type reify(final TypeReifier t, final ImgLabeling<?, ?> o, final int n) {
7374
return (Class) ImgLabeling.class;
7475
}
7576

76-
/**
77-
* Corresponds to org.scijava.Priority.LOW_PRIORITY
78-
*/
7977
@Override
8078
public double priority() {
81-
return -100;
79+
return Priority.LOW;
8280
}
8381

8482
}

‎imagej/imagej-ops2/src/main/java/net/imagej/ops2/types/LabelingMappingTypeExtractor.java‎

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434

3535
import net.imglib2.roi.labeling.LabelingMapping;
3636

37+
import org.scijava.priority.Priority;
3738
import org.scijava.types.TypeExtractor;
3839
import org.scijava.types.TypeReifier;
3940

@@ -72,12 +73,9 @@ public Class<LabelingMapping<?>> getRawType() {
7273
return (Class) LabelingMapping.class;
7374
}
7475

75-
/**
76-
* Corresponds to org.scijava.Priority.LOW_PRIORITY
77-
*/
7876
@Override
7977
public double priority() {
80-
return -100;
78+
return Priority.LOW;
8179
}
8280

8381

‎imagej/imagej-ops2/src/main/java/net/imagej/ops2/types/NativeImgTypeExtractor.java‎

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333

3434
import net.imglib2.img.NativeImg;
3535

36+
import org.scijava.priority.Priority;
3637
import org.scijava.types.TypeExtractor;
3738
import org.scijava.types.TypeReifier;
3839

@@ -70,12 +71,9 @@ public Type reify(final TypeReifier t, final NativeImg<?, ?> o, final int n) {
7071
return (Class) NativeImg.class;
7172
}
7273

73-
/**
74-
* Corresponds to org.scijava.Priority.HIGH_PRIORITY
75-
*/
7674
@Override
7775
public double priority() {
78-
return 100;
76+
return Priority.HIGH;
7977
}
8078

8179

0 commit comments

Comments
 (0)