2727 * #L%
2828 */
2929
30- package net .imagej .ops2 .transform .realTransform ;
30+ package net .imagej .ops2 .transform ;
31+
32+ import org .scijava .function .Functions ;
33+ import org .scijava .ops .spi .Optional ;
3134
3235import net .imglib2 .FinalInterval ;
3336import net .imglib2 .Interval ;
3942import net .imglib2 .realtransform .RealViews ;
4043import net .imglib2 .type .numeric .NumericType ;
4144import net .imglib2 .type .numeric .RealType ;
42- import net .imglib2 .view .IntervalView ;
4345import net .imglib2 .view .Views ;
4446
45- import org .scijava .Priority ;
46- import org .scijava .ops .core .Op ;
47- import org .scijava .ops .function .Functions ;
48- import org .scijava .param .Parameter ;
49- import org .scijava .plugin .Plugin ;
50- import org .scijava .struct .ItemIO ;
51-
5247/**
5348 * Applies an Affine transform to a {@link RandomAccessibleInterval}
5449 *
5550 * @author Brian Northan (True North Intelligent Algorithms)
5651 * @author Martin Horn (University of Konstanz)
5752 * @author Stefan Helfrich (University of Konstanz)
53+ * @implNote op names="transform.realTransform", priority="101.0"
5854 */
59- @ Plugin (type = Op .class , name = "transform.realTransform" ,
60- priority = Priority .HIGH + 1 )
61- @ Parameter (key = "input" )
62- @ Parameter (key = "transform" )
63- @ Parameter (key = "outputInterval" )
64- @ Parameter (key = "interpolator" )
65- @ Parameter (key = "output" , itemIO = ItemIO .OUTPUT )
6655public class DefaultTransformView <T extends NumericType <T > & RealType <T >>
6756 implements
6857 Functions .Arity4 <RandomAccessibleInterval <T >, InvertibleRealTransform , Interval , InterpolatorFactory <T , RandomAccessible <T >>, RandomAccessibleInterval <T >>
@@ -72,7 +61,7 @@ public class DefaultTransformView<T extends NumericType<T> & RealType<T>>
7261 * TODO: declare {@code outputInterval}, {@code interpolator} as optional once
7362 * <a href=https://github.com/scijava/incubator/pull/32>this issue</a> has
7463 * been resolved. Until then, this op <b>must</b> be called as a
75- * {@link org.scijava.ops.function. Functions.Arity4}
64+ * {@link Functions.Arity4}
7665 *
7766 * @param input the input
7867 * @param transform the transform to apply
@@ -82,10 +71,12 @@ public class DefaultTransformView<T extends NumericType<T> & RealType<T>>
8271 * @return the output
8372 */
8473 @ Override
85- public RandomAccessibleInterval <T > apply (RandomAccessibleInterval <T > input ,
86- InvertibleRealTransform transform , Interval outputInterval ,
87- InterpolatorFactory <T , RandomAccessible <T >> interpolator )
88- {
74+ public RandomAccessibleInterval <T > apply ( //
75+ RandomAccessibleInterval <T > input , //
76+ InvertibleRealTransform transform , //
77+ @ Optional Interval outputInterval , //
78+ @ Optional InterpolatorFactory <T , RandomAccessible <T >> interpolator //
79+ ) {
8980 if (outputInterval == null ) {
9081 outputInterval = new FinalInterval (input );
9182 }
@@ -94,11 +85,11 @@ public RandomAccessibleInterval<T> apply(RandomAccessibleInterval<T> input,
9485 interpolator = new LanczosInterpolatorFactory <>();
9586 }
9687
97- final IntervalView < T > interval = Views .interval ( Views . raster ( RealViews
98- . transformReal ( Views .interpolate (Views . extendZero ( input ) , interpolator ),
99- transform )), outputInterval );
100-
101- return interval ;
88+ var extended = Views .extendZero ( input );
89+ var interpolated = Views .interpolate (extended , interpolator );
90+ var transformed = RealViews . transformReal ( interpolated , transform );
91+ var rasterized = Views . raster ( transformed );
92+ return Views . interval ( rasterized , outputInterval ) ;
10293 }
10394
10495}
0 commit comments