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


Java FinalInterval类代码示例

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


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

示例1: getLocalRasterOverlap

import net.imglib2.FinalInterval; //导入依赖的package包/类
/**
 * create an integer interval from real interval, being conservatie on the size
 * (min is ceiled, max is floored)
 * @param overlap real input
 * @return interger interval, with mins ceiled and maxs floored
 */
public static FinalInterval getLocalRasterOverlap(RealInterval overlap)
{
	final int n = overlap.numDimensions();
	final long [] min = new long [n];
	final long [] max = new long [n];
	
	for (int i = 0; i< n; i++)
	{
		// round down errors when it is exactly 0.5, if we do not do this we end up with two intervals
		// of different size, e.g.:
		// if the first interval starts at 139.5 going to 199, the second one at 0.0 going to 59.5
		// then the rastered 1st would go from round(139.5)=140 + 1 = 141 -to- round(199)=199 - 1 = 198, dim=58
		// and  the rastered 2nd would go from round(0.0)=0 + 1     =   1 -to- round(59.5)=60 - 1 = 59,  dim=59
		min[i] = Math.round((overlap.realMin(i) - 0.0001 )) + 1;
		max[i] = Math.round((overlap.realMax(i) + 0.0001 )) - 1;
	}
	
	return new FinalInterval(min, max);
}
 
开发者ID:PreibischLab,项目名称:BigStitcher,代码行数:26,代码来源:TransformTools.java

示例2: main

import net.imglib2.FinalInterval; //导入依赖的package包/类
public static void main(String[] args)
{
	Interval start = new FinalInterval( new long[] {0,0,0},  new long[] {100, 100, 1});
	List<Interval> res = generateTileList( start, 3, 3, 0.2 );
	for (Interval i : res){
		System.out.println("(" + Long.toString( i.min( 0 )) + "," + Long.toString( i.min( 1 )) + ")");
	}
	
	final AffineTransform3D m = new AffineTransform3D();
	double scale = 300;
	m.set( scale, 0.0f, 0.0f, 0.0f, 
		   0.0f, scale, 0.0f, 0.0f,
		   0.0f, 0.0f, scale, 0.0f );
	
	FractalSpimDataGenerator fsdg = new FractalSpimDataGenerator(3);
	fsdg.addFractal( m );
	
	BigDataViewer.open(  fsdg.generateSpimData( res ), "", null, null );
	
	/*
	new ImageJ();
	RandomAccessibleInterval< LongType > rai = new FractalSpimDataGenerator( new AffineTransform2D() ).getImage( res.get( 0 ) );
	ImageJFunctions.show( rai );
	*/
}
 
开发者ID:PreibischLab,项目名称:BigStitcher,代码行数:26,代码来源:FractalSpimDataGenerator.java

示例3: BlendedExtendedMirroredRandomAccesible2

import net.imglib2.FinalInterval; //导入依赖的package包/类
public BlendedExtendedMirroredRandomAccesible2(RandomAccessibleInterval<T> img, int[] border) {
	this.img = img;
	this.numDimensions = img.numDimensions();
	
	float[] blendingBorder = new float[numDimensions];
	float[] border2 = new float[numDimensions];
	
	this.extDims = new FinalInterval(img);		
	for (int i = 0; i < numDimensions; i++)
	{
		extDims = Intervals.expand(extDims, border[i], i);
		blendingBorder[i] = border[i];
		border2[i] = 0.0f;
	}
	
	this.blending = new BlendingRealRandomAccessible(extDims, border2, blendingBorder);
}
 
开发者ID:PreibischLab,项目名称:BigStitcher,代码行数:18,代码来源:BlendedExtendedMirroredRandomAccesible2.java

示例4: calculatePCM

