Search in sources :

Example 1 with Localizable

use of net.imglib2.Localizable in project imagej-ops by imagej.

the class ColocalisationTest method gaussianSmooth.

/**
 * 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>> Img<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);
    Img<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;
}
Also used : Point(net.imglib2.Point) ArrayImgFactory(net.imglib2.img.array.ArrayImgFactory) Localizable(net.imglib2.Localizable) RandomAccessibleInterval(net.imglib2.RandomAccessibleInterval) Interval(net.imglib2.Interval) FloatType(net.imglib2.type.numeric.real.FloatType)

Aggregations

Interval (net.imglib2.Interval)1 Localizable (net.imglib2.Localizable)1 Point (net.imglib2.Point)1 RandomAccessibleInterval (net.imglib2.RandomAccessibleInterval)1 ArrayImgFactory (net.imglib2.img.array.ArrayImgFactory)1 FloatType (net.imglib2.type.numeric.real.FloatType)1