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


Java Interval.min方法代码示例

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


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

示例1: BlendingRealRandomAccess

import net.imglib2.Interval; //导入方法依赖的package包/类
/**
 * RealRandomAccess that computes a blending function for a certain {@link Interval}
 * 
 * @param interval - the interval it is defined on (return zero outside of it)
 * @param border - how many pixels to skip before starting blending (on each side of each dimension)
 * @param blending - how many pixels to compute the blending function on (on each side of each dimension)
 */
public BlendingRealRandomAccess(
		final Interval interval,
		final float[] border,
		final float[] blending )
{
	this.interval = interval;
	this.n = interval.numDimensions();
	this.l = new float[ n ];
	this.border = border;
	this.blending = blending;
	this.v = new FloatType();
	
	this.min = new int[ n ];
	this.dimMinus1 = new int[ n ];
	
	for ( int d = 0; d < n; ++d )
	{
		this.min[ d ] = (int)interval.min( d );
		this.dimMinus1[ d ] = (int)interval.max( d ) - min[ d ];
	}
}
 
开发者ID:PreibischLab,项目名称:BigStitcher,代码行数:29,代码来源:BlendingRealRandomAccess.java

示例2: getSubInterval

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

示例3: computeMinSize

import net.imglib2.Interval; //导入方法依赖的package包/类
/**
 * Computes the min coordinate and the size of an {@link Interval} after
 * padding with a list of {@link Shape}s in a series morphology operations.
 * 
 * @param source the interval to be applied with some morphology operation
 * @param shapes the list of Shapes for padding
 * @return a size-2 array storing the min coordinate and the size of the
 *         padded interval
 */
public static final long[][] computeMinSize(final Interval source,
	final List<Shape> shapes)
{

	final int numDims = source.numDimensions();
	final long[] min = new long[numDims];
	final long[] size = new long[numDims];

	for (int i = 0; i < numDims; i++) {
		min[i] = source.min(i);
		size[i] = source.dimension(i);
	}

	for (final Shape shape : shapes) {
		final Neighborhood<BitType> nh = MorphologyUtils.getNeighborhood(shape,
			source);
		for (int i = 0; i < numDims; i++) {
			min[i] += nh.min(i);
			size[i] += nh.dimension(i) - 1;
		}
	}

	return new long[][] { min, size };
}
 
开发者ID:imagej,项目名称:imagej-ops,代码行数:34,代码来源:Morphologies.java

示例4: adjustMinMax

import net.imglib2.Interval; //导入方法依赖的package包/类
/**
 * Adjusts the given {@link Img} to match the bounds of the specified
 * {@link Interval}.
 * 
 * @param img An image whose min/max bounds might need adjustment.
 * @param minMax An {@link Interval} whose min/max bounds to use when
 *          adjusting the image. If the provided {@code minMax} object is not
 *          an {@link Interval}, no adjustment is performed.
 * @return A wrapped version of the input {@link Img} with bounds adjusted to
 *         match the provided {@link Interval}, if any; or the input image
 *         itself if no adjustment was needed/possible.
 */
public static <T extends Type<T>> Img<T> adjustMinMax(final Img<T> img,
	final Object minMax)
{
	if (!(minMax instanceof Interval)) return img;
	final Interval interval = (Interval) minMax;

	final long[] min = new long[interval.numDimensions()];
	interval.min(min);
	for (int d = 0; d < min.length; d++) {
		if (min[d] != 0) {
			return ImgView.wrap(Views.translate(img, min), img.factory());
		}
	}
	return img;
}
 
开发者ID:imagej,项目名称:imagej-ops,代码行数:28,代码来源:Imgs.java

示例5: CrossNeighborhoodLocalizableSampler

import net.imglib2.Interval; //导入方法依赖的package包/类
public CrossNeighborhoodLocalizableSampler( final RandomAccessibleInterval< T > source, final Interval span, final CrossNeighborhoodFactory< T > factory )
{
	super( source );
	this.source = source;
	this.span = span;
	neighborhoodFactory = factory;
	currentPos = new long[ n ];
	currentMin = new long[ n ];
	currentMax = new long[ n ];
	final long[] accessMin = new long[ n ];
	final long[] accessMax = new long[ n ];
	source.min( accessMin );
	source.max( accessMax );
	for ( int d = 0; d < n; ++d )
	{
		accessMin[ d ] += span.min( d );
		accessMax[ d ] += span.max( d );
	}
	currentNeighborhood = neighborhoodFactory.create( currentPos, currentMin, currentMax, span, source.randomAccess( new FinalInterval( accessMin, accessMax ) ) );
}
 