import net.imglib2.FinalInterval; //导入依赖的package包/类
public static <T extends RealType<T>, S extends RealType<S>, R extends RealType<R>, C extends ComplexType<C>> RandomAccessibleInterval<R> calculatePCM(
		RandomAccessibleInterval<T> img1, RandomAccessibleInterval<S> img2, int[] extension,
		ImgFactory<R> factory, R type, ImgFactory<C> fftFactory, C fftType, ExecutorService service){

	
	// TODO: Extension absolute per dimension in pixels, i.e. int[] extension
	// TODO: not bigger than the image dimension because the second mirroring is identical to the image
	
	Dimensions extSize = PhaseCorrelation2Util.getExtendedSize(img1, img2, extension);
	long[] paddedDimensions = new long[extSize.numDimensions()];
	long[] fftSize = new long[extSize.numDimensions()];
	FFTMethods.dimensionsRealToComplexFast(extSize, paddedDimensions, fftSize);
	
	RandomAccessibleInterval<C> fft1 = fftFactory.create(fftSize, fftType);
	RandomAccessibleInterval<C> fft2 = fftFactory.create(fftSize, fftType);
	
	FFT.realToComplex(Views.interval(PhaseCorrelation2Util.extendImageByFactor(img1, extension), 
			FFTMethods.paddingIntervalCentered(img1, new FinalInterval(paddedDimensions))), fft1, service);
	FFT.realToComplex(Views.interval(PhaseCorrelation2Util.extendImageByFactor(img2, extension), 
			FFTMethods.paddingIntervalCentered(img2, new FinalInterval(paddedDimensions))), fft2, service);
	
	RandomAccessibleInterval<R> pcm = calculatePCMInPlace(fft1, fft2, factory, type, service);
	return pcm;
	
}
 
开发者ID:PreibischLab,项目名称:BigStitcher,代码行数:26,代码来源:PhaseCorrelation2.java

示例5: getVisibleIds

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

示例6: getSubInterval

import net.imglib2.FinalInterval; //导入依赖的package包/类
public static FinalInterval getSubInterval( Interval interval, int d, long start, long end )
{
	int nd = interval.numDimensions();
	long[] min = new long[ nd ];
	long[] max = new long[ nd ];
	for( int i = 0; i < nd; i++ )
	{
		if( i == d )
		{
			min[ i ] = start;
			max[ i ] = end - 1;
		}
		else
		{
			min[ i ] = interval.min( i );
			max[ i ] = interval.max( i );
		}
	}
	return new FinalInterval( min, max );
}
 
开发者ID:saalfeldlab,项目名称:bigwarp,代码行数:21,代码来源:BigWarpExporter.java

示例7: getSetupImgLoader

import net.imglib2.FinalInterval; //导入依赖的package包/类
@Override
public BasicSetupImgLoader< T > getSetupImgLoader( int setupId )
{
	return new BasicSetupImgLoader< T >()
	{
		@Override
		public RandomAccessibleInterval< T > getImage( int timepointId,
				ImgLoaderHint... hints )
		{
			return ConstantUtils.constantRandomAccessibleInterval( type,
					dim.length, new FinalInterval( dim ) );
		}

		@Override
		public T getImageType()
		{
			return type;
		}
	};
}
 
开发者ID:saalfeldlab,项目名称:bigwarp,代码行数:21,代码来源:BigWarpBatchTransformFOV.java

示例8: main

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

示例9: getIntegralImage

import net.imglib2.FinalInterval; //导入依赖的package包/类
/**
 * Computes integral images of a given order and extends them such that
 * {@link IntegralMean} et al work with them.
 *
 * @param input The RAI for which an integral image is computed
 * @param order
 * @return An extended integral image for the input RAI
 */
