net.imglib2.util.Util Java Examples

The following examples show how to use net.imglib2.util.Util. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ListDilate.java    From imagej-ops with BSD 2-Clause "Simplified" License 6 votes vote down vote up
@SuppressWarnings({ "rawtypes", "unchecked" })
@Override
public void initialize() {
	minVal = Util.getTypeFromInterval(in()).createVariable();
	minVal.setReal(minVal.getMinValue());

	imgCreator = (UnaryFunctionOp) Functions.unary(ops(), Ops.Create.Img.class,
		Img.class, in(), minVal.createVariable());

	copyImg = (UnaryComputerOp) Computers.unary(ops(),
		Ops.Copy.IterableInterval.class, IterableInterval.class, Views.iterable(
			in1()));

	dilateComputer = (BinaryComputerOp) Computers.unary(ops(),
		Ops.Morphology.Dilate.class, IterableInterval.class, in1(), in2().get(0),
		false);
}
 
Example #2
Source File: ColocalisationTest.java    From imagej-ops with BSD 2-Clause "Simplified" License 6 votes vote down vote up
/**
 * 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<>(Util.getTypeFromInterval(img));
	final long[] dim = new long[img.numDimensions()];
	img.dimensions(dim);
	Img<T> output = outputFactory.create(dim);

	final long[] pos = new long[img.numDimensions()];
	Arrays.fill(pos, 0);
	Localizable origin = new Point(pos);

	ImgFactory<FloatType> tempFactory = new ArrayImgFactory<>(new FloatType());
	RandomAccessible<T> input = Views.extendMirrorSingle(img);
	Gauss.inFloat(sigma, input, interval, output, origin, tempFactory);

	return output;
}
 
Example #3
Source File: LocalThresholdIntegral.java    From imagej-ops with BSD 2-Clause "Simplified" License 6 votes vote down vote up
/**
 * Add 0s before axis minimum.
 * 
 * @param input Input RAI
 * @return An extended and cropped version of input
 */
private <T extends RealType<T>> RandomAccessibleInterval<T> addLeadingZeros(
	RandomAccessibleInterval<T> input)
{
	final long[] min = Intervals.minAsLongArray(input);
	final long[] max = Intervals.maxAsLongArray(input);

	for (int i = 0; i < max.length; i++) {
		min[i]--;
	}

	final T realZero = Util.getTypeFromInterval(input).copy();
	realZero.setZero();

	final ExtendedRandomAccessibleInterval<T, RandomAccessibleInterval<T>> extendedImg = Views.extendValue(input,
		realZero);
	final IntervalView<T> offsetInterval = Views.interval(extendedImg,
		min, max);
	
	return Views.zeroMin(offsetInterval);
}
 
Example #4
Source File: NonLinearFiltersTest.java    From imagej-ops with BSD 2-Clause "Simplified" License 6 votes vote down vote up
/**
 * @see VarianceFilterOp
 * @see DefaultVarianceFilter
 */
@Test
public void testVarianceFilter() {
	ops.run(VarianceFilterOp.class, out, in, shape, oobFactory);

	double sum = 0.0;
	double sumSq = 0.0;

	NeighborhoodsIterableInterval<ByteType> neighborhoods =
		shape.neighborhoods(Views.interval(Views.extendMirrorSingle(in), in));
	for (ByteType t : neighborhoods.firstElement()) {
		sum += t.getRealDouble();
		sumSq += t.getRealDouble()*t.getRealDouble();
	}

	assertEquals((byte)Util.round((sumSq - (sum * sum / 9)) / 8), out.firstElement().get());
}
 
Example #5
Source File: GenerateSpimData.java    From BigStitcher with GNU General Public License v2.0 6 votes vote down vote up
public static void main( String[] args )
{
	SpimData spimData = grid3x2();
	SequenceDescription sd = spimData.getSequenceDescription();
	ImgLoader i = sd.getImgLoader();

	TimePoint firstTp = sd.getTimePoints().getTimePointsOrdered().get( 0 );
	int tpId = firstTp.getId();

	for ( final ViewSetup vs: spimData.getSequenceDescription().getViewSetups().values() )
	{
		SetupImgLoader< ? > sil = i.getSetupImgLoader( vs.getId() );
		ViewDescription vd = sd.getViewDescription( tpId, vs.getId() );
		
		Tile t = vd.getViewSetup().getTile();

		if ( t.hasLocation() )
			System.out.println( "Loading: " + t.getName() + " " + Util.printCoordinates( t.getLocation() ) + " " + vd.getViewSetup().getChannel().getName() );
		else
			System.out.println( "Loading: " + t.getName() + " (unknown location) " + vd.getViewSetup().getChannel().getName() );
		
		ImageJFunctions.show( (RandomAccessibleInterval< UnsignedShortType >)sil.getImage( tpId, ImgLoaderHints.LOAD_COMPLETELY ) ).resetDisplayRange();
	}
}
 
