当前位置: 首页>>代码示例>>Java>>正文


Java RealRandomAccessible类代码示例

本文整理汇总了Java中net.imglib2.RealRandomAccessible的典型用法代码示例。如果您正苦于以下问题:Java RealRandomAccessible类的具体用法?Java RealRandomAccessible怎么用?Java RealRandomAccessible使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


RealRandomAccessible类属于net.imglib2包,在下文中一共展示了RealRandomAccessible类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getInterpolatedSource

import net.imglib2.RealRandomAccessible; //导入依赖的package包/类
@Override
public RealRandomAccessible< T > getInterpolatedSource( final int t, final int level, final Interpolation method )
{
	if( isTransformed )
	{
		final AffineTransform3D transform = new AffineTransform3D();
		source.getSourceTransform( t, level, transform );
		final RealRandomAccessible< T > sourceRealAccessible = RealViews.affineReal( source.getInterpolatedSource( t, level, method ), transform );
		if( xfm == null )
			return sourceRealAccessible;
		else
			return new RealTransformRealRandomAccessible< T, InverseRealTransform >( sourceRealAccessible, xfm );
	}
	else
	{
		return source.getInterpolatedSource( t, level, method );
	}
}
 
开发者ID:saalfeldlab,项目名称:bigwarp,代码行数:19,代码来源:WarpedSource.java

示例2: main

import net.imglib2.RealRandomAccessible; //导入依赖的package包/类
final static public void main( final String[] args )
	{
		new ImageJ();
		final ImagePlus imp = new ImagePlus( "http://media.npr.org/images/picture-show-flickr-promo.jpg" );
		imp.show();

		final float[] pixels = ( float[] ) imp.getProcessor().convertToFloat().getPixels();
		final ArrayImg< FloatType, FloatArray > img = ArrayImgs.floats( pixels, imp.getWidth(), imp.getHeight() );

		final double[] lut = new double[ Math.max( imp.getWidth(), imp.getHeight() ) ];
		for ( int i = 0; i < lut.length; ++i )
			lut[ i ] = i + Math.pow( i, 1.5 );

		final SingleDimensionLUTRealTransform transform = new SingleDimensionLUTRealTransform( lut, 2, 2, 1 );
		final RealRandomAccessible< FloatType > source = Views.interpolate( Views.extendBorder( img ), new NLinearInterpolatorFactory< FloatType >() );
		final RandomAccessible< FloatType > target = new RealTransformRandomAccessible< FloatType, RealTransform >( source, transform );
		final RandomAccessible< FloatType > target2 = RealViews.transform( source, transform );

//		RealViews.transformReal(source, transform);

		ImageJFunctions.show( Views.interval( target, new FinalInterval( imp.getWidth(), imp.getHeight() ) ) );
		ImageJFunctions.show( Views.interval( target2, new FinalInterval( imp.getWidth(), imp.getHeight() ) ) );
	}
 
开发者ID:saalfeldlab,项目名称:z-spacing,代码行数:24,代码来源:SingleDimensionLUTRealTransform.java

示例3: render

import net.imglib2.RealRandomAccessible; //导入依赖的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

示例4: getAccessor

import net.imglib2.RealRandomAccessible; //导入依赖的package包/类
/**
 * Logic stolen from
 * <a href='https://github.com/trakem2/TrakEM2/blob/master/TrakEM2_/src/main/java/org/janelia/intensity/LinearIntensityMap.java'>
 *   TrakEM2 LinearIntensityMap
 * </a>.
 *
 * @return an accessor for deriving warped pixel intensities.
 */
public RealRandomAccess<RealComposite<DoubleType>> getAccessor() {

    final ArrayImg<DoubleType, DoubleArray> warpField =
            ArrayImgs.doubles(values, columnCount, rowCount, VALUES_PER_AFFINE);

    final CompositeIntervalView<DoubleType, RealComposite<DoubleType>>
            collapsedSource = Views.collapseReal(warpField);

    final RandomAccessible<RealComposite<DoubleType>> extendedCollapsedSource = Views.extendBorder(collapsedSource);
    final RealRandomAccessible<RealComposite<DoubleType>> coefficients =
            Views.interpolate(extendedCollapsedSource, interpolatorFactory);

    final double xScale = getXScale();
    final double yScale = getYScale();
    final double[] scale = { xScale, yScale };
    final double[] shift = { 0.5 * xScale , 0.5 * yScale };

    final ScaleAndTranslation scaleAndTranslation = new ScaleAndTranslation(scale, shift);

    final RealRandomAccessible<RealComposite<DoubleType>> stretchedCoefficients =
            RealViews.transform(coefficients, scaleAndTranslation);

    return stretchedCoefficients.realRandomAccess();
}
 
开发者ID:saalfeldlab,项目名称:render,代码行数:33,代码来源:AffineWarpField.java

示例5: defaultRasterTest

