@Override public RandomAccessibleInterval< T > calculate( final List< ? extends RandomAccessibleInterval< T > > input ) { return Views.concatenate( concatenationAxis, stackAccessMode, input ); }
@Override public RandomAccessibleInterval< T > calculate( final List< ? extends RandomAccessibleInterval< T > > input ) { return Views.concatenate( concatenationAxis, input ); }
/** * Concatenate a list of {@link RandomAccessibleInterval} along the provided * <code>concatenationAxis</code>. The random access behaves as defined by * {@link StackView.StackAccessMode#DEFAULT}. * * @param concatenationAxis * Concatenate along this axis. * @param sources * {@link RandomAccessibleInterval}s to be concatenated. * @return {@link RandomAccessibleInterval} of concatenated sources. */ public static < T > RandomAccessibleInterval< T > concatenate( final int concatenationAxis, final List< ? extends RandomAccessibleInterval< T > > sources ) { return concatenate( concatenationAxis, StackView.StackAccessMode.DEFAULT, sources ); }
/** * Concatenate a list of {@link RandomAccessibleInterval} along the provided * <code>concatenationAxis</code>. The random access behaves as defined by * {@link StackView.StackAccessMode#DEFAULT}. * * @param concatenationAxis * Concatenate along this axis. * @param sources * {@link RandomAccessibleInterval}s to be concatenated. * @return {@link RandomAccessibleInterval} of concatenated sources. */ public static < T > RandomAccessibleInterval< T > concatenate( final int concatenationAxis, final List< ? extends RandomAccessibleInterval< T > > sources ) { return concatenate( concatenationAxis, StackView.StackAccessMode.DEFAULT, sources ); }
/** * * Concatenate an array of {@link RandomAccessibleInterval} along the * provided <code>concatenationAxis</code>. The random access behaves as * defined by {@link StackView.StackAccessMode#DEFAULT}. * * @param concatenationAxis * Concatenate along this axis. * @param sources * {@link RandomAccessibleInterval}s to be concatenated. * @return {@link RandomAccessibleInterval} of concatenated sources. */ @SafeVarargs public static < T > RandomAccessibleInterval< T > concatenate( final int concatenationAxis, final RandomAccessibleInterval< T >... sources ) { return concatenate( concatenationAxis, StackView.StackAccessMode.DEFAULT, sources ); }
/** * * Concatenate an array of {@link RandomAccessibleInterval} along the * provided <code>concatenationAxis</code>. The random access behaves as * defined by {@link StackView.StackAccessMode#DEFAULT}. * * @param concatenationAxis * Concatenate along this axis. * @param sources * {@link RandomAccessibleInterval}s to be concatenated. * @return {@link RandomAccessibleInterval} of concatenated sources. */ @SafeVarargs public static < T > RandomAccessibleInterval< T > concatenate( final int concatenationAxis, final RandomAccessibleInterval< T >... sources ) { return concatenate( concatenationAxis, StackView.StackAccessMode.DEFAULT, sources ); }
/** * Concatenate an array of {@link RandomAccessibleInterval} along the * provided <code>concatenationAxis</code>. See * {@link StackView.StackAccessMode} for behaviors of {@link RandomAccess}. * * @param concatenationAxis * Concatenate along this axis. * @param mode * Defines how random accesses are moved. See * {@link StackView.StackAccessMode} for behaviors of * {@link RandomAccess}. * @param sources * {@link RandomAccessibleInterval}s to be concatenated. * @return {@link RandomAccessibleInterval} of concatenated sources. */ @SafeVarargs public static < T > RandomAccessibleInterval< T > concatenate( final int concatenationAxis, final StackView.StackAccessMode mode, final RandomAccessibleInterval< T >... sources ) { return concatenate( concatenationAxis, mode, Arrays.asList( sources ) ); }
/** * Concatenate an array of {@link RandomAccessibleInterval} along the * provided <code>concatenationAxis</code>. See * {@link StackView.StackAccessMode} for behaviors of {@link RandomAccess}. * * @param concatenationAxis * Concatenate along this axis. * @param mode * Defines how random accesses are moved. See * {@link StackView.StackAccessMode} for behaviors of * {@link RandomAccess}. * @param sources * {@link RandomAccessibleInterval}s to be concatenated. * @return {@link RandomAccessibleInterval} of concatenated sources. */ @SafeVarargs public static < T > RandomAccessibleInterval< T > concatenate( final int concatenationAxis, final StackView.StackAccessMode mode, final RandomAccessibleInterval< T >... sources ) { return concatenate( concatenationAxis, mode, Arrays.asList( sources ) ); }
private static void testConcatenateImpl( long[] dim, int axis, long divider ) { // setup final Img< ByteType > img = createRandomImage( dim ); final List< RandomAccessibleInterval< ByteType > > parts = splitImage( img, axis, divider ); // process final RandomAccessibleInterval< ByteType > concatenated = Views.concatenate( axis, parts ); // test assertImageEquals( img, concatenated ); }
@Test public void defaultConcatenateTest() { final List< RandomAccessibleInterval< ByteType > > intervals = createIntervals( img, divider, axis ); final RandomAccessibleInterval< ByteType > cat1 = Views.concatenate( axis, intervals ); final RandomAccessibleInterval< ByteType > cat2 = ops.transform().concatenateView( intervals, axis ); testEqual( cat1, cat2 ); }
@Test public void testConcatenateSimple() { // setup Img<ByteType> a = ArrayImgs.bytes( new byte[]{ 1, 2, 3, 4 }, 2, 2 ); Img<ByteType> b = ArrayImgs.bytes( new byte[]{ 7, 8 }, 1, 2 ); Img<ByteType> expected = ArrayImgs.bytes( new byte[]{ 1, 2, 7, 3, 4, 8 }, 3, 2 ); // process RandomAccessibleInterval< ByteType > result = Views.concatenate( 0, a, b ); // test assertImageEquals( expected, result ); }
@Test public void concatenateWithAccessModeTest() { final List< RandomAccessibleInterval< ByteType > > intervals = createIntervals( img, divider, axis ); for ( final StackAccessMode mode : StackAccessMode.values() ) { final RandomAccessibleInterval< ByteType > cat1 = Views.concatenate( axis, mode, intervals ); final RandomAccessibleInterval< ByteType > cat2 = ops.transform().concatenateView( intervals, axis, mode ); testEqual( cat1, cat2 ); } }