开发者ID:bogovicj,项目名称:hhmi-exp,代码行数:21,代码来源:CrossNeighborhoodLocalizableSampler.java

示例6: calculate

import net.imglib2.Interval; //导入方法依赖的package包/类
/**
 * Finds intersection points of the line and the minimum and maximum bounds of
 * the interval.
 *
 * @param line parametric equation of a line <b>a<sub>0</sub></b> + <b>v</b>
 *          as a (point, vector) pair.
 * @param interval an interval with integer coordinates. The method assumes that the
 *          first three dimensions are x, y and z.
 * @return scalar values (t<sub>1</sub>, t<sub>2</sub>) for intersection
 *         points (<b>a<sub>0</sub></b> + <em>t<sub>1</sub></em> <b>v</b>,
 *         <b>a<sub>0</sub></b> + <em>t<sub>2</sub></em> <b>v</b>).
 *         {@link Optional#empty()} if the line doesn't intersect the stack.
 */
@Override
public Optional<ValuePair<DoubleType, DoubleType>> calculate(
	final ValuePair<Tuple3d, Vector3d> line, final Interval interval)
{
	final Vector3d direction = new Vector3d(line.b);
	final Point3d origin = new Point3d(line.a);
	if (!validCoordinates(direction) || !validCoordinates(origin)) {
		throw new IllegalArgumentException(
			"Direction or origin has non-finite coordinates");
	}
	if (direction.length() == 0.0) {
		throw new IllegalArgumentException("Direction has zero length");
	}
	direction.normalize();
	final int d = interval.numDimensions();
	final long[] minBounds = new long[d];
	interval.min(minBounds);
	final long[] maxBounds = new long[d];
	interval.max(maxBounds);

	final ValuePair<DoubleType, DoubleType> pair = findIntervalIntersections(
		origin, direction, minBounds, maxBounds);
	if (pair == null) {
		return Optional.empty();
	}
	if (reverseScalars(pair)) {
		// Swap t-values so that the first is the intersection where the line
		// enters the interval.
		final double tmp = pair.a.get();
		pair.a.set(pair.b.get());
		pair.b.set(tmp);
	}
	return Optional.of(pair);
}
 
开发者ID:bonej-org,项目名称:BoneJ2,代码行数:48,代码来源:BoxIntersect.java

示例7: getTileMins

import net.imglib2.Interval; //导入方法依赖的package包/类
public static List< RealLocalizable > getTileMins(List<Interval> intervals)
{
	final List<RealLocalizable> mins = new ArrayList<>();
	for(Interval iv : intervals)
	{
		RealPoint min = new RealPoint( iv.numDimensions() );
		iv.min( min );
		mins.add( min );
	}
	return mins;
}
 
开发者ID:PreibischLab,项目名称:BigStitcher,代码行数:12,代码来源:FractalSpimDataGenerator.java

示例8: generateSpimData

import net.imglib2.Interval; //导入方法依赖的package包/类
/**
 * create SpimData containing Views at each Interval
 * @param intervals list of intervals
 * @return generated SpimData
 */
public SpimData generateSpimData(final List<Interval> intervals)
{
	final List<RealLocalizable> mins = new ArrayList<>();
	for(Interval iv : intervals)
	{
		RealPoint min = new RealPoint( iv.numDimensions() );
		iv.min( min );
		mins.add( min );
	}
	return generateSpimData( intervals, mins );
}
 
开发者ID:PreibischLab,项目名称:BigStitcher,代码行数:17,代码来源:FractalSpimDataGenerator.java

示例9: splitAlongLargestDimension

import net.imglib2.Interval; //导入方法依赖的package包/类
/**
 * split the given Interval into nSplits intervals along the largest dimension
 * @param interval input interval
 * @param nSplits how may splits
 * @return list of intervals input was split into
 */