import net.imglib2.RealRandomAccessible; //导入依赖的package包/类
@Test
public void defaultRasterTest() {
	Img<DoubleType> img = new ArrayImgFactory<DoubleType>().create(new int[]{10,  10}, new DoubleType());
	Random r = new Random();
	for (DoubleType d : img) {
		d.set(r.nextDouble());
	}
	RealRandomAccessible<DoubleType> realImg = Views.interpolate(img, new FloorInterpolatorFactory<DoubleType>());
	
	RandomAccessibleOnRealRandomAccessible<DoubleType> il2 = Views.raster(realImg);
	RandomAccessibleOnRealRandomAccessible<DoubleType> opr = ops.transform().rasterView(realImg);
	
	Cursor<DoubleType> il2C = Views.interval(il2, img).localizingCursor();
	RandomAccess<DoubleType> oprRA = Views.interval(opr, img).randomAccess();
	
	while (il2C.hasNext()) {
		il2C.next();
		oprRA.setPosition(il2C);
		assertEquals(il2C.get().get(), oprRA.get().get(), 1e-10);
	}
}
 
开发者ID:imagej,项目名称:imagej-ops,代码行数:22,代码来源:RasterViewTest.java

示例6: getInterpolatedSource

import net.imglib2.RealRandomAccessible; //导入依赖的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

示例7: updateRealRandomSource

import net.imglib2.RealRandomAccessible; //导入依赖的package包/类
/**
     * Update the realRandomSource with new source.
     * @param source
     */
    public void updateRealRandomSource(final RealRandomAccessible source)
    {
        if(InteractiveRealViewer2D.class.isInstance(currentInteractiveViewer2D))
        {
            // User doesn't load any picture
            ((InteractiveRealViewer2D) currentInteractiveViewer2D).updateSource(source);
        }
//        else
//        {
//            // In case that user loaded InteractiveViewer2D already,
//            // We're changing to InteractiveRealViewer2D for the updating source
//            currentInteractiveViewer2D = interactiveRealViewer2D;
//
//            editor.remove(view);
//            InteractiveDrawingView newView = getCurrentInteractiveViewer2D().getJHotDrawDisplay();
//            newView.copyFrom(view);
//
//            editor.add(newView);
//            view = newView;
//
//            scrollPane.setViewportView(view);
//
//            ((InteractiveRealViewer2D) currentInteractiveViewer2D).updateSource(source);
//        }
    }
 
开发者ID:fjug,项目名称:IDDEA,代码行数:30,代码来源:InteractiveDisplayView.java

示例8: LabelMultiSetIdPicker

import net.imglib2.RealRandomAccessible; //导入依赖的package包/类
public LabelMultiSetIdPicker(
		final ViewerPanel viewer,
		final RealRandomAccessible< LabelMultisetType > labels )
{
	this.viewer = viewer;
	this.labels = labels;
	labelAccess = labels.realRandomAccess();
}
 
开发者ID:saalfeldlab,项目名称:bigcat,代码行数:9,代码来源:LabelMultiSetIdPicker.java

示例9: PairLabelMultiSetLongIdPicker

import net.imglib2.RealRandomAccessible; //导入依赖的package包/类
public PairLabelMultiSetLongIdPicker(
		final ViewerPanel viewer,
		final RealRandomAccessible< Pair< LabelMultisetType, LongType > > labels )
{
	this.viewer = viewer;
	this.labels = labels;
	labelAccess = labels.realRandomAccess();
}
 
开发者ID:saalfeldlab,项目名称:bigcat,代码行数:9,代码来源:PairLabelMultiSetLongIdPicker.java

示例10: getInterpolatedSource

import net.imglib2.RealRandomAccessible; //导入依赖的package包/类
@Override
public RealRandomAccessible< VolatileARGBType > getInterpolatedSource( final int t, final int level, final Interpolation method )
{
	final ExtendedRandomAccessibleInterval< VolatileARGBType, RandomAccessibleInterval< VolatileARGBType > > extendedSource =
			Views.extendValue( getSource( t,  level ), new VolatileARGBType( 0 ) );
	switch ( method )
	{
	case NLINEAR :
		return Views.interpolate( extendedSource, interpolatorFactories[ 1 ] );
	default :
		return Views.interpolate( extendedSource, interpolatorFactories[ 0 ] );
	}
}
 
开发者ID:saalfeldlab,项目名称:bigcat,代码行数:14,代码来源:AbstractARGBConvertedLabelsSource.java

示例11: copyToImageStack

import net.imglib2.RealRandomAccessible; //导入依赖的package包/类
public static < T extends NumericType< T > & NativeType< T > > ImagePlus copyToImageStack( final RealRandomAccessible< T > rai, final Interval itvl )
{
	final long[] dimensions = new long[ itvl.numDimensions() ];
	itvl.dimensions( dimensions );

	// create the image plus image
	final T t = rai.realRandomAccess().get();
	final ImagePlusImgFactory< T > factory = new ImagePlusImgFactory< T >();
	final ImagePlusImg< T, ? > target = factory.create( itvl, t );

	double k = 0;
	final long N = dimensions[ 0 ] * dimensions[ 1 ] * dimensions[ 2 ];

	final net.imglib2.Cursor< T > c = target.cursor();
	final RealRandomAccess< T > ra = rai.realRandomAccess();
	while ( c.hasNext() )
	{
		c.fwd();
		ra.setPosition( c );
		c.get().set( ra.get() );

		if ( k % 10000 == 0 )
		{
			IJ.showProgress( k / N );
		}
		k++;
	}

	IJ.showProgress( 1.1 );
	try
	{
		return target.getImagePlus();
	}
	catch ( final ImgLibException e )
	{
		e.printStackTrace();
	}

	return null;
}
 