Example #6
Source File: TileConfigurationHelpers.java    From BigStitcher with GNU General Public License v2.0 6 votes vote down vote up
public static void main(String[] args) throws Exception
{
	System.out.println( "== Old style:" );
	Map< Pair< File, Integer >, Translation3D > res = parseTileConfigurationOld(
			new File( "/Users/david/Desktop/tileConfigOld.txt" ) );

	if ( res != null )
		res.entrySet().forEach( e -> {
			System.out.println( e.getKey().getA() + ", series " + e.getKey().getB() + ": "
					+ Util.printCoordinates( e.getValue().getTranslationCopy() ) );
		} );

	System.out.println( "== New style:" );
	Map< ViewId, Translation3D > res2 = parseTileConfiguration(
			new File( "/Users/david/Desktop/tileConfig.txt" ) );

	if ( res2 != null )
		res2.entrySet().forEach( e -> {
			System.out.println( "View: " + e.getKey().getViewSetupId() + ", TP: " + e.getKey().getTimePointId()
					+ ": " + Util.printCoordinates( e.getValue().getTranslationCopy() ) );
		} );
}
 
Example #7
Source File: ListErode.java    From imagej-ops with BSD 2-Clause "Simplified" License 6 votes vote down vote up
@SuppressWarnings({ "rawtypes", "unchecked" })
@Override
public void initialize() {
	maxVal = Util.getTypeFromInterval(in()).createVariable();
	maxVal.setReal(maxVal.getMaxValue());

	imgCreator = (UnaryFunctionOp) Functions.unary(ops(), Ops.Create.Img.class,
		Img.class, in(), maxVal.createVariable());

	copyImg = (UnaryComputerOp) Computers.unary(ops(),
		Ops.Copy.IterableInterval.class, IterableInterval.class, Views.iterable(
			in1()));

	erodeComputer = (BinaryComputerOp) Computers.unary(ops(),
		Ops.Morphology.Erode.class, IterableInterval.class, in1(), in2().get(0),
		false);
}
 
Example #8
Source File: ExtractPSF.java    From SPIM_Registration with GNU General Public License v2.0 6 votes vote down vote up
/**
 * 
 * @param img
 * @param viewId
 * @param model
 * @param locations
 * @param psfSize - dimensions of psf to extract
 */
public void extractNextImg(
		final RandomAccessibleInterval< T > img,
		final ViewId viewId,
		final AffineTransform3D model,
		final ArrayList< double[] > locations,
		final long[] psfSize )
{
	IOFunctions.println( "PSF size: " + Util.printCoordinates( psfSize ) );

	final ArrayImg< T, ? > originalPSF = extractPSFLocal( img, locations, psfSize );

	// normalize PSF
	normalize( originalPSF );

	final ArrayImg< T, ? > psf = transformPSF( originalPSF, model );

	viewIds.add( viewId );
	pointSpreadFunctions.put( viewId, psf );
	originalPSFs.put( viewId, originalPSF );
}
 
Example #9
Source File: MVDeconFFTThreads.java    From SPIM_Registration with GNU General Public License v2.0 6 votes vote down vote up
final protected static Thread getCUDAThread1(
		final AtomicInteger ai, final ImgFactory< FloatType > blockFactory, final Block[] blocks, final int[] blockSize,
		final Img< FloatType > image, final Img< FloatType > result, final int deviceId, final Img< FloatType > kernel1 )
{
	final Thread cudaThread1 = new Thread( new Runnable()
	{
		public void run()
		{
			final Img< FloatType > block = blockFactory.create( Util.int2long( blockSize ), new FloatType() );

			int i;

			while ( ( i = ai.getAndIncrement() ) < blocks.length )
				convolve1BlockCUDA( blocks[ i ], deviceId, image, result, block, kernel1, i );
		}
	});
	
	return cudaThread1;
}
 
