本文整理汇总了Java中net.imglib2.Interval类的典型用法代码示例。如果您正苦于以下问题:Java Interval类的具体用法?Java Interval怎么用?Java Interval使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Interval类属于net.imglib2包,在下文中一共展示了Interval类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: LineGrid
import net.imglib2.Interval; //导入依赖的package包/类
/**
* Constructs an instance of {@link LineGrid}.
*
* @param interval a integer interval. The method assumes that the first three
* dimensions are x, y and z.
* @param <I> type of the interval.
*/
public <I extends Interval> LineGrid(final I interval) {
final boolean emptyDims = dims.apply(interval).anyMatch(i -> i == 0);
if (interval.numDimensions() < 3 || emptyDims) {
throw new IllegalArgumentException(
"Interval must have at least three dimensions");
}
final double planeSize = findPlaneSize(interval);
final double t = planeSize * 0.5;
final Point3d centroid = findCentroid(interval);
xy = new LinePlane(XY, planeSize, new Vector3d(0, 0, -t), centroid);
xz = new LinePlane(XZ, planeSize, new Vector3d(0, -t, 0), centroid);
yz = new LinePlane(YZ, planeSize, new Vector3d(-t, 0, 0), centroid);
setRandomGenerator(new Random());
setRotation(new NoopRotation(), new AxisAngle4d());
}
开发者ID:bonej-org,项目名称:BoneJ2,代码行数:23,代码来源:LineGrid.java
示例2: getTileTranslations
import net.imglib2.Interval; //导入依赖的package包/类
public static List<TranslationGet> getTileTranslations(List<Interval> intervals)
{
final List< TranslationGet > tr = new ArrayList<>();
for(Interval iv : intervals)
{
double[] min = new double[iv.numDimensions()];
iv.realMin( min );
if (iv.numDimensions() == 2)
tr.add( new Translation2D( min ) );
else
tr.add( new Translation3D( min ) );
}
return tr;
}
开发者ID:PreibischLab,项目名称:BigStitcher,代码行数:18,代码来源:FractalSpimDataGenerator.java
示例3: main
import net.imglib2.Interval; //导入依赖的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
示例4: 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
示例5: 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
示例6: main
import net.imglib2.Interval; //导入依赖的package包/类
public static void main( final String[] args ) throws ImgIOException
{
final String fn = "/home/tobias/workspace/data/DrosophilaWing.tif";
final int span = 3;
final ArrayImgFactory< FloatType > factory = new ArrayImgFactory< FloatType >();
final FloatType type = new FloatType();
final Img< FloatType > imgInput = new ImgOpener().openImg( fn, factory, type );
final Img< FloatType > imgOutput = factory.create( imgInput, type );
final Interval computationInterval = Intervals.expand( imgInput, -span );
final RandomAccessibleInterval< FloatType > input = Views.interval( imgInput, computationInterval );
final RandomAccessibleInterval< FloatType > output = Views.interval( imgOutput, computationInterval );
minFilter( input, output, new RectangleShape( span, false ) );
// minFilter( input, output, new HyperSphereShape( span ) );
ImageJFunctions.show( imgInput, "input" );
ImageJFunctions.show( imgOutput, "min filtered" );
}
开发者ID:imglib,项目名称:imglib2-tests,代码行数:21,代码来源:MinFilterExample.java
示例7: calculate
import net.imglib2.Interval; //导入依赖的package包/类
@Override
public RandomAccessibleInterval<T> calculate(final RandomAccessibleInterval<T> input, final Interval interval) {
boolean oneSizedDims = false;
if (dropSingleDimensions) {
for (int d = 0; d < interval.numDimensions(); d++) {
if (interval.dimension(d) == 1) {
oneSizedDims = true;
break;
}
}
}
if (Intervals.equals(input, interval) && !oneSizedDims)
return input;
if (!Intervals.contains(input, interval))
throw new RuntimeException("Intervals don't match!");
IntervalView<T> res = Views.offsetInterval(input, interval);
return oneSizedDims ? Views.dropSingletonDimensions(res) : res;
}
开发者ID:imagej,项目名称:imagej-ops,代码行数:21,代码来源:CropRAI.java
示例8: richardsonLucy
import net.imglib2.Interval; //导入依赖的package包/类
@OpMethod(op = net.imagej.ops.deconvolve.RichardsonLucyC.class)
public <
I extends RealType<I>, O extends RealType<O>, K extends RealType<K>, C extends ComplexType<C>>
RandomAccessibleInterval<O> richardsonLucy(
final RandomAccessibleInterval<O> out,
final RandomAccessibleInterval<I> in1,
final RandomAccessibleInterval<K> in2,
final RandomAccessibleInterval<C> fftInput,
final RandomAccessibleInterval<C> fftKernel, final int maxIterations,
final Interval imgConvolutionInterval)
{
@SuppressWarnings("unchecked")
final RandomAccessibleInterval<O> result =
(RandomAccessibleInterval<O>) ops().run(
net.imagej.ops.deconvolve.RichardsonLucyC.class, out, in1, in2,
fftInput, fftKernel, maxIterations, imgConvolutionInterval);
return result;
}
开发者ID:imagej,项目名称:imagej-ops,代码行数:19,代码来源:DeconvolveNamespace.java
示例9: ops
import net.imglib2.Interval; //导入依赖的package包/类
@OpMethod(
op = net.imagej.ops.deconvolve.NonCirculantNormalizationFactor.class)
public <O extends RealType<O>> RandomAccessibleInterval<O>
normalizationFactor(final RandomAccessibleInterval<O> arg,
final Dimensions k, final Dimensions l,
final RandomAccessibleInterval<O> fftInput,
final RandomAccessibleInterval<O> fftKernel,
final Interval imgConvolutionInterval)
{
@SuppressWarnings("unchecked")
final RandomAccessibleInterval<O> result =
(RandomAccessibleInterval<O>) ops().run(
net.imagej.ops.deconvolve.NonCirculantNormalizationFactor.class, arg, k,
l, fftInput, fftKernel, imgConvolutionInterval);
return result;
}
开发者ID:imagej,项目名称:imagej-ops,代码行数:17,代码来源:DeconvolveNamespace.java
示例10: 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
示例11: compute
import net.imglib2.Interval; //导入依赖的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
示例12: compute
import net.imglib2.Interval; //导入依赖的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
示例13: initIntervals
import net.imglib2.Interval; //导入依赖的package包/类
private static Interval initIntervals(final Interval src, final int[] axesOfInterest) {
final long[] dimensionsToIterate = new long[src.numDimensions()];
src.dimensions(dimensionsToIterate);
// determine axis to iterate
for (int i = 0; i < src.numDimensions(); i++) {
for (int j = 0; j < axesOfInterest.length; j++) {
if (axesOfInterest[j] == i) {
dimensionsToIterate[i] = 1;
break;
}
}
}
return new FinalInterval(dimensionsToIterate);
}
开发者ID:imagej,项目名称:imagej-ops,代码行数:19,代码来源:SlicesII.java
示例14: 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
示例15: copyTypedSpace
import net.imglib2.Interval; //导入依赖的package包/类
@SuppressWarnings("unchecked")
private static <C extends CalibratedAxis> void copyTypedSpace(
final Interval inInterval, final CalibratedSpace<C> in,
final CalibratedSpace<C> out)
{
int offset = 0;
for (int d = 0; d < in.numDimensions(); d++) {
if (inInterval != null && inInterval.dimension(d) == 1) {
offset++;
}
else {
out.setAxis((C) in.axis(d).copy(), d - offset);
}
}
}
开发者ID:imagej,项目名称:imagej-ops,代码行数:17,代码来源:MetadataUtil.java
示例16: calculate
import net.imglib2.Interval; //导入依赖的package包/类
@Override
@SuppressWarnings("unchecked")
public O calculate(final I input, final Interval centeredInterval) {
int numDimensions = input.numDimensions();
// compute where to place the final Interval for the input so that the
// coordinate in the center
// of the input is at position (0,0).
final long[] min = new long[numDimensions];
final long[] max = new long[numDimensions];
for (int d = 0; d < numDimensions; ++d) {
min[d] = input.min(d) + input.dimension(d) / 2;
max[d] = min[d] + centeredInterval.dimension(d) - 1;
}
return (O) new FinalInterval(min, max);
}
开发者ID:imagej,项目名称:imagej-ops,代码行数:20,代码来源:PaddingIntervalOrigin.java
示例17: 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
示例18: TransformWeights
import net.imglib2.Interval; //导入依赖的package包/类
public TransformWeights(
final ImagePortion portion,
final Interval imgInterval,
final Blending blending,
final AffineTransform3D transform,
final RandomAccessibleInterval< FloatType > overlapImg,
final RandomAccessibleInterval< FloatType > blendingImg,
final long[] offset )
{
this.portion = portion;
this.blendingImg = blendingImg;
this.transform = transform;
this.overlapImg = overlapImg;
this.blending = blending;
this.offsetX = (int)offset[ 0 ];
this.offsetY = (int)offset[ 1 ];
this.offsetZ = (int)offset[ 2 ];
this.imgSizeX = (int)imgInterval.dimension( 0 );
this.imgSizeY = (int)imgInterval.dimension( 1 );
this.imgSizeZ = (int)imgInterval.dimension( 2 );
}
开发者ID:fiji,项目名称:SPIM_Registration,代码行数:24,代码来源:TransformWeights.java
示例19: gaussianSmooth
import net.imglib2.Interval; //导入依赖的package包/类
/**
* Gaussian Smooth of the input image using intermediate float format.
* @param <T>
* @param img
* @param sigma
* @return
*/
public static <T extends RealType<T> & NativeType<T>> RandomAccessibleInterval<T> gaussianSmooth(
RandomAccessibleInterval<T> img, double[] sigma) {
Interval interval = Views.iterable(img);
ImgFactory<T> outputFactory = new ArrayImgFactory<T>();
final long[] dim = new long[ img.numDimensions() ];
img.dimensions(dim);
RandomAccessibleInterval<T> output = outputFactory.create( dim,
img.randomAccess().get().createVariable() );
final long[] pos = new long[ img.numDimensions() ];
Arrays.fill(pos, 0);
Localizable origin = new Point(pos);
ImgFactory<FloatType> tempFactory = new ArrayImgFactory<FloatType>();
RandomAccessible<T> input = Views.extendMirrorSingle(img);
Gauss.inFloat(sigma, input, interval, output, origin, tempFactory);
return output;
}
开发者ID:fiji,项目名称:Colocalisation_Analysis,代码行数:28,代码来源:TestImageAccessor.java
示例20: 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
注:本文中的net.imglib2.Interval类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论