public static List<Interval> splitAlongLargestDimension(Interval interval, long nSplits){
	
	List<Interval> res = new ArrayList<Interval>();
	
	long[] min = new long[interval.numDimensions()];
	long[] max = new long[interval.numDimensions()];
	interval.min(min);
	interval.max(max);
	
	int splitDim = 0;
	for (int i = 0; i< interval.numDimensions(); i++){
		if (interval.dimension(i) > interval.dimension(splitDim)) splitDim = i;
	}

	// there could be more splits than actual dimension entries
	nSplits = Math.min( nSplits, interval.dimension(splitDim) );

	long chunkSize = interval.dimension(splitDim) / nSplits;
	long maxSplitDim = max[splitDim];
	
	for (int i = 0; i<nSplits; i++){
		if (i != 0){
			min[splitDim] += chunkSize;	
		}
		max[splitDim] = min[splitDim] + chunkSize - 1;
		if (i == nSplits -1){
			max[splitDim] = maxSplitDim;
		}
		res.add(new FinalInterval(min, max));
	}
		
	return res;
}
 
开发者ID:PreibischLab,项目名称:BigStitcher,代码行数:40,代码来源:FourNeighborhoodExtrema.java

示例10: show

import net.imglib2.Interval; //导入方法依赖的package包/类
public static void show( final String[] args ) throws ImgIOException
{
	ImageJ.main( args );
	final File file = new File( "/Users/tinevez/Desktop/iconas/Data/Uneven.tif" );
	final SCIFIOImgPlus img = new ImgOpener().openImgs( file.getAbsolutePath() ).get( 0 );

	final Shape strel = new HyperSphereShape( 5 );

	/*
	 * To new Img
	 */

	ImageJFunctions.show( img, "Source" );

	final Img topHat = TopHat.topHat( img, strel, 1 );
	ImageJFunctions.show( topHat, "WhiteTopHatToNewImg" );


	/*
	 * In place
	 */

	final Interval interval = FinalInterval.createMinSize( new long[] { 30, 50, 88, 32 } );
	final Img copy = img.copy();
	TopHat.topHatInPlace( copy, interval, strel, 1 );
	ImageJFunctions.show( copy, "WhiteTopHatInPlace" );

	/*
	 * To target
	 */

	final Img img2 = img.factory().create( interval, new UnsignedByteType() );
	final long[] translation = new long[ interval.numDimensions() ];
	interval.min( translation );
	final IntervalView translate = Views.translate( img2, translation );
	TopHat.topHat( img, translate, strel, 1 );
	ImageJFunctions.show( img2, "WhiteTopHatToTarget" );

}
 
开发者ID:imglib,项目名称:imglib2-tests,代码行数:40,代码来源:TopHatTests.java

示例11: SlicesIICursor

import net.imglib2.Interval; //导入方法依赖的package包/类
public SlicesIICursor(final RandomAccessibleInterval<T> src, final Interval fixedAxes, final Interval slice) {
	super(fixedAxes);

	this.src = src;
	this.tmpPosition = new long[fixedAxes.numDimensions()];
	this.sliceDims = new long[slice.numDimensions()];
	this.sliceOffset = new long[slice.numDimensions()];

	slice.dimensions(sliceDims);
	slice.min(sliceOffset);
}
 
开发者ID:imagej,项目名称:imagej-ops,代码行数:12,代码来源:SlicesII.java

示例12: isEmpty

import net.imglib2.Interval; //导入方法依赖的package包/类
private static final boolean isEmpty(final Interval interval) {
	final int n = interval.numDimensions();
	for (int d = 0; d < n; ++d)
		if (interval.min(d) > interval.max(d))
			return true;
	return false;
}
 
开发者ID:fiji,项目名称:MaMuT,代码行数:8,代码来源:SourceSpotImageUpdater.java

示例13: isEmpty

import net.imglib2.Interval; //导入方法依赖的package包/类
private static final boolean isEmpty( final Interval interval )
{
	final int n = interval.numDimensions();
	for ( int d = 0; d < n; ++d )
		if ( interval.min( d ) > interval.max( d ) )
			return true;
	return false;
}
 
开发者ID:fiji,项目名称:MaMuT,代码行数:9,代码来源:MamutUtils.java

示例14: paint

import net.imglib2.Interval; //导入方法依赖的package包/类
/**
 * This paints the box overlay with perspective and scale set such that it
 * fits approximately into the specified screen area.
 *
 * @param graphics
 *            graphics context to paint to.
 * @param sources
 *            source intervals (3D boxes) to be shown.
 * @param targetInterval
 *            target interval (2D box) into which a slice of sourceInterval
 *            is projected.
 * @param boxScreen
 *            (approximate) area of the screen which to fill with the box
 *            visualisation.
 */
