3232import static org .junit .Assert .assertEquals ;
3333import static org .junit .Assert .assertNotNull ;
3434
35- import java .util .function .BiFunction ;
36-
3735import net .imagej .ops .AbstractOpTest ;
3836import net .imglib2 .Cursor ;
39- import net .imglib2 .Dimensions ;
4037import net .imglib2 .FinalDimensions ;
4138import net .imglib2 .FinalInterval ;
4239import net .imglib2 .RandomAccess ;
5148
5249import org .junit .Before ;
5350import org .junit .Test ;
54- import org .scijava .ops .core .builder .OpBuilder ;
5551import org .scijava .ops .function .Computers ;
56- import org .scijava .ops .function .Functions ;
5752import org .scijava .ops .types .Nil ;
5853import org .scijava .util .MersenneTwisterFast ;
5954
@@ -92,10 +87,8 @@ public void createData() {
9287 final long [] start = new long [] { 16 , 16 , 16 };
9388 final long [] end = new long [] { 47 , 47 , 47 };
9489
95- // create an input with a cube at the center TODO can we use ops.run() here?
96- BiFunction <Dimensions , UnsignedByteType , Img <UnsignedByteType >> imgOp = Functions .match (ops , "create.img" ,
97- new Nil <Dimensions >() {}, new Nil <UnsignedByteType >() {}, new Nil <Img <UnsignedByteType >>() {});
98- input2 = imgOp .apply (new FinalDimensions (size1 ), new UnsignedByteType ());
90+ input2 = op ("create.img" ).input (new FinalDimensions (size1 ), new UnsignedByteType ())
91+ .outType (new Nil <Img <UnsignedByteType >>() {}).apply ();
9992
10093 // create the same input but force it to be a planar image
10194 inputPlanar = op ("create.img" )
@@ -140,7 +133,7 @@ public void copyRAINoOutputTest() {
140133 public void copyRAIWithOutputTest () {
141134 final Img <UnsignedByteType > output = input .factory ().create (input , input .firstElement ());
142135
143- op ("copy.rai" ).input (input , output ). apply ();
136+ op ("copy.rai" ).input (input ). output ( output ). compute ();
144137
145138 final Cursor <UnsignedByteType > inc = input .cursor ();
146139 final Cursor <UnsignedByteType > outc = output .cursor ();
@@ -151,7 +144,6 @@ public void copyRAIWithOutputTest() {
151144 }
152145
153146 @ Test
154- @ SuppressWarnings ({ "unchecked" , "rawtypes" })
155147 public void copyRAIDifferentSizeTest () {
156148
157149 // create a copy op
@@ -161,8 +153,7 @@ public void copyRAIDifferentSizeTest() {
161153
162154 assertNotNull (copy );
163155
164- final Img <UnsignedByteType > out = op ("create.img" )
165- .input (new FinalDimensions (size2 ), new UnsignedByteType ()) //
156+ final Img <UnsignedByteType > out = op ("create.img" ).input (new FinalDimensions (size2 ), new UnsignedByteType ()) //
166157 .outType (new Nil <Img <UnsignedByteType >>() {}) //
167158 .apply ();
168159
@@ -173,8 +164,9 @@ public void copyRAIDifferentSizeTest() {
173164 assertEquals (sum .getRealDouble (), 100.0 , delta );
174165
175166 // also try with a planar image
176- final Img <UnsignedByteType > outFromPlanar = (Img <UnsignedByteType >) ops .run ("create.img" ,
177- new FinalDimensions (size2 ), new UnsignedByteType ());
167+ final Img <UnsignedByteType > outFromPlanar = op ("create.img" )
168+ .input (new FinalDimensions (size2 ), new UnsignedByteType ()).outType (new Nil <Img <UnsignedByteType >>() {})
169+ .apply ();
178170
179171 copy .compute (viewPlanar , outFromPlanar );
180172 DoubleType sumFromPlanar = new DoubleType ();
0 commit comments