All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.scijava.ops.image.adapt.LiftComputersToRAI Maven / Gradle / Ivy

The newest version!
/*-
 * #%L
 * Image processing operations for SciJava Ops.
 * %%
 * Copyright (C) 2014 - 2024 SciJava developers.
 * %%
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions are met:
 * 
 * 1. Redistributions of source code must retain the above copyright notice,
 *    this list of conditions and the following disclaimer.
 * 2. Redistributions in binary form must reproduce the above copyright notice,
 *    this list of conditions and the following disclaimer in the documentation
 *    and/or other materials provided with the distribution.
 * 
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE
 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 * POSSIBILITY OF SUCH DAMAGE.
 * #L%
 */
/*
 * This is autogenerated source code -- DO NOT EDIT. Instead, edit the
 * corresponding template in templates/ and rerun bin/generate.groovy.
 */

package org.scijava.ops.image.adapt;

import java.util.function.Function;

import org.scijava.function.Computers;
import org.scijava.function.Functions;

import net.imglib2.RandomAccessibleInterval;
import net.imglib2.loops.LoopBuilder;
import net.imglib2.util.Util;

/**
 * Lifts {@link Functions} operating on some types {@code I1, I2, ..., In},
 * {@code O extends Type} to a Function operating on
 * {@link RandomAccessibleInterval}s of those types. An output
 * {@link RandomAccessibleInterval} is created based off of the dimensions of
 * the first input image and using the output type of the passed
 * {@link Function}. The {@code Function} is then applied iteratively
 * over each pixel of the input image(s). NOTE: It is assumed that the input
 * {@code RAI}s are the same size. If they are not, the lifted {@link Function}
 * will only iteratively process the images until one image runs out of pixels
 * to iterate over.
 *
 * @author Gabriel Selzer
 * @author Mark Hiner
 */
public final class LiftComputersToRAI {

	private LiftComputersToRAI() {
		// prevent instantiation of static utility class
	}

	/**
	 * @param computer the original Op
	 * @return the adapted Op
	 * @implNote op names='engine.adapt', priority='100.'
	 */
	 public static , RAIO extends RandomAccessibleInterval> Computers.Arity1 lift11(Computers.Arity1 computer) {
		 return (raiInput1, raiOutput) -> {
			LoopBuilder.setImages(raiInput1, raiOutput).multiThreaded() //
				.forEachPixel((i1, out) -> computer.compute(i1, out));
		};
	}

	/**
	 * @param computer the original Op
	 * @return the adapted Op
	 * @implNote op names='engine.adapt', priority='100.'
	 */
	 public static , RAIO extends RandomAccessibleInterval> Computers.Arity2 lift21(Computers.Arity2 computer) {
		 return (raiInput1, in2, raiOutput) -> {
			LoopBuilder.setImages(raiInput1, raiOutput).multiThreaded() //
				.forEachPixel((i1, out) -> computer.compute(i1, in2, out));
		};
	}

	/**
	 * @param computer the original Op
	 * @return the adapted Op
	 * @implNote op names='engine.adapt', priority='100.'
	 */
	 public static , RAII2 extends RandomAccessibleInterval, RAIO extends RandomAccessibleInterval> Computers.Arity2 lift22(Computers.Arity2 computer) {
		 return (raiInput1, raiInput2, raiOutput) -> {
			LoopBuilder.setImages(raiInput1, raiInput2, raiOutput).multiThreaded() //
				.forEachPixel((i1, i2, out) -> computer.compute(i1, i2, out));
		};
	}

	/**
	 * @param computer the original Op
	 * @return the adapted Op
	 * @implNote op names='engine.adapt', priority='100.'
	 */
	 public static , RAIO extends RandomAccessibleInterval> Computers.Arity3 lift31(Computers.Arity3 computer) {
		 return (raiInput1, in2, in3, raiOutput) -> {
			LoopBuilder.setImages(raiInput1, raiOutput).multiThreaded() //
				.forEachPixel((i1, out) -> computer.compute(i1, in2, in3, out));
		};
	}

	/**
	 * @param computer the original Op
	 * @return the adapted Op
	 * @implNote op names='engine.adapt', priority='100.'
	 */
	 public static , RAII2 extends RandomAccessibleInterval, RAIO extends RandomAccessibleInterval> Computers.Arity3 lift32(Computers.Arity3 computer) {
		 return (raiInput1, raiInput2, in3, raiOutput) -> {
			LoopBuilder.setImages(raiInput1, raiInput2, raiOutput).multiThreaded() //
				.forEachPixel((i1, i2, out) -> computer.compute(i1, i2, in3, out));
		};
	}

	/**
	 * @param computer the original Op
	 * @return the adapted Op
	 * @implNote op names='engine.adapt', priority='100.'
	 */
	 public static , RAII2 extends RandomAccessibleInterval, RAII3 extends RandomAccessibleInterval, RAIO extends RandomAccessibleInterval> Computers.Arity3 lift33(Computers.Arity3 computer) {
		 return (raiInput1, raiInput2, raiInput3, raiOutput) -> {
			LoopBuilder.setImages(raiInput1, raiInput2, raiInput3, raiOutput).multiThreaded() //
				.forEachPixel((i1, i2, i3, out) -> computer.compute(i1, i2, i3, out));
		};
	}

	/**
	 * @param computer the original Op
	 * @return the adapted Op
	 * @implNote op names='engine.adapt', priority='100.'
	 */
	 public static , RAIO extends RandomAccessibleInterval> Computers.Arity4 lift41(Computers.Arity4 computer) {
		 return (raiInput1, in2, in3, in4, raiOutput) -> {
			LoopBuilder.setImages(raiInput1, raiOutput).multiThreaded() //
				.forEachPixel((i1, out) -> computer.compute(i1, in2, in3, in4, out));
		};
	}