public < I extends IntervalAndTransform > void paint( final Graphics2D graphics, final List< I > sources, final Interval targetInterval, final Interval boxScreen )
{
	assert ( targetInterval.numDimensions() >= 2 );

	if ( sources.isEmpty() )
		return;

	final double perspective = 3;
	final double screenBoxRatio = 0.75;

	long maxSourceSize = 0;
	for ( final IntervalAndTransform source : sources )
		maxSourceSize = Math.max( maxSourceSize, Math.max( Math.max( source.getSourceInterval().dimension( 0 ), source.getSourceInterval().dimension( 1 ) ), source.getSourceInterval().dimension( 2 ) ) );
	final long sourceSize = maxSourceSize;
	final long targetSize = Math.max( targetInterval.dimension( 0 ), targetInterval.dimension( 1 ) );

	final AffineTransform3D transform = sources.get( 0 ).getSourceToViewer();
	final double vx = transform.get( 0, 0 );
	final double vy = transform.get( 1, 0 );
	final double vz = transform.get( 2, 0 );
	final double transformScale = Math.sqrt( vx*vx + vy*vy + vz*vz );
	renderBoxHelper.setDepth( perspective * sourceSize * transformScale );

	final double bw = screenBoxRatio * boxScreen.dimension( 0 );
	final double bh = screenBoxRatio * boxScreen.dimension( 1 );
	double scale = Math.min( bw / targetInterval.dimension( 0 ), bh / targetInterval.dimension( 1 ) );

	final double tsScale = transformScale * sourceSize / targetSize;
	if ( tsScale > 1.0 )
		scale /= tsScale;
	renderBoxHelper.setScale( scale );

	final long x = boxScreen.min( 0 ) + boxScreen.dimension( 0 ) / 2;
	final long y = boxScreen.min( 1 ) + boxScreen.dimension( 1 ) / 2;

	final AffineTransform t = graphics.getTransform();
	final AffineTransform translate = new AffineTransform( 1, 0, 0, 1, x, y );
	translate.preConcatenate( t );
	graphics.setTransform( translate );
	paint( graphics, sources, targetInterval );
	graphics.setTransform( t );
}
 
开发者ID:saalfeldlab,项目名称:bigwarp,代码行数:58,代码来源:MultiBoxOverlay2d.java

示例15: iterateWithRandomAccessiblePartial

import net.imglib2.Interval; //导入方法依赖的package包/类
private void iterateWithRandomAccessiblePartial( final Interval interval ) {
	final ExtendedRandomAccessibleInterval<T, Img<T>> extended = Views.extendMirrorSingle(input);
	final Cursor<FloatType> oc = Views.iterable(Views.interval(output, interval)).localizingCursor();

	final int n = input.numDimensions();
	final long[] min = new long[ n ];
	final long[] max = new long[ n ];
	interval.min( min );
	interval.max( max );
	for ( int d = 0; d < n; ++d )
	{
		min[d] -= 1;
		max[d] += 1;
	}
	final Interval raInterval = new FinalInterval( min, max );
	final RandomAccess<T> ra = extended.randomAccess( raInterval );
	float I, In, Ine, Ie, Ise, Is, Isw, Iw, Inw;

	while(oc.hasNext()) {

		oc.fwd();

		ra.setPosition(oc);

		I = ra.get().getRealFloat();
		ra.bck(1);
		In = ra.get().getRealFloat();
		ra.fwd(0);
		Ine = ra.get().getRealFloat();
		ra.fwd(1);
		Ie = ra.get().getRealFloat();
		ra.fwd(1);
		Ise = ra.get().getRealFloat();
		ra.bck(0);
		Is = ra.get().getRealFloat();
		ra.bck(0);
		Isw = ra.get().getRealFloat();
		ra.bck(1);
		Iw = ra.get().getRealFloat();
		ra.bck(1);
		Inw = ra.get().getRealFloat();

		oc.get().set( I - 1/8f * (In+Ine+Ie+Ise+Is+Isw+Iw+Inw));
	}

}
 
开发者ID:imglib,项目名称:imglib2-tests,代码行数:47,代码来源:TestRelativeIterationPerformance.java


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