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


Java RealViews类代码示例

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


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

示例1: getVisibleIds

import net.imglib2.realtransform.RealViews; //导入依赖的package包/类
@Override
public synchronized TLongHashSet getVisibleIds()
{
	final TLongHashSet visibleIds = new TLongHashSet();
	final int w = viewer.getWidth();
	final int h = viewer.getHeight();
	final AffineTransform3D viewerTransform = new AffineTransform3D();
	viewer.getState().getViewerTransform( viewerTransform );
	IntervalView< LabelMultisetType > screenLabels =
			Views.interval(
					Views.hyperSlice(
							RealViews.affine( labels, viewerTransform ), 2, 0 ),
					new FinalInterval( w, h ) );

	for ( final LabelMultisetType pixel : Views.iterable( screenLabels ) )
	{
		for ( final Entry< Label > entry : pixel.entrySet() )
				visibleIds.add( entry.getElement().id() );
	}

	return visibleIds;
}
 
开发者ID:saalfeldlab,项目名称:bigcat,代码行数:23,代码来源:LabelMultiSetIdPicker.java

示例2: getInterpolatedSource

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

示例3: act

import net.imglib2.realtransform.RealViews; //导入依赖的package包/类
@Override
public < T extends RealType< T > > void act(
		final int iteration,
		final RandomAccessibleInterval< T > matrix,
		final RandomAccessibleInterval< T > scaledMatrix,
		final double[] lut,
		final int[] permutation,
		final int[] inversePermutation,
		final double[] multipliers,
		final RandomAccessibleInterval< double[] > estimatedFit )
{
	final T dummy = scaledMatrix.randomAccess().get().createVariable();
	dummy.setReal( Double.NaN );
	final String path = fileDir( iteration );
	if ( iteration == 0 )
		createParentDirectory( path );
	final LUTRealTransform tf = new LUTRealTransform( lut, 2, 2 );

	final RealTransformRealRandomAccessible< T, InverseRealTransform > transformed = RealViews.transformReal( Views.interpolate( Views.extendValue( scaledMatrix, dummy ), new NLinearInterpolatorFactory<>() ), tf );
	final double s = 1.0 / ( lut[ lut.length - 1 ] - lut[ 0 ] ) * lut.length;
	final double o = -lut[ 0 ];
	final ScaleAndTranslation scaleAndTranslation = new ScaleAndTranslation( new double[] { s, s }, new double[] { o, o } );
	final IntervalView< T > offset = Views.interval( Views.raster( RealViews.transformReal( transformed, scaleAndTranslation ) ), scaledMatrix );
	final RandomAccessibleInterval< T > strip = MatrixStripConversion.matrixToStrip( offset, range, dummy );
	new FileSaver( ImageJFunctions.wrap( strip, "" ) ).saveAsTiff( path );
}
 
开发者ID:saalfeldlab,项目名称:z-spacing,代码行数:27,代码来源:MatrixVisitor.java

示例4: main

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

示例5: getAccessor

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

示例6: fillMask

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

示例7: writeMask

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

示例8: getVisibleIds

import net.imglib2.realtransform.RealViews; //导入依赖的package包/类
@Override
public synchronized TLongHashSet getVisibleIds()
{
	final TLongHashSet visibleIds = new TLongHashSet();
	final int w = viewer.getWidth();
	final int h = viewer.getHeight();
	final AffineTransform3D viewerTransform = new AffineTransform3D();
	viewer.getState().getViewerTransform( viewerTransform );
	final IntervalView< Pair< LabelMultisetType, LongType > > screenLabels =
			Views.interval(
					Views.hyperSlice(
							RealViews.affine( labels, viewerTransform ), 2, 0 ),
					new FinalInterval( w, h ) );

	for ( final Pair< LabelMultisetType, LongType > pixel : Views.iterable( screenLabels ) )
	{
		final long b = pixel.getB().get();
		if ( b == Label.TRANSPARENT )
		{
			final LabelMultisetType a = pixel.getA();
			for ( final Entry< Label > entry : a.entrySet() )
				visibleIds.add( entry.getElement().id() );
		}
		else
			visibleIds.add( b );
	}

	return visibleIds;
}
 