开发者ID:saalfeldlab,项目名称:bigwarp,代码行数:41,代码来源:BigWarpRealExporter.java

示例12: generateTransformed

import net.imglib2.RealRandomAccessible; //导入依赖的package包/类
public static < T extends RealType< T > > RealRandomAccessible< T > generateTransformed(
		final RandomAccessibleInterval< T > input,
		final Transform permutation,
		final InvertibleRealTransform lut,
		final T dummy )
{
	dummy.setReal( Double.NaN );
	final IntervalView< T > permuted = Views.interval( new TransformView< T >( input, permutation ), input );
	final RealRandomAccessible< T > interpolated = Views.interpolate( Views.extendValue( permuted, dummy ), new NLinearInterpolatorFactory< T >() );
	return RealViews.transformReal( interpolated, lut );
}
 
开发者ID:saalfeldlab,项目名称:z-spacing,代码行数:12,代码来源:ZPositionCorrection.java

示例13: generateStack

import net.imglib2.RealRandomAccessible; //导入依赖的package包/类
public static < T extends RealType< T > > ImageStack generateStack(
		final RealRandomAccessible< T > input,
		final int width,
		final int height,
		final int size,
		final double zScale )
{
	final Scale3D scaleTransform = new Scale3D( 1.0, 1.0, zScale );
	final RealTransformRealRandomAccessible< T, InverseRealTransform > scaledInput = RealViews.transformReal( input, scaleTransform );
	final int scaledSize = ( int ) ( size * zScale );
	return generateStack( scaledInput, width, height, scaledSize );
}
 
开发者ID:saalfeldlab,项目名称:z-spacing,代码行数:13,代码来源:ZPositionCorrection.java

示例14: main

import net.imglib2.RealRandomAccessible; //导入依赖的package包/类
final static public void main( final String[] args )
	{

		new ImageJ();
		final ImagePlus imp = new ImagePlus( "http://media.npr.org/images/picture-show-flickr-promo.jpg" );
		imp.show();

		final float[] pixels = ( float[] ) imp.getProcessor().convertToFloat().getPixels();
		final ArrayImg< FloatType, FloatArray > img = ArrayImgs.floats( pixels, imp.getWidth(), imp.getHeight() );

		final double[] lut = new double[ Math.max( imp.getWidth(), imp.getHeight() ) ];
		for ( int i = 0; i < lut.length; ++i )
			lut[ i ] = i + Math.pow( i, 1.5 );

		final LUTRealTransform transform = new LUTRealTransform( lut, 2, 2 );
		final RealRandomAccessible< FloatType > source = Views.interpolate( Views.extendBorder( img ), new NLinearInterpolatorFactory< FloatType >() );
		final RandomAccessible< FloatType > target = new RealTransformRandomAccessible< FloatType, RealTransform >( source, transform );
		final RandomAccessible< FloatType > target2 = RealViews.transform( source, transform );

//		RealViews.transformReal(source, transform);

		final ArrayImg< FloatType, FloatArray > targetImg = ArrayImgs.floats( imp.getWidth(), imp.getHeight() );
		render( source, targetImg, transform, 0.05 );

		ImageJFunctions.show( Views.interval( target, new FinalInterval( imp.getWidth(), imp.getHeight() ) ) );
		ImageJFunctions.show( Views.interval( target2, new FinalInterval( imp.getWidth(), imp.getHeight() ) ) );
		ImageJFunctions.show( targetImg );
	}
 
开发者ID:saalfeldlab,项目名称:z-spacing,代码行数:29,代码来源:LUTRealTransform.java

示例15: interpolateView

import net.imglib2.RealRandomAccessible; //导入依赖的package包/类
/**
 * Returns a {@link RealRandomAccessible} using interpolation
 *
 * @param input the {@link EuclideanSpace} to be interpolated
 * @param factory the {@link InterpolatorFactory} to provide interpolators for
 *          source
 * @return
 */
@OpMethod(
	op = net.imagej.ops.transform.interpolateView.DefaultInterpolateView.class)
public <T, I extends EuclideanSpace> RealRandomAccessible<T> interpolateView(
	final I input, final InterpolatorFactory<T, I> factory)
{
	return (RealRandomAccessible<T>) ops().run(
		Ops.Transform.InterpolateView.class, input, factory);
}
 
开发者ID:imagej,项目名称:imagej-ops,代码行数:17,代码来源:TransformNamespace.java


注:本文中的net.imglib2.RealRandomAccessible类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。