@Override public CompositeIntervalView<T, NumericComposite<T>> calculate(RandomAccessibleInterval<T> input) { return Views.collapseNumeric(input); }
@Override public CompositeView<T, NumericComposite<T>> calculate(RandomAccessible<T> input) { return Views.collapseNumeric(input, numChannels); } }
/** * Compose a list of same {@link Interval} and same {@link NumericType} A * {@link RandomAccessibleInterval RandomAccessibleIntervals} into a * {@link RandomAccessibleInterval} of some target {@link Type} B using a * {@link Converter} from {@link Composite} of A to B. * * @param components * @param composer * @param targetType * @return */ final static public < A extends NumericType< A >, B extends Type< B > > RandomAccessibleInterval< B > composeNumeric( final List< RandomAccessibleInterval< A > > components, final Converter< NumericComposite< A >, B > composer, final B targetType ) { return convert( Views.collapseNumeric( Views.stack( components ) ), composer, targetType ); }
/** * Compose a list of same {@link Interval} and same {@link NumericType} A * {@link RandomAccessibleInterval RandomAccessibleIntervals} into a * {@link RandomAccessibleInterval} of some target {@link Type} B using a * {@link Converter} from {@link Composite} of A to B. * * @param components * @param composer * @param targetType * @return */ final static public < A extends NumericType< A >, B extends Type< B > > RandomAccessibleInterval< B > composeNumeric( final List< RandomAccessibleInterval< A > > components, final Converter< NumericComposite< A >, B > composer, final B targetType ) { return convert( Views.collapseNumeric( Views.stack( components ) ), composer, targetType ); }
private static < T extends RealType< T >, U extends ComplexType< U > > RandomAccessibleInterval< U > calculateEigenValuesImpl( final RandomAccessibleInterval< T > tensor, final RandomAccessibleInterval< U > eigenvalues, final EigenValues< T, U > ev ) { final Cursor< RealComposite< T > > m = Views.iterable( Views.collapseReal( tensor ) ).cursor(); final Cursor< NumericComposite< U > > e = Views.iterable( Views.collapseNumeric( eigenvalues ) ).cursor(); while ( m.hasNext() ) ev.compute( m.next(), e.next() ); return eigenvalues; }
@Test public void defaultCollapseNumericTest() { Img<NativeARGBDoubleType> img = new ArrayImgFactory<NativeARGBDoubleType>().create(new int[] { 10, 10 }, new NativeARGBDoubleType()); CompositeIntervalView<NativeARGBDoubleType, NumericComposite<NativeARGBDoubleType>> il2 = Views .collapseNumeric((RandomAccessibleInterval<NativeARGBDoubleType>) img); CompositeIntervalView<NativeARGBDoubleType, NumericComposite<NativeARGBDoubleType>> opr = ops.transform() .collapseNumericView((RandomAccessibleInterval<NativeARGBDoubleType>) img); assertEquals(il2.numDimensions(), opr.numDimensions()); CompositeView<NativeARGBDoubleType, NumericComposite<NativeARGBDoubleType>> il2_2 = Views .collapseNumeric((RandomAccessible<NativeARGBDoubleType>) img, 1); CompositeView<NativeARGBDoubleType, NumericComposite<NativeARGBDoubleType>> opr_2 = ops.transform() .collapseNumericView((RandomAccessible<NativeARGBDoubleType>) img, 1); assertEquals(il2_2.numDimensions(), opr_2.numDimensions()); }