本文整理汇总了Java中net.imglib2.interpolation.randomaccess.NearestNeighborInterpolatorFactory类的典型用法代码示例。如果您正苦于以下问题:Java NearestNeighborInterpolatorFactory类的具体用法?Java NearestNeighborInterpolatorFactory怎么用?Java NearestNeighborInterpolatorFactory使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
NearestNeighborInterpolatorFactory类属于net.imglib2.interpolation.randomaccess包,在下文中一共展示了NearestNeighborInterpolatorFactory类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: render
import net.imglib2.interpolation.randomaccess.NearestNeighborInterpolatorFactory; //导入依赖的package包/类
public static < T extends Type< T > > void render( final RealRandomAccessible< T > source, final RandomAccessibleInterval< T > target, final RealTransform transform, final double dx )
{
final RealRandomAccessible< T > interpolant = Views.interpolate( Views.extendBorder( target ), new NearestNeighborInterpolatorFactory< T >() );
final RealRandomAccess< T > a = source.realRandomAccess();
final RealRandomAccess< T > b = interpolant.realRandomAccess();
for ( double y = 0; y < target.dimension( 1 ); y += dx )
{
a.setPosition( y, 1 );
for ( double x = 0; x < target.dimension( 0 ); x += dx )
{
a.setPosition( x, 0 );
transform.apply( a, b );
b.get().set( a.get() );
}
}
}
开发者ID:saalfeldlab,项目名称:z-spacing,代码行数:19,代码来源:LUTRealTransform.java
示例2: getInterpolatedSource
import net.imglib2.interpolation.randomaccess.NearestNeighborInterpolatorFactory; //导入依赖的package包/类
@Override
public RealRandomAccessible< T > getInterpolatedSource( final int t, final int level, final Interpolation method )
{
InterpolatorFactory< T, RandomAccessible< T >> factory;
switch ( method )
{
default:
case NEARESTNEIGHBOR:
factory = new NearestNeighborInterpolatorFactory< T >();
break;
case NLINEAR:
factory = new NLinearInterpolatorFactory< T >();
break;
}
final T zero = img.firstElement().createVariable();
zero.setZero();
return Views.interpolate( Views.extendValue( getSource( t, level ), zero ), factory );
}
开发者ID:fiji,项目名称:MaMuT,代码行数:19,代码来源:ImgPlusSource.java
示例3: upsample
import net.imglib2.interpolation.randomaccess.NearestNeighborInterpolatorFactory; //导入依赖的package包/类
public static <T extends RealType<T> & NativeType<T>> Img<T> upsample(Img<T> input, long[] out_size, Interpolator interpType){
int nDim = input.numDimensions();
if(nDim != out_size.length){
return input;
}
long[] in_size = new long[nDim];
input.dimensions(in_size);
float[] upfactor = new float[nDim];
for(int i=0; i<nDim; i++){
upfactor[i] = (float)out_size[i]/in_size[i];
}
RealRandomAccess< T > interpolant;
switch(interpType){
case Linear:
NLinearInterpolatorFactory<T> NLinterp_factory = new NLinearInterpolatorFactory<T>();
interpolant = Views.interpolate( Views.extendBorder( input ), NLinterp_factory ).realRandomAccess();
break;
case Lanczos:
LanczosInterpolatorFactory<T> LanczosInterp_factory = new LanczosInterpolatorFactory<T>();
interpolant = Views.interpolate( Views.extendBorder( input ), LanczosInterp_factory ).realRandomAccess();
break;
default: // NearestNeighbor:
NearestNeighborInterpolatorFactory<T> NNInterp_factory = new NearestNeighborInterpolatorFactory<T>();
interpolant = Views.interpolate( Views.extendBorder( input ), NNInterp_factory ).realRandomAccess();
break;
}
final ImgFactory< T > imgFactory = new ArrayImgFactory< T >();
final Img< T > output = imgFactory.create( out_size , input.firstElement().createVariable() );
Cursor< T > out_cursor = output.localizingCursor();
float[] tmp = new float[2];
while(out_cursor.hasNext()){
out_cursor.fwd();
for ( int d = 0; d < nDim; ++d )
tmp[ d ] = out_cursor.getFloatPosition(d) /upfactor[d];
interpolant.setPosition(tmp);
out_cursor.get().setReal( Math.round( interpolant.get().getRealFloat() ) );
}
return output;
}
开发者ID:mpicbg-scicomp,项目名称:Interactive-H-Watershed,代码行数:40,代码来源:Utils.java
示例4: fillMask
import net.imglib2.interpolation.randomaccess.NearestNeighborInterpolatorFactory; //导入依赖的package包/类
private < T extends BooleanType< T > > GrowingStoreRandomAccessibleSingletonAccess< T > fillMask( final AffineTransform3D tf, final long[] initialMin, final long[] initialMax, final Point p, final GrowingStoreRandomAccessibleSingletonAccess.Factory< T > factory, final T notVisited, final T fillLabel )
{
final GrowingStoreRandomAccessibleSingletonAccess< T > tmpFill = new GrowingStoreRandomAccessibleSingletonAccess<>( initialMin, initialMax, factory, notVisited.createVariable() );
final AccessBoxRandomAccessible< LongType > accessTrackingExtendedPaintedLabels = new AccessBoxRandomAccessible<>(
Views.extendValue(
paintedLabels,
new LongType( Label.TRANSPARENT ) ) );
final AffineRandomAccessible< LongType, AffineGet > transformedPaintedLabels =
RealViews.affine(
Views.interpolate(
accessTrackingExtendedPaintedLabels,
new NearestNeighborInterpolatorFactory<>() ),
tf );
final MixedTransformView< LongType > hyperSlice = Views.hyperSlice( Views.raster( transformedPaintedLabels ), 2, 0 );
final AffineRandomAccessible< LabelMultisetType, AffineGet > transformedLabels = RealViews.affine( Views.interpolate( Views.extendValue( labels, new LabelMultisetType() ), new NearestNeighborInterpolatorFactory<>() ), tf );
final MixedTransformView< LabelMultisetType > hyperSliceLabels = Views.hyperSlice( Views.raster( transformedLabels ), 2, 0 );
final RandomAccessiblePair< LabelMultisetType, LongType > labelsPaintedLabelsPair = new RandomAccessiblePair<>( hyperSliceLabels, hyperSlice );
final RandomAccessiblePair< LabelMultisetType, LongType >.RandomAccess pairAccess = labelsPaintedLabelsPair.randomAccess();
pairAccess.setPosition( p );
final long seedPaint = pairAccess.get().getB().getIntegerLong();
final long seedFragmentLabel = getBiggestLabel( pairAccess.getA() );
FloodFill.fill( labelsPaintedLabelsPair, tmpFill, p, new ValuePair< LabelMultisetType, LongType >( new LabelMultisetType(), new LongType( selectionController.getActiveFragmentId() ) ), fillLabel, new DiamondShape( 1 ), new SegmentAndPaintFilter2D< T >( seedPaint, seedFragmentLabel, assignment ), new TypeWriter<>() );
dirtyLabelsInterval.touch( accessTrackingExtendedPaintedLabels.createAccessInterval() );
return tmpFill;
}
开发者ID:saalfeldlab,项目名称:bigcat,代码行数:34,代码来源:LabelFillController.java
示例5: writeMask
import net.imglib2.interpolation.randomaccess.NearestNeighborInterpolatorFactory; //导入依赖的package包/类
private void writeMask( final GrowingStoreRandomAccessibleSingletonAccess< BitType > tmpFill, final AffineTransform3D tf, final long label )
{
final IntervalView< BitType > tmpFillInterval = Views.interval( tmpFill, tmpFill.getIntervalOfSizeOfStore() );
final AccessBoxRandomAccessible< LongType > accessTrackingExtendedPaintedLabels = new AccessBoxRandomAccessible<>(
Views.extendValue(
paintedLabels,
new LongType( Label.TRANSPARENT ) ) );
final AffineRandomAccessible< LongType, AffineGet > transformedPaintedLabels =
RealViews.affine(
Views.interpolate(
accessTrackingExtendedPaintedLabels,
new NearestNeighborInterpolatorFactory<>() ),
tf );
final MixedTransformView< LongType > hyperSlice = Views.hyperSlice( Views.raster( transformedPaintedLabels ), 2, 0 );
final net.imglib2.Cursor< BitType > s = tmpFillInterval.cursor();
final net.imglib2.Cursor< LongType > t = Views.interval( hyperSlice, tmpFillInterval ).cursor();
while ( s.hasNext() )
{
t.fwd();
if ( s.next().get() )
t.get().set( label );
}
dirtyLabelsInterval.touch( accessTrackingExtendedPaintedLabels.createAccessInterval() );
}
开发者ID:saalfeldlab,项目名称:bigcat,代码行数:28,代码来源:LabelFillController.java
示例6: processReal
import net.imglib2.interpolation.randomaccess.NearestNeighborInterpolatorFactory; //导入依赖的package包/类
static private final <T extends RealType<T>> Img<T> processReal(final Img<T> img, final long[] dim, final Mode mode) throws Exception {
final Img<T> res = img.factory().create(dim, img.firstElement().createVariable());
InterpolatorFactory<T,RandomAccessible<T>> ifac;
switch (mode) {
case LINEAR:
ifac = new NLinearInterpolatorFactory<T>();
break;
case NEAREST_NEIGHBOR:
ifac = new NearestNeighborInterpolatorFactory<T>();
break;
default:
throw new Exception("Resample: unknown mode!");
}
final RealRandomAccess<T> inter = ifac.create(Views.extend(img, new OutOfBoundsMirrorFactory<T,Img<T>>(OutOfBoundsMirrorFactory.Boundary.SINGLE)));
final Cursor<T> c2 = res.localizingCursor();
final float[] s = new float[dim.length];
for (int i=0; i<s.length; i++) s[i] = (float)img.dimension(i) / dim[i];
final long[] d = new long[dim.length];
final float[] p = new float[dim.length];
while (c2.hasNext()) {
c2.fwd();
c2.localize(d); // TODO "localize" seems to indicate the opposite of what it does
for (int i=0; i<d.length; i++) p[i] = d[i] * s[i];
inter.move(p);
c2.get().set(inter.get());
}
return res;
}
开发者ID:imglib,项目名称:imglib2-script,代码行数:32,代码来源:Resample.java
示例7: getInterpolatorFactory
import net.imglib2.interpolation.randomaccess.NearestNeighborInterpolatorFactory; //导入依赖的package包/类
public < T extends RealType< T > > InterpolatorFactory< T, RandomAccessible< T > > getInterpolatorFactory( final T type )
{
if ( getInterpolation() == 0 )
return new NearestNeighborInterpolatorFactory<T>();
else
return new NLinearInterpolatorFactory< T >();
}
开发者ID:fiji,项目名称:SPIM_Registration,代码行数:8,代码来源:WeightedAverageFusion.java
示例8: setDoubleTypeScreenImage
import net.imglib2.interpolation.randomaccess.NearestNeighborInterpolatorFactory; //导入依赖的package包/类
private void setDoubleTypeScreenImage(final IntervalView< DoubleType > viewImg ) {
final DoubleType min = new DoubleType();
final DoubleType max = new DoubleType();
computeMinMax( viewImg, min, max );
final RealRandomAccessible< DoubleType > interpolated =
Views.interpolate( Views.extendZero( viewImg ), new NearestNeighborInterpolatorFactory< DoubleType >() );
//final RealARGBConverter< DoubleType > converter = new RealARGBConverter< DoubleType >( min.get(), max.get() );
final LUTConverter< DoubleType > converter = new LUTConverter< DoubleType >( min.getMinValue(), max.getMaxValue(), ColorTables.FIRE);
updateDoubleTypeSourceAndConverter( interpolated, converter );
}
开发者ID:fjug,项目名称:IDDEA,代码行数:14,代码来源:InteractiveDisplayView.java
示例9: setSourceImage
import net.imglib2.interpolation.randomaccess.NearestNeighborInterpolatorFactory; //导入依赖的package包/类
/**
* Replaces the current
*
* @param viewImg
*/
public < T extends RealType< T > & NativeType< T >> void setSourceImage( final RandomAccessibleInterval< T > viewImg )
{
this.ivSourceImage = viewImg;
final T min = Views.iterable( viewImg ).firstElement().copy();
final T max = min.copy();
computeMinMax( viewImg, min, max );
RealRandomAccessible< T > interpolated = null;
switch ( viewImg.numDimensions() )
{
case 2:
interpolated = Views.interpolate( Views.extendZero( viewImg ), new NearestNeighborInterpolatorFactory< T >() );
break;
case 3:
timeSlider.setMaximum( ( int ) viewImg.max( 2 ) );
tIndex = 0;
showTimeSlider( true );
interpolated = Views.interpolate( Views.extendZero( Views.hyperSlice( viewImg, 2, tIndex ) ), new NearestNeighborInterpolatorFactory< T >() );
break;
case 4:
timeSlider.setMaximum( ( int ) viewImg.max( 3 ) );
tIndex = 0;
showTimeSlider( true );
stackSlider.setMaximum( ( int ) viewImg.max( 2 ) );
zIndex = 0;
showStackSlider( true );
interpolated = Views.interpolate( Views.extendZero( Views.hyperSlice( Views.hyperSlice( viewImg, 3, tIndex ), 2, zIndex ) ), new NearestNeighborInterpolatorFactory< T >() );
break;
default:
throw new IllegalArgumentException( "" + viewImg.numDimensions() + " Dimension size is not supported!" );
}
final RealARGBConverter< T > converter = new RealARGBConverter< T >( min.getRealDouble(), max.getRealDouble() );
updateSourceAndConverter( interpolated, converter );
}
开发者ID:fjug,项目名称:IDDEA,代码行数:43,代码来源:IddeaComponent.java
示例10: setOnlySourceImage
import net.imglib2.interpolation.randomaccess.NearestNeighborInterpolatorFactory; //导入依赖的package包/类
/**
* Updates the only sourceImage without updating converter
*
* @param sourceImage
* an IntervalView<T> containing the desired view onto the raw
* image data
*/
public < T extends RealType< T > & NativeType< T >> void setOnlySourceImage( final RandomAccessibleInterval< T > raiSource )
{
final IntervalView< T > sourceImage = Views.interval( raiSource, raiSource );
this.ivSourceImage = sourceImage;
RealRandomAccessible< T > interpolated = null;
switch ( sourceImage.numDimensions() )
{
case 2:
interpolated = Views.interpolate( Views.extendZero( sourceImage ), new NearestNeighborInterpolatorFactory< T >() );
break;
case 3:
timeSlider.setMaximum( ( int ) sourceImage.max( 2 ) );
showTimeSlider( true );
interpolated = Views.interpolate( Views.extendZero( Views.hyperSlice( sourceImage, 2, tIndex ) ), new NearestNeighborInterpolatorFactory< T >() );
break;
case 4:
timeSlider.setMaximum( ( int ) sourceImage.max( 3 ) );
showTimeSlider( true );
stackSlider.setMaximum( ( int ) sourceImage.max( 2 ) );
showStackSlider( true );
interpolated = Views.interpolate( Views.extendZero( Views.hyperSlice( Views.hyperSlice( sourceImage, 3, tIndex ), 2, zIndex ) ), new NearestNeighborInterpolatorFactory< T >() );
break;
default:
throw new IllegalArgumentException( "" + sourceImage.numDimensions() + " Dimension size is not supported!" );
}
updateSource( interpolated );
}
开发者ID:fjug,项目名称:IDDEA,代码行数:38,代码来源:IddeaComponent.java
示例11: updateView
import net.imglib2.interpolation.randomaccess.NearestNeighborInterpolatorFactory; //导入依赖的package包/类
/**
* Update the display view.
*/
private < T extends RealType< T > & NativeType< T >> void updateView()
{
if ( this.ivSourceImage != null )
{
RandomAccessibleInterval< T > interval;
switch ( ivSourceImage.numDimensions() )
{
case 2:
interval = ivSourceImage;
break;
case 3:
interval = Views.hyperSlice( ivSourceImage, 2, tIndex );
break;
case 4:
interval = Views.hyperSlice( Views.hyperSlice( ivSourceImage, 3, tIndex ), 2, zIndex );
break;
default:
throw new IllegalArgumentException( "" + ivSourceImage.numDimensions() + " Dimension size is not supported!" );
}
final RealRandomAccessible< T > interpolated = Views.interpolate( Views.extendZero( interval ), new NearestNeighborInterpolatorFactory< T >() );
updateSource( interpolated );
}
}
开发者ID:fjug,项目名称:IDDEA,代码行数:30,代码来源:IddeaComponent.java
示例12: interpolatorFactory
import net.imglib2.interpolation.randomaccess.NearestNeighborInterpolatorFactory; //导入依赖的package包/类
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 > >();
}
}
开发者ID:trakem2,项目名称:TrakEM2,代码行数:11,代码来源:LinearIntensityMap.java
示例13: doOnUnToggle
import net.imglib2.interpolation.randomaccess.NearestNeighborInterpolatorFactory; //导入依赖的package包/类
@Override
public void doOnUnToggle( final int x, final int y )
{
synchronized ( viewer )
{
viewer.setCursor( Cursor.getPredefinedCursor( Cursor.WAIT_CURSOR ) );
setCoordinates( x, y );
final Point p = new Point( Math.round( labelLocation.getDoublePosition( 0 ) ), Math.round( labelLocation.getDoublePosition( 1 ) ), Math.round( labelLocation.getDoublePosition( 2 ) ) );
final ArrayImg< ByteType, ByteArray > img = wrapBufferedImage( filledPixelsOverlay.img );
final ArrayRandomAccess< ByteType > imgAccess = img.randomAccess();
imgAccess.setPosition( new int[] { x, y } );
final byte overlayValueAtPoint = imgAccess.get().get();
final ExtendedRandomAccessibleInterval< ByteType, IntervalView< ByteType > > borderExtended = Views.extendBorder( Views.interval( Views.addDimension( img ), new FinalInterval( img.dimension( 0 ), img.dimension( 1 ), overlayValueAtPoint ) ) );
final RandomAccessibleOnRealRandomAccessible< ByteType > interpolatedAndTransformed =
Views.raster( RealViews.transform( Views.interpolate( borderExtended, new NearestNeighborInterpolatorFactory<>() ), labelTransform.inverse().copy().concatenate( viewerToGlobalCoordinatesTransform.inverse() )// toLabelSpace
) );
final long seedFragmentLabel = LabelFillController.getBiggestLabel( labels, p );
System.out.println( seedFragmentLabel + " " + overlayValueAtPoint + " " + getColor().getRGB() );
final RandomAccess< LongType > paintedLabelAccess = paintedLabels.randomAccess();
paintedLabelAccess.setPosition( p );
final long paintedLabel = paintedLabelAccess.get().get();
final long segmentLabel = assignment.getSegment( seedFragmentLabel );
final long comparison = paintedLabel == TRANSPARENT ? segmentLabel : paintedLabel;
final long[] fragmentsContainedInSegment = assignment.getFragments( segmentLabel );
final Filter< Pair< Pair< LabelMultisetType, ByteType >, LongType >, Pair< Pair< LabelMultisetType, ByteType >, LongType > > filter = ( p1, p2 ) -> {
final Pair< LabelMultisetType, ByteType > multiSetOverlayPairComp = p1.getA();
final long currentPaint = p1.getB().get();
if ( multiSetOverlayPairComp.getB().get() == overlayValueAtPoint && currentPaint != p2.getB().get() )
{
if ( currentPaint != TRANSPARENT )
return currentPaint == comparison;
else
{
final LabelMultisetType currentMultiSet = multiSetOverlayPairComp.getA();
for ( final long fragment : fragmentsContainedInSegment )
if ( currentMultiSet.contains( fragment ) )
return true;
return false;
}
}
return false;
};
final long t0 = System.currentTimeMillis();
final AccessBoxRandomAccessible< LongType > accessTrackingExtendedPaintedLabels =
new AccessBoxRandomAccessible<>(
Views.extendValue(
paintedLabels,
new LongType( Label.TRANSPARENT ) ) );
FloodFill.fill( new RandomAccessiblePair<>(
Views.extendValue( labels, new LabelMultisetType() ),
interpolatedAndTransformed ),
accessTrackingExtendedPaintedLabels,
p,
new ValuePair<>( new LabelMultisetType(), new ByteType( overlayValueAtPoint ) ),
new LongType( selectionController.getActiveFragmentId() ),
new DiamondShape( 1 ),
filter );
dirtyLabelsInterval.touch( accessTrackingExtendedPaintedLabels.createAccessInterval() );
final long t1 = System.currentTimeMillis();
System.out.println( "Filling took " + ( t1 - t0 ) + " ms" );
System.out.println( " modified box: " + Util.printInterval( dirtyLabelsInterval.getDirtyInterval() ) );
viewer.setCursor( Cursor.getPredefinedCursor( Cursor.DEFAULT_CURSOR ) );
viewer.requestRepaint();
}
action.run();
}
开发者ID:saalfeldlab,项目名称:bigcat,代码行数:82,代码来源:DrawProjectAndIntersectController.java
示例14: fuse
import net.imglib2.interpolation.randomaccess.NearestNeighborInterpolatorFactory; //导入依赖的package包/类
protected static < T extends RealType< T > & NativeType< T > > ImagePlus fuse( final T targetType, final ImagePlus imp1, final ImagePlus imp2, final ArrayList<InvertibleBoundable> models, final StitchingParameters params )
{
final ArrayList<ImagePlus> images = new ArrayList< ImagePlus >();
images.add( imp1 );
images.add( imp2 );
if ( params.fusionMethod < 6 )
{
ImagePlus imp = Fusion.fuse( targetType, images, models, params.dimensionality, params.subpixelAccuracy, params.fusionMethod, null, false, params.ignoreZeroValuesFusion, params.displayFusion );
return imp;
}
else if ( params.fusionMethod == 6 ) // overlay
{
// images are always the same, we just trigger different timepoints
final InterpolatorFactory< FloatType, RandomAccessible< FloatType > > factory;
if ( params.subpixelAccuracy )
factory = new NLinearInterpolatorFactory<FloatType>();
else
factory = new NearestNeighborInterpolatorFactory< FloatType >();
// fuses the first timepoint but estimates the boundaries for all timepoints as it gets all models
final CompositeImage timepoint0 = OverlayFusion.createOverlay( targetType, images, models, params.dimensionality, 1, factory );
if ( imp1.getNFrames() > 1 )
{
final ImageStack stack = new ImageStack( timepoint0.getWidth(), timepoint0.getHeight() );
// add all slices of the first timepoint
for ( int c = 1; c <= timepoint0.getStackSize(); ++c )
stack.addSlice( "", timepoint0.getStack().getProcessor( c ) );
//"Overlay into composite image"
for ( int f = 2; f <= imp1.getNFrames(); ++f )
{
final CompositeImage tmp = OverlayFusion.createOverlay( targetType, images, models, params.dimensionality, f, factory );
// add all slices of the first timepoint
for ( int c = 1; c <= tmp.getStackSize(); ++c )
stack.addSlice( "", tmp.getStack().getProcessor( c ) );
}
//convertXYZCT ...
ImagePlus result = new ImagePlus( params.fusedName, stack );
// numchannels, z-slices, timepoints (but right now the order is still XYZCT)
result.setDimensions( timepoint0.getNChannels(), timepoint0.getNSlices(), imp1.getNFrames() );
return CompositeImageFixer.makeComposite( result, CompositeImage.COMPOSITE );
}
else
{
timepoint0.setTitle( params.fusedName );
return timepoint0;
}
}
else
{
//"Do not fuse images"
return null;
}
}
开发者ID:fiji,项目名称:Stitching,代码行数:62,代码来源:Stitching_Pairwise.java
示例15: main
import net.imglib2.interpolation.randomaccess.NearestNeighborInterpolatorFactory; //导入依赖的package包/类
final static public void main( final String[] args )
{
new ImageJ();
ImgFactory< FloatType > imgFactory = new ArrayImgFactory< FloatType >();
Img< FloatType > img = null;
try
{
final ImgOpener io = new ImgOpener();
img = io.openImg( "/home/tobias/workspace/data/DrosophilaWing.tif", imgFactory, new FloatType() );
}
catch ( Exception e )
{
e.printStackTrace();
return;
}
Img< FloatType > interpolatedImg = imgFactory.create( new long[] {200, 200}, new FloatType () );
double[] offset;
double scale;
InterpolatorFactory< FloatType, RandomAccessible< FloatType > > interpolatorFactory;
offset = new double[] {50, 10};
scale = 1.0;
interpolatorFactory = new NLinearInterpolatorFactory< FloatType >();
final ImagePlus imp = ImageJFunctions.show( interpolatedImg );
imp.getImageStack().getProcessor( 0 ).setMinAndMax( 0, 255 );
for ( int i=0; i<2000; ++i ) {
copyInterpolatedGeneric( img, interpolatedImg, offset, scale, interpolatorFactory );
imp.getImageStack().getProcessor( 0 ); // update the internal img data in the underlying ImageJVirtualStack
imp.updateAndDraw();
offset[0] += 0.2;
offset[0] += 0.04;
scale *= 0.999;
}
offset = new double[] {50, 10};
scale = 1.0;
interpolatorFactory = new NearestNeighborInterpolatorFactory< FloatType >();
for ( int i=0; i<2000; ++i ) {
copyInterpolatedGeneric( img, interpolatedImg, offset, scale, interpolatorFactory );
imp.getImageStack().getProcessor( 0 ); // update the internal img data in the underlying ImageJVirtualStack
imp.updateAndDraw();
offset[0] += 0.2;
offset[0] += 0.04;
scale *= 0.999;
}
}
开发者ID:imglib,项目名称:imglib2-tests,代码行数:50,代码来源:OpenAndDisplayInterpolated.java
示例16: run
import net.imglib2.interpolation.randomaccess.NearestNeighborInterpolatorFactory; //导入依赖的package包/类
public boolean run()
{
// fuse the dataset
final ProcessFusion process;
if ( loadSequentially )
process = new ProcessSequential( spimData, viewIdsToProcess, bb, false, false, 1 );
else
process = new ProcessParalell( spimData, viewIdsToProcess, bb, false, false );
Img< FloatType > img = process.fuseStack( new FloatType(), new NearestNeighborInterpolatorFactory<FloatType>(), timepoint, channel );
final float[] minmax = FusionHelper.minMax( img );
final int effR = Math.max( radiusMin / bb.getDownSampling(), 1 );
final double threshold = (minmax[ 1 ] - minmax[ 0 ]) * ( background / 100.0 ) + minmax[ 0 ];
IOFunctions.println( "Fused image minimum: " + minmax[ 0 ] );
IOFunctions.println( "Fused image maximum: " + minmax[ 1 ] );
IOFunctions.println( "Threshold: " + threshold );
IOFunctions.println( "Computing minimum filter with effective radius of " + effR + " (downsampling=" + bb.getDownSampling() + ")" );
img = computeLazyMinFilter( img, effR );
if ( displaySegmentationImage )
ImageJFunctions.show( img );
this.min = new int[ img.numDimensions() ];
this.max = new int[ img.numDimensions() ];
if ( !computeBoundingBox( img, threshold, min, max ) )
return false;
IOFunctions.println( "Bounding box dim scaled: [" + Util.printCoordinates( min ) + "] >> [" + Util.printCoordinates( max ) + "]" );
// adjust bounding box for downsampling and global coordinates
for ( int d = 0; d < img.numDimensions(); ++d )
{
// downsampling
min[ d ] *= bb.getDownSampling();
max[ d ] *= bb.getDownSampling();
// global coordinates
min[ d ] += bb.min( d );
max[ d ] += bb.min( d );
// effect of the min filter + extra space
min[ d ] -= radiusMin * 3;
max[ d ] += radiusMin * 3;
}
IOFunctions.println( "Bounding box dim global: [" + Util.printCoordinates( min ) + "] >> [" + Util.printCoordinates( max ) + "]" );
return true;
}
开发者ID:fiji,项目名称:SPIM_Registration,代码行数:56,代码来源:MinFilterThreshold.java
示例17: buildInteractiveDrawingView
import net.imglib2.interpolation.randomaccess.NearestNeighborInterpolatorFactory; //导入依赖的package包/类
/**
* Builds an Interactive Drawing view from a given <code>sourceImage</code>
* Caution: this function also creates a new
* <code>interactiveViewer2D</code>.
*
* @param sourceImage
* @return
*/
private InteractiveDrawingView buildInteractiveDrawingView( final RandomAccessibleInterval< DoubleType > sourceImage )
{
final AffineTransform2D transform = new AffineTransform2D();
final DoubleType min = new DoubleType();
final DoubleType max = new DoubleType();
computeMinMax( sourceImage, min, max );
RealRandomAccessible< DoubleType > interpolated = null;
switch ( sourceImage.numDimensions() )
{
case 2:
interpolated = Views.interpolate( Views.extendZero( sourceImage ), new NearestNeighborInterpolatorFactory< DoubleType >() );
break;
case 3:
tMax = ( int ) sourceImage.max( 2 );
isTimeSliderVisible = true;
tIndex = 0;
interpolated = Views.interpolate( Views.extendZero( Views.hyperSlice( sourceImage, 2, tIndex ) ), new NearestNeighborInterpolatorFactory< DoubleType >() );
break;
case 4:
tMax = ( int ) sourceImage.max( 3 );
isTimeSliderVisible = true;
tIndex = 0;
zMax = ( int ) sourceImage.max( 2 );
isStackSliderVisible = true;
zIndex = 0;
interpolated = Views.interpolate( Views.extendZero( Views.hyperSlice( Views.hyperSlice( sourceImage, 3, tIndex ), 2, zIndex ) ), new NearestNeighborInterpolatorFactory< DoubleType >() );
break;
default:
throw new IllegalArgumentException( "" + sourceImage.numDimensions() + " Dimension size is not supported!" );
}
final RealARGBConverter< DoubleType > converter = new RealARGBConverter< DoubleType >( min.get(), max.get() );
final int width = ( int ) sourceImage.max( 0 );
final int height = ( int ) sourceImage.max( 1 );
interactiveViewer2D = new InteractiveRealViewer2D< DoubleType >( width, height, interpolated, transform, converter );
return interactiveViewer2D.getJHotDrawDisplay();
}
开发者ID:fjug,项目名称:IDDEA,代码行数:53,代码来源:IddeaComponent.java
示例18: updateIntervalSource
import net.imglib2.interpolation.randomaccess.NearestNeighborInterpolatorFactory; //导入依赖的package包/类
public void updateIntervalSource( RandomAccessible< T > interval ) {
this.intervalSource = interval;
RealRandomAccessible source = Views.interpolate( interval, new NearestNeighborInterpolatorFactory() );
this.updateRenderSource( source );
}
开发者ID:fjug,项目名称:IDDEA,代码行数:6,代码来源:InteractiveRealViewer.java
示例19: InjectableInterpolatingSource
import net.imglib2.interpolation.randomaccess.NearestNeighborInterpolatorFactory; //导入依赖的package包/类
@SuppressWarnings( { "unchecked", "rawtypes" } )
public InjectableInterpolatingSource( final RandomAccessible< T > source, final A sourceTransform, final Converter< ? super T, ARGBType > converter ) {
super( Views.interpolate( source, new NearestNeighborInterpolatorFactory< T >() ), sourceTransform, converter );
this.intervalSource = source;
}
开发者ID:fjug,项目名称:IDDEA,代码行数:7,代码来源:InjectableInterpolatingSource.java
示例20: injectIntervalSource
import net.imglib2.interpolation.randomaccess.NearestNeighborInterpolatorFactory; //导入依赖的package包/类
public void injectIntervalSource( RandomAccessible< T > source ) {
this.intervalSource = source;
injectSource( Views.interpolate( source, new NearestNeighborInterpolatorFactory< T >() ) );
}
开发者ID:fjug,项目名称:IDDEA,代码行数:6,代码来源:InjectableInterpolatingSource.java
注:本文中的net.imglib2.interpolation.randomaccess.NearestNeighborInterpolatorFactory类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论