public void setLinearInterpolation() { this.interpolatorFactory = new NLinearInterpolatorFactory< FloatType >(); }
/** * For now, ignore the {@link RealInterval} and return * {@link #create(RandomAccessible)}. */ @Override public NLinearInterpolator< T > create( final RandomAccessible< T > randomAccessible, final RealInterval interval ) { return create( randomAccessible ); } }
shiftback[ d ] = min[ d ] - max[ d ]; final NLinearInterpolatorFactory< T > interpolatorFactory = new NLinearInterpolatorFactory< T >(); @SuppressWarnings( "unchecked" ) final RealRandomAccess< T >[] gradientAccess = new RealRandomAccess[ n ]; for ( int d = 0; d < n; ++d ) gradientAccess[ d ] = interpolatorFactory.create( Views.hyperSlice( gradients, n, d ) );
shiftback[ d ] = min[ d ] - max[ d ]; final NLinearInterpolatorFactory< T > interpolatorFactory = new NLinearInterpolatorFactory< T >(); @SuppressWarnings( "unchecked" ) final RealRandomAccess< T >[] gradientAccess = new RealRandomAccess[ n ]; for ( int d = 0; d < n; ++d ) gradientAccess[ d ] = interpolatorFactory.create( Views.hyperSlice( gradients, n, d ) );
public LinearIntensityMap( final RandomAccessibleInterval< T > source ) { this( source, new NLinearInterpolatorFactory< RealComposite< T > >() ); }
/** * For now, ignore the {@link RealInterval} and return * {@link #create(RandomAccessible)}. */ @Override public NLinearInterpolator< T > create( final RandomAccessible< T > randomAccessible, final RealInterval interval ) { return create( randomAccessible ); } }
final static private < T extends RealType< T > >InterpolatorFactory< RealComposite< T >, RandomAccessible< RealComposite< T > > > interpolatorFactory( final Interpolation interpolation ) { switch ( interpolation ) { case NN: return new NearestNeighborInterpolatorFactory< RealComposite< T > >(); default: return new NLinearInterpolatorFactory< RealComposite< T > >(); } }
protected static < T extends RealType< T > & NativeType< T > > CompositeImage createOverlay( final T targetType, final ImagePlus imp1, final ImagePlus imp2, final InvertibleBoundable finalModel1, final InvertibleBoundable finalModel2, final int dimensionality ) { final ArrayList< ImagePlus > images = new ArrayList<ImagePlus>(); images.add( imp1 ); images.add( imp2 ); final ArrayList< InvertibleBoundable > models = new ArrayList<InvertibleBoundable>(); models.add( finalModel1 ); models.add( finalModel2 ); return createOverlay( targetType, images, models, dimensionality, 1, new NLinearInterpolatorFactory<FloatType>() ); }
public PSFExtraction( final RandomAccessible< T > img, final Collection< RealLocalizable > locations, final T type, final long[] size, final boolean multithreaded ) { this( Views.interpolate( img, new NLinearInterpolatorFactory< T >() ), locations, type, size, multithreaded ); }
public DeformationFieldTransform( final RandomAccessibleInterval< T > def ) { this( Views.interpolate( def, new NLinearInterpolatorFactory< T >() ) ); }
@Override public RealRandomAccess<FloatType> realRandomAccess( final RealInterval interval ) { return Views.interpolate( Views.extendZero( this.contentBasedImg ), new NLinearInterpolatorFactory< FloatType >() ).realRandomAccess( interval ); }
@Override public RealRandomAccess<FloatType> realRandomAccess() { return Views.interpolate( Views.extendZero( this.contentBasedImg ), new NLinearInterpolatorFactory< FloatType >() ).realRandomAccess(); }
public static Img< FloatType > extractLI( final Img< FloatType > img, final long[] dim, final double[] center ) { final Img< FloatType > psf = new ArrayImgFactory< FloatType >().create( dim, new FloatType() ); final ArrayList< RealLocalizable > locations = new ArrayList<>(); locations.add( new RealPoint( center ) ); //locations.add( new RealPoint( new double[] { i.dimension( 0 ) / 2, i.dimension( 1 ) / 2, i.dimension( 2 ) / 2 } ) ); final RealRandomAccessible< FloatType > rra = Views.interpolate( Views.extendMirrorSingle( img ), new NLinearInterpolatorFactory<>() ); PSFExtraction.extractPSFLocal( rra, locations, psf ); return psf; }
@SuppressWarnings( { "unchecked", "rawtypes" } ) public InterpolatingSource( final RandomAccessible< T > source, final A sourceTransform, final Converter< ? super T, ARGBType > converter ) { final InterpolatorFactory< T, RandomAccessible< T > > nLinearInterpolatorFactory; if ( ARGBType.class.isInstance( source.randomAccess().get() ) ) nLinearInterpolatorFactory = ( InterpolatorFactory ) new NLinearInterpolatorARGBFactory(); else nLinearInterpolatorFactory = new NLinearInterpolatorFactory< >(); this.sourceTransform = sourceTransform; this.converter = converter; sourceInterpolants = new RealRandomAccessible[] { Views.interpolate( source, new NearestNeighborInterpolatorFactory< T >() ), Views.interpolate( source, nLinearInterpolatorFactory ) }; interpolation = 0; }
@SuppressWarnings({ "unused", "unchecked" }) @Test public void testOutOfBoundsFactoryIsNull() { Img<ByteType> in = generateByteArrayTestImg(true, new long[] { 10, 10 }); double[] scaleFactors = new double[] { 2, 2 }; NLinearInterpolatorFactory<ByteType> nLinearInterpolatorFactory = new NLinearInterpolatorFactory<ByteType>(); RandomAccessibleInterval<ByteType> out = (RandomAccessibleInterval<ByteType>) ops.run(DefaultScaleView.class, in, scaleFactors, nLinearInterpolatorFactory, null); }
@Test(expected = IllegalArgumentException.class) public void testContingency() { Img<ByteType> in = generateByteArrayTestImg(true, new long[] { 10, 10 }); double[] scaleFactors = new double[] { 2, 2, 2 }; ops.run(DefaultScaleView.class, in, scaleFactors, new NLinearInterpolatorFactory<ByteType>()); } }
switch (mode) { case LINEAR: inter = new NLinearInterpolatorFactory<R>(); break; case NEAREST_NEIGHBOR:
switch (mode) { case LINEAR: ifac = new NLinearInterpolatorFactory<T>(); break; case NEAREST_NEIGHBOR:
factory = new NLinearInterpolatorFactory<FloatType>(); else factory = new NearestNeighborInterpolatorFactory< FloatType >();
public static Img< FloatType > downSample2x( final RandomAccessibleInterval< FloatType > randomAccessible ) { final long[] dim = new long[ randomAccessible.numDimensions() ]; for ( int d = 0; d < dim.length; ++d ) dim[ d ] = randomAccessible.dimension( d ) / 2 - 1; final Img< FloatType > img = new ArrayImgFactory< FloatType >().create( dim, new FloatType() ); final NLinearInterpolatorFactory< FloatType > factory = new NLinearInterpolatorFactory< FloatType >(); final RealRandomAccessible< FloatType > interpolant = Views.interpolate( Views.extendMirrorSingle( randomAccessible ), factory ); final RealRandomAccess< FloatType > realRandomAccess = interpolant.realRandomAccess(); final Cursor< FloatType > c = img.localizingCursor(); final int[] l = new int[ img.numDimensions() ]; final double[] lf = new double[ img.numDimensions() ]; while ( c.hasNext() ) { c.fwd(); c.localize( l ); for ( int d = 0; d < dim.length; ++d ) lf[ d ] = l[ d ]*2.0 + 0.5; realRandomAccess.setPosition( lf ); c.get().set( realRandomAccess.get() ); } return img; }