@SuppressWarnings({ "unchecked", "rawtypes" })
private RandomAccessibleInterval<RealType> getIntegralImage(
	final RandomAccessibleInterval<I> input, final int order)
{
	ExtendedRandomAccessibleInterval<I, RandomAccessibleInterval<I>> extendedInput =
		Views.extend(input, outOfBoundsFactory);
	FinalInterval expandedInterval = Intervals.expand(input, shape.getSpan()-1);
	IntervalView<I> offsetInterval2 = Views.offsetInterval(extendedInput, expandedInterval);
	
	RandomAccessibleInterval<RealType> img = null;
	switch (order) {
		case 1:
			img = (RandomAccessibleInterval) integralImgOp.calculate(offsetInterval2);
			break;
		case 2:
			img = (RandomAccessibleInterval) squareIntegralImgOp.calculate(offsetInterval2);
			break;
	}

	img = addLeadingZeros(img);

	return img;
}
 
开发者ID:imagej,项目名称:imagej-ops,代码行数:32,代码来源:LocalThresholdIntegral.java

示例10: removeLeadingZeros

import net.imglib2.FinalInterval; //导入依赖的package包/类
/**
 * Removes leading 0s from integral image after composite creation.
 *
 * @param input Input RAI (can be a RAI of Composite)
 * @return An extended and cropped version of input
 */
private <T> RandomAccessibleInterval<T> removeLeadingZeros(
	final RandomAccessibleInterval<T> input)
{
	// Remove 0s from integralImg by shifting its interval by +1
	final long[] min = Intervals.minAsLongArray(input);
	final long[] max = Intervals.maxAsLongArray(input);

	for (int d = 0; d < input.numDimensions(); ++d) {
		int correctedSpan = getShape().getSpan() - 1;
		min[d] += (1 + correctedSpan);
		max[d] -= correctedSpan;
	}

	// Define the Interval on the infinite random accessibles
	final FinalInterval interval = new FinalInterval(min, max);

	final RandomAccessibleInterval<T> extendedImg = Views.offsetInterval(Views
		.extendBorder(input), interval);
	return extendedImg;
}
 
开发者ID:imagej,项目名称:imagej-ops,代码行数:27,代码来源:LocalThresholdIntegral.java

示例11: call

import net.imglib2.FinalInterval; //导入依赖的package包/类
@Override
public Void call() throws Exception {

	final FinalInterval interval = new FinalInterval(in.dimension(0), in.dimension(1));
	for (int j = 0; j < in.dimension(1); j++) {
		// sum up the magnitudes of all bins in a neighborhood
		raNeighbor.setPosition(new long[] { i, j });
		final Cursor<FloatType> cursorNeighborHood = raNeighbor.get().cursor();
		while (cursorNeighborHood.hasNext()) {
			cursorNeighborHood.next();
			if (Intervals.contains(interval, cursorNeighborHood)) {
				raAngles.setPosition(cursorNeighborHood);
				raMagnitudes.setPosition(cursorNeighborHood);
				raOut.setPosition(new long[] { i, j,
						(int) (raAngles.get().getRealFloat() / (360 / numOrientations) - 0.5) });
				raOut.get().add(raMagnitudes.get());
			}
		}
	}
	return null;
}
 
开发者ID:imagej,项目名称:imagej-ops,代码行数:22,代码来源:HistogramOfOrientedGradients2D.java

示例12: mean

import net.imglib2.FinalInterval; //导入依赖的package包/类
/**
 * Apply mean filter with given size of reactangle shape
 * 
 * @param input
 *            Input image
 * @param i
 *            Size of rectangle shape
 * @return Filered mean image
 */
@SuppressWarnings("unchecked")
private Img<I> mean(final RandomAccessibleInterval<I> input, final int i) {

	long[] dims = new long[input.numDimensions()];
	input.dimensions(dims);

	final byte[] array = new byte[(int) Intervals.numElements(new FinalInterval(dims))];
	Img<I> meanImg = (Img<I>) ArrayImgs.unsignedBytes(array, dims);

	OutOfBoundsMirrorFactory<ByteType, Img<ByteType>> oobFactory = new OutOfBoundsMirrorFactory<>(
			Boundary.SINGLE);

	ops().run(MeanFilterOp.class, meanImg, input, new RectangleShape(i, true), oobFactory);

	return meanImg;
}
 
