本文整理了Java中net.imglib2.view.Views.interpolate()
方法的一些代码示例,展示了Views.interpolate()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Views.interpolate()
方法的具体详情如下:
包路径:net.imglib2.view.Views
类名称:Views
方法名:interpolate
[英]Returns a RealRandomAccessible using interpolation
[中]返回一个使用插值的实数
代码示例来源:origin: imagej/imagej-ops
@Override
public RealRandomAccessible<T> calculate(I input) {
return Views.interpolate(input, factory);
}
代码示例来源:origin: fiji/Stitching
public ImageInterpolation( final Img< T > image, final InterpolatorFactory< T, RandomAccessible< T > > interpolatorFactory, final boolean mirror )
{
this.image = image;
this.interpolatorFactory = interpolatorFactory;
if ( mirror )
this.interpolated = Views.interpolate( Views.extendMirrorSingle( image ), interpolatorFactory );
else
this.interpolated = Views.interpolate( Views.extendZero( image ), interpolatorFactory );
}
代码示例来源:origin: net.preibisch/multiview-reconstruction
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 );
}
代码示例来源:origin: net.imglib2/imglib2-realtransform
public DeformationFieldTransform( final RandomAccessibleInterval< T > def )
{
this( Views.interpolate( def, new NLinearInterpolatorFactory< T >() ) );
}
代码示例来源:origin: net.imglib2/imglib2-ui
@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;
}
代码示例来源:origin: sc.fiji/bigdataviewer-vistools
@Override
public RealRandomAccessible< T > getInterpolatedSource( final int t, final int level, final Interpolation method )
{
return Views.interpolate( Views.extendZero( getSource( t, level ) ), interpolators.get( method ) );
}
代码示例来源:origin: net.preibisch/multiview-reconstruction
@Override
public RealRandomAccess<FloatType> realRandomAccess( final RealInterval interval )
{
return Views.interpolate(
Views.extendZero( this.contentBasedImg ),
new NLinearInterpolatorFactory< FloatType >()
).realRandomAccess( interval );
}
代码示例来源:origin: net.preibisch/multiview-reconstruction
@Override
public RealRandomAccess<FloatType> realRandomAccess()
{
return Views.interpolate(
Views.extendZero( this.contentBasedImg ),
new NLinearInterpolatorFactory< FloatType >()
).realRandomAccess();
}
代码示例来源:origin: net.preibisch/multiview-reconstruction
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;
}
代码示例来源:origin: net.preibisch/multiview-reconstruction
public static Img< FloatType > extractNN( 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 NearestNeighborInterpolatorFactory<>());
PSFExtraction.extractPSFLocal( rra, locations, psf );
return psf;
}
代码示例来源:origin: net.preibisch/multiview-reconstruction
public RealRandomAccessible< FloatType > getRealRandomAccessible()
{
final NearestNeighborSearch< FloatType > search = new NearestNeighborSearchOnKDTree<>( new KDTree<>( qualityList ) );
return Views.interpolate( search, new NearestNeighborSearchInterpolatorFactory< FloatType >() );
}
代码示例来源:origin: sc.fiji/TrakEM2_
public LinearIntensityMap( final RandomAccessibleInterval< T > source, final InterpolatorFactory< RealComposite< T >, RandomAccessible< RealComposite< T > > > interpolatorFactory )
{
this.interpolatorFactory = interpolatorFactory;
final CompositeIntervalView< T, RealComposite< T > > collapsedSource = Views.collapseReal( source );
dimensions = new FinalInterval( collapsedSource );
final double[] shift = new double[ dimensions.numDimensions() ];
for ( int d = 0; d < shift.length; ++d )
shift[ d ] = 0.5;
translation = new Translation( shift );
final RandomAccessible< RealComposite< T > > extendedCollapsedSource = Views.extendBorder( collapsedSource );
coefficients = Views.interpolate( extendedCollapsedSource, interpolatorFactory );
}
代码示例来源:origin: sc.fiji/bigdataviewer-vistools
public RandomAccessibleSource(
final RandomAccessible< T > img,
final Interval interval,
final T type,
final AffineTransform3D sourceTransform,
final String name )
{
super( type, name );
this.source = img;
this.interval = interval;
this.sourceTransform = sourceTransform;
interpolatedSources = new RealRandomAccessible[ Interpolation.values().length ];
for ( final Interpolation method : Interpolation.values() )
interpolatedSources[ method.ordinal() ] = Views.interpolate( source, interpolators.get( method ) );
}
代码示例来源:origin: imagej/imagej-ops
@Override
public RandomAccessibleInterval<T> calculate(RandomAccessibleInterval<T> input) {
final long[] newDims = Intervals.dimensionsAsLongArray(in());
for (int i = 0; i < Math.min(scaleFactors.length, in().numDimensions()); i++) {
newDims[i] = Math.round(in().dimension(i) * scaleFactors[i]);
}
IntervalView<T> interval = Views.interval(Views.raster(RealViews.affineReal(
Views.interpolate(Views.extendMirrorSingle(input), interpolator),
new Scale(scaleFactors))), new FinalInterval(newDims));
return interval;
}
代码示例来源:origin: net.preibisch/multiview-reconstruction
public RandomAccessibleInterval< FloatType > getRandomAccessibleInterval( final int numPoints, final double power )
{
final KNearestNeighborSearch< FloatType > search = new KNearestNeighborSearchOnKDTree<>( new KDTree<>( qualityList ), numPoints );
final RealRandomAccessible< FloatType > realRandomAccessible = Views.interpolate( search, new InverseDistanceWeightingInterpolatorFactory< FloatType >( power ) );
final RandomAccessible< FloatType > randomAccessible = Views.raster( realRandomAccessible );
final RandomAccessibleInterval< FloatType > rai = Views.interval( randomAccessible, interval );
return Views.interval( Views.extendZero( rai ), interval );
}
代码示例来源:origin: sc.fiji/bigdataviewer-vistools
private void loadTimepoint( final int timepointIndex )
{
currentTimePointIndex = timepointIndex;
if ( isPresent( timepointIndex ) )
{
final T zero = getType().createVariable();
zero.setZero();
currentSource = Views.hyperSlice( source, 3, timepointIndex );
for ( final Interpolation method : Interpolation.values() )
currentInterpolatedSources[ method.ordinal() ] = Views.interpolate( Views.extendValue( currentSource, zero ), interpolators.get( method ) );
}
else
{
currentSource = null;
Arrays.fill( currentInterpolatedSources, null );
}
}
代码示例来源:origin: sc.fiji/bigdataviewer-vistools
private void loadTimepoint( final int timepointIndex )
{
currentTimePointIndex = timepointIndex;
if ( isPresent( timepointIndex ) )
{
final T zero = getType().createVariable();
zero.setZero();
final RandomAccessible< T > slice = Views.hyperSlice( source, 3, timepointIndex );
currentSource = Views.interval( slice, timeSliceInterval );
for ( final Interpolation method : Interpolation.values() )
currentInterpolatedSources[ method.ordinal() ] = Views.interpolate( slice, interpolators.get( method ) );
}
else
{
currentSource = null;
Arrays.fill( currentInterpolatedSources, null );
}
}
代码示例来源:origin: net.preibisch/multiview-reconstruction
public RandomAccessibleInterval< FloatType > getRandomAccessibleInterval()
{
// InverseDistanceWeightingInterpolatorFactory
final NearestNeighborSearch< FloatType > search = new NearestNeighborSearchOnKDTree<>( new KDTree<>( qualityList ) );
final RealRandomAccessible< FloatType > realRandomAccessible = Views.interpolate( search, new NearestNeighborSearchInterpolatorFactory< FloatType >() );
final RandomAccessible< FloatType > randomAccessible = Views.raster( realRandomAccessible );
final RandomAccessibleInterval< FloatType > rai = Views.interval( randomAccessible, interval );
return Views.interval( Views.extendZero( rai ), interval );
}
代码示例来源:origin: sc.fiji/bigdataviewer-vistools
public RandomAccessibleIntervalSource(
final RandomAccessibleInterval< T > img,
final T type,
final AffineTransform3D sourceTransform,
final String name )
{
super( type, name );
this.source = img;
this.sourceTransform = sourceTransform;
interpolatedSources = new RealRandomAccessible[ Interpolation.values().length ];
final T zero = getType().createVariable();
zero.setZero();
for ( final Interpolation method : Interpolation.values() )
interpolatedSources[ method.ordinal() ] = Views.interpolate( Views.extendValue( source, zero ), interpolators.get( method ) );
}
代码示例来源:origin: imagej/imagej-ops
@Test
public void defaultInterpolateTest() {
Img<DoubleType> img = new ArrayImgFactory<DoubleType>().create(new int[]{10, 10}, new DoubleType());
MersenneTwisterFast r = new MersenneTwisterFast(SEED);
for (DoubleType d : img) {
d.set(r.nextDouble());
}
RealRandomAccess<DoubleType> il2 = Views.interpolate(img, new FloorInterpolatorFactory<DoubleType>()).realRandomAccess();
RealRandomAccess<DoubleType> opr = ops.transform().interpolateView(img, new FloorInterpolatorFactory<DoubleType>()).realRandomAccess();
il2.setPosition(new double[]{1.75, 5.34});
opr.setPosition(new double[]{1.75, 5.34});
assertEquals(il2.get().get(), opr.get().get(), 1e-10);
il2.setPosition(new double[]{3, 7});
opr.setPosition(new double[]{3, 7});
assertEquals(il2.get().get(), opr.get().get(), 1e-10);
il2.setPosition(new double[]{8.37, 3.97});
opr.setPosition(new double[]{8.37, 3.97});
assertEquals(il2.get().get(), opr.get().get(), 1e-10);
}
}
内容来源于网络,如有侵权,请联系作者删除!