开发者ID:saalfeldlab,项目名称:bigcat,代码行数:30,代码来源:PairLabelMultiSetLongIdPicker.java

示例9: generateTransformed

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

示例10: generateStack

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

示例11: AbstractLUTGrid

import net.imglib2.realtransform.RealViews; //导入依赖的package包/类
public AbstractLUTGrid( final int numSourceDimensions, final int numTargetDimensions,
		final RandomAccessibleInterval< DoubleType > lutArray, final double[] scale, final double[] shift )
{
	super();
	this.numSourceDimensions = numSourceDimensions;
	this.numTargetDimensions = numTargetDimensions;
	this.lutArray = lutArray;

	// generate n-1 dimensional array that has local LUTs as columns
	final CompositeIntervalView< DoubleType, RealComposite< DoubleType > > collapsedSource = Views.collapseReal( lutArray );
	this.dimensions = new FinalInterval( collapsedSource );
	this.nNonTransformedCoordinates = this.dimensions.numDimensions();
	this.lutMaxIndex = ( int ) ( this.lutArray.dimension( this.nNonTransformedCoordinates ) ) - 1;

	// generate scale transform to allow for generating interpolated
	// high-res LUT from low-res LUT
	this.scale = new double[ this.nNonTransformedCoordinates ];
	this.shift = new double[ this.nNonTransformedCoordinates ];
	copyAndFillIfNecessary( scale, this.scale );
	copyAndFillIfNecessary( shift, this.shift );

	final ScaleAndTranslation scaleAndShift = new ScaleAndTranslation( this.scale, this.shift );
	final ExtendedRandomAccessibleInterval< RealComposite< DoubleType >, CompositeIntervalView< DoubleType, RealComposite< DoubleType > > > extendedCollapsedSource =
			Views.extendBorder( collapsedSource );
	this.coefficients = RealViews.transform( Views.interpolate( extendedCollapsedSource, this.interpolatorFactory ), scaleAndShift );
	this.access = this.coefficients.realRandomAccess();
	this.currentLut = this.access.get();

}
 
开发者ID:saalfeldlab,项目名称:z-spacing,代码行数:30,代码来源:AbstractLUTGrid.java

示例12: main

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

示例13: calculate

import net.imglib2.realtransform.RealViews; //导入依赖的package包/类
@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;
}
 
开发者ID:imagej,项目名称:imagej-ops,代码行数:14,代码来源:DefaultScaleView.java

示例14: xfmToView

import net.imglib2.realtransform.RealViews; //导入依赖的package包/类
public static <T extends RealType<T>> RealTransformRandomAccessible<T, InverseRealTransform> xfmToView(
		InvertibleRealTransform xfm, 
		RandomAccessible<T> src, 
		InterpolatorFactory<T, RandomAccessible<T>> interpFactory) 
{
	RealRandomAccessible<T> interpolant = Views.interpolate(
			src, interpFactory);

	RealTransformRandomAccessible<T, InverseRealTransform> rv = 
		RealViews.transform( interpolant, xfm.inverse() );

	return rv;
}
 
开发者ID:bogovicj,项目名称:hhmi-exp,代码行数:14,代码来源:TransformTools.java

示例15: getTransformedSource

import net.imglib2.realtransform.RealViews; //导入依赖的package包/类
protected static < T, A extends AffineGet & Concatenable< AffineGet > > RandomAccessible< T > getTransformedSource( final AffineTransformType< A > transformType, final RenderSource< T, A > source, final A viewerTransform, final A screenScaleTransform ) {
    final RealRandomAccessible< T > img = source.getInterpolatedSource();

    final A sourceToScreen = transformType.createTransform();
    transformType.set( sourceToScreen, screenScaleTransform );
    sourceToScreen.concatenate( viewerTransform );
    sourceToScreen.concatenate( source.getSourceTransform() );

    return RealViews.affine( img, sourceToScreen );
}
 
开发者ID:fjug,项目名称:IDDEA,代码行数:11,代码来源:InjectableMultiResolutionRenderer.java


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