开发者ID:imagej,项目名称:imagej-ops,代码行数:26,代码来源:DefaultCoarsenessFeature.java

示例13: compute

import net.imglib2.FinalInterval; //导入依赖的package包/类
@Override
public void compute(final RandomAccessibleInterval<T> in1,
	final List<Shape> in2, final IterableInterval<T> out)
{
	final long[][] minSize = Morphologies.computeMinSize(in1, in2);
	final Interval interval = new FinalInterval(minSize[1]);
	Img<T> upstream = imgCreator.calculate(interval);
	Img<T> downstream = imgCreator.calculate(interval);
	Img<T> tmp;

	erodeComputer.compute(in1, in2.get(0), Views.translate(downstream,
		minSize[0]));
	for (int i = 1; i < in2.size(); i++) {
		// Ping-ponging intermediate results between upstream and downstream to
		// avoid repetitively creating new Imgs.
		tmp = downstream;
		downstream = upstream;
		upstream = tmp;
		erodeComputer.compute(Views.interval(Views.extendValue(upstream, maxVal),
			interval), in2.get(i), downstream);
	}
	if (isFull) copyImg.compute(downstream, out);
	else copyImg.compute(Views.interval(Views.translate(downstream,
		minSize[0]), out), out);
}
 
开发者ID:imagej,项目名称:imagej-ops,代码行数:26,代码来源:ListErode.java

示例14: compute

import net.imglib2.FinalInterval; //导入依赖的package包/类
@Override
public void compute(final RandomAccessibleInterval<T> in1,
	final List<Shape> in2, final IterableInterval<T> out)
{
	final long[][] minSize = Morphologies.computeMinSize(in1, in2);
	final Interval interval = new FinalInterval(minSize[1]);
	Img<T> upstream = imgCreator.calculate(interval);
	Img<T> downstream = imgCreator.calculate(interval);
	Img<T> tmp;

	dilateComputer.compute(in1, in2.get(0), Views.translate(downstream,
		minSize[0]));
	for (int i = 1; i < in2.size(); i++) {
		// Ping-ponging intermediate results between upstream and downstream to
		// avoid repetitively creating new Imgs.
		tmp = downstream;
		downstream = upstream;
		upstream = tmp;
		dilateComputer.compute(upstream, in2.get(i), downstream);
	}
	if (isFull) copyImg.compute(downstream, out);
	else copyImg.compute(Views.interval(Views.translate(downstream,
		minSize[0]), out), out);
}
 
开发者ID:imagej,项目名称:imagej-ops,代码行数:25,代码来源:ListDilate.java

示例15: SlicesII

import net.imglib2.FinalInterval; //导入依赖的package包/类
/**
 * @param source
 *            {@link RandomAccessibleInterval} which will be virtually
 *            cropped
 * @param axesOfInterest
 *            axes which define a plane, cube, hypercube, ...! All other
 *            axes will be iterated.
 * @param dropSingletonDimensions
 *            if true, dimensions of size one will be discarded in the
 *            sliced images
 */
public SlicesII(final RandomAccessibleInterval<T> source, final int[] axesOfInterest,
		final boolean dropSingletonDimensions) {
	super(initIntervals(source, axesOfInterest));

	final long[] sliceMin = new long[source.numDimensions()];
	final long[] sliceMax = new long[source.numDimensions()];

	for (int d = 0; d < source.numDimensions(); d++) {
		if (dimension(d) == 1) {
			sliceMin[d] = source.min(d);
			sliceMax[d] = source.max(d);
		}
	}

	this.dropSingltonDimensions = dropSingletonDimensions;
	this.slice = new FinalInterval(sliceMin, sliceMax);
	this.source = source;
}
 
开发者ID:imagej,项目名称:imagej-ops,代码行数:30,代码来源:SlicesII.java


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