Example #10
Source File: PadAndRichardsonLucy.java    From imagej-ops with BSD 2-Clause "Simplified" License 6 votes vote down vote up
@Override
public void initialize() {

	// the out of bounds factory will be different depending on wether we are
	// using circulant or non-circulant
	if (this.getOBFInput() == null) {

		if (!nonCirculant) {
			setOBFInput(new OutOfBoundsMirrorFactory<>(Boundary.SINGLE));
		}
		else if (nonCirculant) {
			setOBFInput(new OutOfBoundsConstantValueFactory<>(Util
				.getTypeFromInterval(in()).createVariable()));
		}
	}

	computeEstimateOp = getComputeEstimateOp();

	super.initialize();

}
 
Example #11
Source File: CommitCanvasN5.java    From paintera with GNU General Public License v2.0 6 votes vote down vote up
private static <I extends IntegerType<I> & NativeType<I>> void writeBlocksLabelIntegerType(
		final RandomAccessibleInterval<UnsignedLongType> canvas,
		final long[] blocks,
		final DatasetSpec datasetSpec,
		final BlockSpec blockSpec,
		final TLongObjectHashMap<BlockDiff> blockDiff) throws IOException {
	final RandomAccessibleInterval<I> highestResolutionData = N5Utils.open(datasetSpec.container, datasetSpec.dataset);
	final I i = Util.getTypeFromInterval(highestResolutionData).createVariable();
	for (final long blockId : blocks) {
		blockSpec.fromLinearIndex(blockId);
		final RandomAccessibleInterval<Pair<I, UnsignedLongType>> backgroundWithCanvas = Views.interval(Views.pair(highestResolutionData, canvas), blockSpec.asInterval());
		final RandomAccessibleInterval<I> mergedData = Converters.convert(backgroundWithCanvas, (s, t) -> pickFirstIfSecondIsInvalid(s.getA(), s.getB(), t), i.createVariable());
		N5Utils.saveBlock(mergedData, datasetSpec.container, datasetSpec.dataset, datasetSpec.attributes, blockSpec.pos);
		blockDiff.put(blockId, createBlockDiffFromCanvasIntegerType(Views.iterable(backgroundWithCanvas)));
	}
}
 
Example #12
Source File: CommitCanvasN5.java    From paintera with GNU General Public License v2.0 6 votes vote down vote up
private static <I extends IntegerType<I> & NativeType<I>> BlockDiff downsampleIntegerTypeAndSerialize(
		final N5Writer n5,
		final String dataset,
		final DatasetAttributes attributes,
		final RandomAccessibleInterval<I> data,
		final int[] relativeFactors,
		final int[] size,
		final Interval blockInterval,
		final long[] blockPosition
) throws IOException {
	final I i = Util.getTypeFromInterval(data).createVariable();
	i.setInteger(Label.OUTSIDE);
	final RandomAccessibleInterval<I> input = Views.isZeroMin(data) ? data : Views.zeroMin(data);
	final RandomAccessibleInterval<I> output = new ArrayImgFactory<>(i).create(size);
	WinnerTakesAll.downsample(input, output, relativeFactors);

	final RandomAccessibleInterval<I> previousContents = Views.offsetInterval(N5Utils.<I>open(n5, dataset), blockInterval);
	final BlockDiff blockDiff = createBlockDiffInteger(previousContents, output);

	N5Utils.saveBlock(output, n5, dataset, attributes, blockPosition);
	return blockDiff;
}
 
Example #13
Source File: MTKT.java    From imagej-ops with BSD 2-Clause "Simplified" License 6 votes vote down vote up
private static <V extends RealType<V>> int[] rankSamples(RandomAccessibleInterval<V> image, long seed) {
	final long elementCount = Intervals.numElements(image);
	if (elementCount > Integer.MAX_VALUE) {
		throw new IllegalArgumentException("Image dimensions too large: " + elementCount);
	}
	final int n = (int) elementCount;

	// NB: Initialize rank index in random order, to ensure random tie-breaking.
	final int[] rankIndex = new int[n];
	for (int i = 0; i < n; i++) {
		rankIndex[i] = i;
	}
	Random r = new Random(seed);
	ColocUtil.shuffle(rankIndex, r);

	final V a = Util.getTypeFromInterval(image).createVariable();
	final RandomAccess<V> ra = image.randomAccess();
	Collections.sort(new IntArray(rankIndex), (indexA, indexB) -> {
		IntervalIndexer.indexToPosition(indexA, image, ra);
		a.set(ra.get());
		IntervalIndexer.indexToPosition(indexB, image, ra);
		final V b = ra.get();
		return a.compareTo(b);
	});
	return rankIndex;
}
 