	/**
	 * @param computer the original Op
	 * @return the adapted Op
	 * @implNote op names='engine.adapt', priority='100.'
	 */
	 public static , RAII2 extends RandomAccessibleInterval, RAIO extends RandomAccessibleInterval> Computers.Arity4 lift42(Computers.Arity4 computer) {
		 return (raiInput1, raiInput2, in3, in4, raiOutput) -> {
			LoopBuilder.setImages(raiInput1, raiInput2, raiOutput).multiThreaded() //
				.forEachPixel((i1, i2, out) -> computer.compute(i1, i2, in3, in4, out));
		};
	}

	/**
	 * @param computer the original Op
	 * @return the adapted Op
	 * @implNote op names='engine.adapt', priority='100.'
	 */
	 public static , RAII2 extends RandomAccessibleInterval, RAII3 extends RandomAccessibleInterval, RAIO extends RandomAccessibleInterval> Computers.Arity4 lift43(Computers.Arity4 computer) {
		 return (raiInput1, raiInput2, raiInput3, in4, raiOutput) -> {
			LoopBuilder.setImages(raiInput1, raiInput2, raiInput3, raiOutput).multiThreaded() //
				.forEachPixel((i1, i2, i3, out) -> computer.compute(i1, i2, i3, in4, out));
		};
	}

	/**
	 * @param computer the original Op
	 * @return the adapted Op
	 * @implNote op names='engine.adapt', priority='100.'
	 */
	 public static , RAII2 extends RandomAccessibleInterval, RAII3 extends RandomAccessibleInterval, RAII4 extends RandomAccessibleInterval, RAIO extends RandomAccessibleInterval> Computers.Arity4 lift44(Computers.Arity4 computer) {
		 return (raiInput1, raiInput2, raiInput3, raiInput4, raiOutput) -> {
			LoopBuilder.setImages(raiInput1, raiInput2, raiInput3, raiInput4, raiOutput).multiThreaded() //
				.forEachPixel((i1, i2, i3, i4, out) -> computer.compute(i1, i2, i3, i4, out));
		};
	}

	/**
	 * @param computer the original Op
	 * @return the adapted Op
	 * @implNote op names='engine.adapt', priority='100.'
	 */
	 public static , RAIO extends RandomAccessibleInterval> Computers.Arity5 lift51(Computers.Arity5 computer) {
		 return (raiInput1, in2, in3, in4, in5, raiOutput) -> {
			LoopBuilder.setImages(raiInput1, raiOutput).multiThreaded() //
				.forEachPixel((i1, out) -> computer.compute(i1, in2, in3, in4, in5, out));
		};
	}

	/**
	 * @param computer the original Op
	 * @return the adapted Op
	 * @implNote op names='engine.adapt', priority='100.'
	 */
	 public static , RAII2 extends RandomAccessibleInterval, RAIO extends RandomAccessibleInterval> Computers.Arity5 lift52(Computers.Arity5 computer) {
		 return (raiInput1, raiInput2, in3, in4, in5, raiOutput) -> {
			LoopBuilder.setImages(raiInput1, raiInput2, raiOutput).multiThreaded() //
				.forEachPixel((i1, i2, out) -> computer.compute(i1, i2, in3, in4, in5, out));
		};
	}

	/**
	 * @param computer the original Op
	 * @return the adapted Op
	 * @implNote op names='engine.adapt', priority='100.'
	 */
	 public static , RAII2 extends RandomAccessibleInterval, RAII3 extends RandomAccessibleInterval, RAIO extends RandomAccessibleInterval> Computers.Arity5 lift53(Computers.Arity5 computer) {
		 return (raiInput1, raiInput2, raiInput3, in4, in5, raiOutput) -> {
			LoopBuilder.setImages(raiInput1, raiInput2, raiInput3, raiOutput).multiThreaded() //
				.forEachPixel((i1, i2, i3, out) -> computer.compute(i1, i2, i3, in4, in5, out));
		};
	}

	/**
	 * @param computer the original Op
	 * @return the adapted Op
	 * @implNote op names='engine.adapt', priority='100.'
	 */
	 public static , RAII2 extends RandomAccessibleInterval, RAII3 extends RandomAccessibleInterval, RAII4 extends RandomAccessibleInterval, RAIO extends RandomAccessibleInterval> Computers.Arity5 lift54(Computers.Arity5 computer) {
		 return (raiInput1, raiInput2, raiInput3, raiInput4, in5, raiOutput) -> {
			LoopBuilder.setImages(raiInput1, raiInput2, raiInput3, raiInput4, raiOutput).multiThreaded() //
				.forEachPixel((i1, i2, i3, i4, out) -> computer.compute(i1, i2, i3, i4, in5, out));
		};
	}

	/**
	 * @param computer the original Op
	 * @return the adapted Op
	 * @implNote op names='engine.adapt', priority='100.'
	 */
	 public static , RAII2 extends RandomAccessibleInterval, RAII3 extends RandomAccessibleInterval, RAII4 extends RandomAccessibleInterval, RAII5 extends RandomAccessibleInterval, RAIO extends RandomAccessibleInterval> Computers.Arity5 lift55(Computers.Arity5 computer) {
		 return (raiInput1, raiInput2, raiInput3, raiInput4, raiInput5, raiOutput) -> {
			LoopBuilder.setImages(raiInput1, raiInput2, raiInput3, raiInput4, raiInput5, raiOutput).multiThreaded() //
				.forEachPixel((i1, i2, i3, i4, i5, out) -> computer.compute(i1, i2, i3, i4, i5, out));
		};
	}
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy