本文整理汇总了Java中net.imglib2.util.Intervals.expand方法的典型用法代码示例。如果您正苦于以下问题:Java Intervals.expand方法的具体用法?Java Intervals.expand怎么用?Java Intervals.expand使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.imglib2.util.Intervals
的用法示例。
在下文中一共展示了Intervals.expand方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: BlendedExtendedMirroredRandomAccesible2
import net.imglib2.util.Intervals; //导入方法依赖的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);
}
示例2: main
import net.imglib2.util.Intervals; //导入方法依赖的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" );
}
示例3: getIntegralImage
import net.imglib2.util.Intervals; //导入方法依赖的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;
}
示例4: doit
import net.imglib2.util.Intervals; //导入方法依赖的package包/类
public static < T extends RealType< T > & NativeType< T > > void doit( final T type ) throws ImgIOException
{
final ImgPlus< T > input = new ImgOpener().openImg( "/home/tobias/workspace/data/img1.tif", new ArrayImgFactory< T >(), type );
ImageJFunctions.show( input );
final int n = input.numDimensions();
final long[] dim = new long[ n + 1 ];
for ( int d = 0; d < n; ++d )
dim[ d ] = input.dimension( d );
dim[ n ] = n;
final Img< T > gradients = new ArrayImgFactory< T >().create( dim, type );
// bounding box for computation of gradients
// we require a border of 1 pixel wrt. to the input image
final Interval gradientComputationInterval = Intervals.expand( input, -1 );
// compute partial derivatives of input in all dimension
for ( int d = 0; d < n; ++d )
PartialDerivative.gradientCentralDifference( input, Views.interval( Views.hyperSlice( gradients, n, d ), gradientComputationInterval ), d );
ImageJFunctions.show( gradients );
// final int numRuns = 20;
// final boolean printIndividualTimes = true;
// final ArrayList< Long > times = BenchmarkHelper.benchmark( numRuns, new Runnable() {
// @Override
// public void run()
// {
// for ( int i = 0; i < 10; ++i )
// for ( int d = 0; d < n; ++d )
// PartialDerivative.gradientCentralDifference( input, Views.interval( Views.hyperSlice( gradients, n, d ), gradientComputationInterval ), d );
// }
// } );
// if ( printIndividualTimes )
// {
// for ( int i = 0; i < numRuns; ++i )
// System.out.println( "run " + i + ": " + times.get( i ) + " ms" );
// System.out.println();
// }
// System.out.println( "median: " + BenchmarkHelper.median( times ) + " ms" );
}