Example #14
Source File: RandomAccessibleIntervalDataSource.java    From paintera with GNU General Public License v2.0 6 votes vote down vote up
public RandomAccessibleIntervalDataSource(
		final RandomAccessibleInterval<D>[] dataSources,
		final RandomAccessibleInterval<T>[] sources,
		final AffineTransform3D[] mipmapTransforms,
		final Invalidate<Long> invalidate,
		final Function<Interpolation, InterpolatorFactory<D, RandomAccessible<D>>> dataInterpolation,
		final Function<Interpolation, InterpolatorFactory<T, RandomAccessible<T>>> interpolation,
		final String name) {
	this(
			dataSources,
			sources,
			mipmapTransforms,
			invalidate,
			dataInterpolation,
			interpolation,
			() -> Util.getTypeFromInterval(dataSources[0]).createVariable(),
			() -> Util.getTypeFromInterval(sources[0]).createVariable(),
			name
	    );
}
 
Example #15
Source File: MVDeconFFTThreads.java    From SPIM_Registration with GNU General Public License v2.0 6 votes vote down vote up
final protected static Thread getCUDAThread2(
		final AtomicInteger ai, final ImgFactory< FloatType > blockFactory, final Block[] blocks, final int[] blockSize,
		final Img< FloatType > image, final Img< FloatType > result, final int deviceId, final Img< FloatType > kernel2 )
{
	final Thread cudaThread2 = new Thread( new Runnable()
	{
		public void run()
		{
			final Img< FloatType > block = blockFactory.create( Util.int2long( blockSize ), new FloatType() );

			int i;

			while ( ( i = ai.getAndIncrement() ) < blocks.length )
				convolve2BlockCUDA( blocks[ i ], deviceId, image, result, block, kernel2 );
		}
	});
	
	return cudaThread2;
}
 
Example #16
Source File: FloodFill.java    From paintera with GNU General Public License v2.0 6 votes vote down vote up
private static <T extends IntegerType<T>> void fillPrimitiveType(
		final RandomAccessibleInterval<T> input,
		final RandomAccessible<UnsignedLongType> output,
		final Localizable seed,
		final long seedLabel,
		final FragmentSegmentAssignment assignment)
{
	final T extension = Util.getTypeFromInterval(input).createVariable();
	extension.setInteger(Label.OUTSIDE);

	net.imglib2.algorithm.fill.FloodFill.fill(
			Views.extendValue(input, extension),
			output,
			seed,
			new UnsignedLongType(1),
			new DiamondShape(1),
			makePredicate(seedLabel, assignment)
		);
}
 
Example #17
Source File: CreateImgFromRAI.java    From imagej-ops with BSD 2-Clause "Simplified" License 5 votes vote down vote up
@Override
@SuppressWarnings({ "rawtypes", "unchecked" })
public UnaryFunctionOp<RandomAccessibleInterval<T>, Img<T>> createWorker(
	final RandomAccessibleInterval<T> input)
{
	// NB: Intended to match CreateImgFromDimsAndType.
	return (UnaryFunctionOp) Functions.unary(ops(), Ops.Create.Img.class,
		Img.class, input, Util.getTypeFromInterval(input));
}
 
Example #18
Source File: ListClose.java    From imagej-ops with BSD 2-Clause "Simplified" License 5 votes vote down vote up
@SuppressWarnings({ "rawtypes", "unchecked" })
@Override
public void initialize() {
	maxVal = Util.getTypeFromInterval(in()).createVariable();
	maxVal.setReal(maxVal.getMaxValue());

	imgCreator = (UnaryFunctionOp) Functions.unary(ops(), Ops.Create.Img.class,
		Img.class, in(), maxVal.createVariable());

	dilateComputer = Hybrids.binaryCF(ops(), Ops.Morphology.Dilate.class, out(),
		in1(), in2(), false);

	erodeComputer = Hybrids.binaryCF(ops(), Ops.Morphology.Erode.class, out(),
		in1(), in2(), false);
}
 
Example #19
Source File: DefaultCreateKernelGauss.java    From imagej-ops with BSD 2-Clause "Simplified" License 5 votes vote down vote up
@Override
public RandomAccessibleInterval<T> calculate(double[] input) {
	final double[] sigmaPixels = new double[input.length];

	final long[] dims = new long[input.length];
	final double[][] kernelArrays = new double[input.length][];

	for (int d = 0; d < input.length; d++) {
		sigmaPixels[d] = input[d];

		dims[d] = Math.max(3, (2 * (int) (3 * sigmaPixels[d] + 0.5) + 1));
		kernelArrays[d] = Util.createGaussianKernel1DDouble(sigmaPixels[d], true);
	}

	final RandomAccessibleInterval<T> out = createOp.calculate(new FinalInterval(
		dims));

	final Cursor<T> cursor = Views.iterable(out).cursor();
	while (cursor.hasNext()) {
		cursor.fwd();
		double result = 1.0f;
		for (int d = 0; d < input.length; d++) {
			result *= kernelArrays[d][cursor.getIntPosition(d)];
		}

		cursor.get().setReal(result);
	}

	return out;
}
 
Example #20
Source File: DefaultDilate.java    From imagej-ops with BSD 2-Clause "Simplified" License 5 votes vote down vote up
@SuppressWarnings({ "rawtypes", "unchecked" })
@Override
public void initialize() {
	minVal = Util.getTypeFromInterval(in()).createVariable();
	minVal.setReal(minVal.getMinValue());

	if (f == null) {
		f = new OutOfBoundsConstantValueFactory<>(minVal);
	}

	imgCreator = (UnaryFunctionOp) Functions.unary(ops(), Ops.Create.Img.class,
		Img.class, in(), minVal.createVariable());

	if (out() == null) setOutput(createOutput(in()));
}
 
Example #21
Source File: ColocUtil.java    From imagej-ops with BSD 2-Clause "Simplified" License 5 votes vote down vote up
public static boolean sameIterationOrder(Iterable<?> i1, Iterable<?> i2) {
	if (!(i1 instanceof IterableInterval) || !(i2 instanceof IterableInterval)) {
		return true;
	}
	IterableInterval<?> ii1 = (IterableInterval<?>) i1;
	IterableInterval<?> ii2 = (IterableInterval<?>) i2;
	return Intervals.equalDimensions(ii1, ii2) && Util.equalIterationOrder(ii1, ii2);
}
 
Example #22
Source File: CopyRAI.java    From imagej-ops with BSD 2-Clause "Simplified" License 5 votes vote down vote up
@Override
public void initialize() {
	final Object outType = out() == null ? Type.class : Util
		.getTypeFromInterval(out());

	final Object inType = in() == null ? NativeType.class : Util
		.getTypeFromInterval(in());

	final UnaryComputerOp<?, ?> typeComputer = Computers.unary(ops(),
		Ops.Copy.Type.class, outType, inType);
	mapComputer = RAIs.computer(ops(), Ops.Map.class, in(), typeComputer);
	createFunc = RAIs.function(ops(), Ops.Create.Img.class, in(), inType);

}
 
Example #23
Source File: CopyImgLabeling.java    From imagej-ops with BSD 2-Clause "Simplified" License 5 votes vote down vote up
@Override
public boolean conforms() {
	if (out() != null) {
		return Intervals.equalDimensions(in(), out())
				&& Util.getTypeFromInterval(in().getIndexImg()).getClass() == Util
						.getTypeFromInterval(out().getIndexImg())
						.getClass();
	}

	return true;
}
 
Example #24
Source File: ListOpen.java    From imagej-ops with BSD 2-Clause "Simplified" License 5 votes vote down vote up
@SuppressWarnings({ "rawtypes", "unchecked" })
@Override
public void initialize() {
	minVal = Util.getTypeFromInterval(in()).createVariable();
	minVal.setReal(minVal.getMinValue());

	imgCreator = (UnaryFunctionOp) Functions.unary(ops(), Ops.Create.Img.class,
		Img.class, in(), minVal.createVariable());

	erodeComputer = Hybrids.binaryCF(ops(), Ops.Morphology.Erode.class, out(),
		in1(), in2(), false);

	dilateComputer = Hybrids.binaryCF(ops(), Ops.Morphology.Dilate.class, out(),
		in1(), in2(), false);
}
 
Example #25
Source File: DeconvolveNamespace.java    From imagej-ops with BSD 2-Clause "Simplified" License 5 votes vote down vote up
private <O extends RealType<O> & NativeType<O>, I extends RealType<I>>
	RandomAccessibleInterval<O> create(final RandomAccessibleInterval<I> in,
		RandomAccessibleInterval<O> imageOfCorrectType)
{
	if (imageOfCorrectType == null) {
		throw new IllegalArgumentException("No way to discern output type");
	}
	return create(in, Util.getTypeFromInterval(imageOfCorrectType));
}
 
Example #26
Source File: RichardsonLucyTVUpdate.java    From imagej-ops with BSD 2-Clause "Simplified" License 5 votes vote down vote up
/**
 * performs update step of the Richardson Lucy with Total Variation Algorithm
 */
@Override
public void compute(I correction, I estimate) {

	if (variation == null) {
		Type<T> type = Util.getTypeFromInterval(correction);

		variation = ops().create().img(correction, type.createVariable());
	}

	divUnitGradFastThread(estimate);

	final Cursor<T> cursorCorrection = Views.iterable(correction).cursor();

	final Cursor<T> cursorVariation = Views.iterable(variation).cursor();

	final Cursor<T> cursorEstimate = Views.iterable(estimate).cursor();

	while (cursorEstimate.hasNext()) {
		cursorCorrection.fwd();
		cursorVariation.fwd();
		cursorEstimate.fwd();

		cursorEstimate.get().mul(cursorCorrection.get());
		cursorEstimate.get().mul(1f / (1f - regularizationFactor * cursorVariation
			.get().getRealFloat()));
	}

}
 
Example #27
Source File: NonCirculantNormalizationFactor.java    From imagej-ops with BSD 2-Clause "Simplified" License 5 votes vote down vote up
@Override
@SuppressWarnings({ "unchecked", "rawtypes" })
public void initialize() {
	create = (UnaryFunctionOp) Functions.unary(ops(), Ops.Create.Img.class,
		Img.class, Dimensions.class, Util.getTypeFromInterval(out()));

	correlater = (BinaryComputerOp) Computers.binary(ops(), CorrelateFFTC.class,
		RandomAccessibleInterval.class, RandomAccessibleInterval.class,
		RandomAccessibleInterval.class, fftInput, fftKernel, true, false);

	divide = new DivideHandleZeroMap<>();
	divide.setEnvironment(ops());
	divide.initialize();
}
 
Example #28
Source File: AbstractIntegralImg.java    From imagej-ops with BSD 2-Clause "Simplified" License 5 votes vote down vote up
@SuppressWarnings("unchecked")
@Override
public RandomAccessibleInterval<RealType<?>> createOutput(
	final RandomAccessibleInterval<I> input)
{
	// Create integral image
	if (Util.getTypeFromInterval(input) instanceof IntegerType) {
		return createLongRAI.calculate(input);
	}

	return createDoubleRAI.calculate(input);
}
 
Example #29
Source File: VectorAccelerator.java    From imagej-ops with BSD 2-Clause "Simplified" License 5 votes vote down vote up
@Override
@SuppressWarnings({ "unchecked", "rawtypes" })
public void initialize() {
	super.initialize();

	factory = new ArrayImgFactory<>();

	create = (UnaryFunctionOp) Functions.unary(ops(), Ops.Create.Img.class,
		Img.class, Dimensions.class, Util.getTypeFromInterval(out()), factory);
}
 
Example #30
Source File: RichardsonLucyC.java    From imagej-ops with BSD 2-Clause "Simplified" License 5 votes vote down vote up
@Override
@SuppressWarnings({ "unchecked", "rawtypes" })
public void initialize() {
	super.initialize();

	if (updateOp == null) {
		updateOp = (UnaryComputerOp) Computers.unary(ops(),
			RichardsonLucyUpdate.class, RandomAccessibleInterval.class,
			RandomAccessibleInterval.class);
	}

	rlCorrectionOp = (BinaryComputerOp) Computers.binary(ops(),
		RichardsonLucyCorrection.class, RandomAccessibleInterval.class,
		RandomAccessibleInterval.class, RandomAccessibleInterval.class,
		getFFTInput(), getFFTKernel());

	fftKernelOp = (UnaryComputerOp) Computers.unary(ops(), FFTMethodsOpC.class,
		getFFTKernel(), RandomAccessibleInterval.class);

	copyOp = (UnaryHybridCF) Hybrids.unaryCF(ops(), Ops.Copy.RAI.class,
		RandomAccessibleInterval.class, IntervalView.class);

	copy2Op = (UnaryHybridCF) Hybrids.unaryCF(ops(), Ops.Copy.RAI.class,
		RandomAccessibleInterval.class, IntervalView.class);

	createOp = (UnaryFunctionOp) Functions.unary(ops(), Ops.Create.Img.class,
		Img.class, Dimensions.class, Util.getTypeFromInterval(out()));

	convolverOp = (BinaryComputerOp) Computers.binary(ops(), ConvolveFFTC.class,
		RandomAccessibleInterval.class, RandomAccessibleInterval.class,
		RandomAccessibleInterval.class, this.getFFTInput(), this.getFFTKernel(),
		true, false);

}