net.imglib2.Interval Java Examples

The following examples show how to use net.imglib2.Interval. 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: TIFFFormat.java    From scifio with BSD 2-Clause "Simplified" License 6 votes vote down vote up
@Override
public void writePlane(final int imageIndex, final long planeIndex,
	final Plane plane, final Interval bounds) throws FormatException,
	IOException
{
	IFD ifd = new IFD(log());
	if (!writeSequential()) {
		final TiffParser parser = new TiffParser(getContext(), getHandle()
			.get());
		try {
			final long[] ifdOffsets = parser.getIFDOffsets();
			if (planeIndex < ifdOffsets.length) {
				ifd = parser.getIFD(ifdOffsets[(int) planeIndex]);
			}
		}
		finally {
			final DataHandle<Location> tiffHandle = parser.getStream();
			if (tiffHandle != null) {
				tiffHandle.close();
			}
		}
	}
	if (planeIndex == 0) addDimensionalAxisInfo(ifd, imageIndex);

	savePlane(imageIndex, planeIndex, plane, ifd, bounds);
}
 
Example #2
Source File: FractalSpimDataGenerator.java    From BigStitcher with GNU General Public License v2.0 6 votes vote down vote up
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 );
	*/
}
 
Example #3
Source File: Grids.java    From paintera with GNU General Public License v2.0 6 votes vote down vote up
/**
	 *
	 * Snap {@code interval} to {@code cellGrid}, i.e. increase/decrease min/max such that
	 * min/max are integer multiples of block size/cell size. The snapped interval is restricted
	 * to the interval defined by {@code cellGrid}.
	 *
	 * @param interval to be snapped to grid
	 * @param cellGrid defines the block size/cell size to which to snap
	 * @return new interval that is aligned with block size/cell size of {@code cellGrid}
	 */
	public static Interval snapToGrid(
			final Interval interval,
			final CellGrid cellGrid)
	{
		assert interval.numDimensions() == cellGrid.numDimensions();
		final Interval intersectedInterval = Intervals.intersect(
				interval,
				new FinalInterval(cellGrid.getImgDimensions()));
		final int nDim = cellGrid.numDimensions();
		final long[] snappedMin = new long[nDim];
		final long[] snappedMax = new long[nDim];
		for (int d = 0; d < nDim; ++d)
		{
			final long min = intersectedInterval.min(d);
			final long max = intersectedInterval.max(d);
			final int blockSize = cellGrid.cellDimension(d);
			snappedMin[d] = Math.max(snapDown(min, blockSize), 0);
			snappedMax[d] = Math.min(snapUp(max, blockSize), cellGrid.imgDimension(d) - 1);
//			snappedMin[d] = Math.max(min - (min % blockSize), 0);
//			snappedMax[d] = Math.min(max - (max % blockSize), cellGrid.imgDimension(d)) - 1;
		}
		return new FinalInterval(snappedMin, snappedMax);
	}
 
Example #4
Source File: ICSFormat.java    From scifio with BSD 2-Clause "Simplified" License 6 votes vote down vote up
@Override
protected void initialize(final int imageIndex, final long planeIndex,
	final Interval bounds) throws FormatException, IOException
{
	if (!isInitialized(imageIndex, (int) planeIndex)) {

		if (!SCIFIOMetadataTools.wholePlane(imageIndex, getMetadata(),
			bounds))
		{
			pixels.seek(pixelOffset + (planeIndex + 1) * getMetadata().get(
				imageIndex).getPlaneSize());
		}
	}

	super.initialize(imageIndex, planeIndex, bounds);
}
 
Example #5
Source File: AbstractWriter.java    From scifio with BSD 2-Clause "Simplified" License 6 votes vote down vote up
/**
 * Ensure that the arguments that are being passed to saveBytes(...) are
 * valid.
 *
 * @throws FormatException if any of the arguments is invalid.
 */
protected void checkParams(final int imageIndex, final long planeIndex,
	final byte[] buf, final Interval bounds) throws FormatException
{
	SCIFIOMetadataTools.verifyMinimumPopulated(metadata, out, imageIndex);

	if (buf == null) throw new FormatException("Buffer cannot be null.");
	long planes = metadata.get(imageIndex).getPlaneCount();

	if (metadata.get(imageIndex).isMultichannel()) planes *= metadata.get(
		imageIndex).getAxisLength(Axes.CHANNEL);

	if (planeIndex < 0) throw new FormatException(String.format(
		"Plane index:%d must be >= 0", planeIndex));
	if (planeIndex >= planes) {
		throw new FormatException(String.format("Plane index:%d must be < %d",
			planeIndex, planes));
	}

	FormatTools.checkPlaneForWriting(getMetadata(), imageIndex, planeIndex,
		buf.length, bounds);
	FormatTools.assertId(out, true, 0);
}
 
Example #6
Source File: APNGFormat.java    From scifio with BSD 2-Clause "Simplified" License 6 votes vote down vote up
@Override
public void writePlane(final int imageIndex, final long planeIndex,
	final Plane plane, final Interval bounds) throws FormatException,
	IOException
{
	checkParams(imageIndex, planeIndex, plane.getBytes(), bounds);
	if (!SCIFIOMetadataTools.wholePlane(imageIndex, getMetadata(), bounds)) {
		throw new FormatException(
			"APNGWriter does not yet support saving image tiles.");
	}

	// write the data for this frame

	if (numFrames == 0) {
		// This is the first frame, and also the default image
		writePixels(imageIndex, "IDAT", plane, bounds);
	}
	else {
		writeFCTL(planeIndex);
		writePixels(imageIndex, "fdAT", plane, bounds);
	}
	numFrames++;
}
 
Example #7
Source File: TIFFFormat.java    From scifio with BSD 2-Clause "Simplified" License 6 votes vote down vote up
@Override
protected void initialize(final int imageIndex, final long planeIndex,
	final Interval bounds) throws FormatException, IOException
{
	// Ensure that no more than one thread manipulated the initialized
	// array at one time.
	synchronized (this) {
		if (!isInitialized(imageIndex, (int) planeIndex) && (getHandle()
			.length() == 0 || !getHandle().exists()))
		{
			getHandle().ensureWritable(0);
			// write TIFF header
			tiffSaver.writeHeader();
		}
	}
}
 
Example #8
Source File: SlicesII.java    From imagej-ops with BSD 2-Clause "Simplified" License 6 votes vote down vote up
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);
	}
 
Example #9
Source File: Imgs.java    From imagej-ops with BSD 2-Clause "Simplified" License 6 votes vote down vote up
/**
 * 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;
}
 
Example #10
Source File: AbstractReader.java    From scifio with BSD 2-Clause "Simplified" License 6 votes vote down vote up
@Override
public P openPlane(final int imageIndex, final long planeIndex,
	final Interval bounds, final SCIFIOConfig config) throws FormatException,
	IOException
{
	P plane = null;

	try {
		plane = createPlane(bounds);
	}
	catch (final IllegalArgumentException e) {
		throw new FormatException("Image plane too large. Only 2GB of data can " +
			"be extracted at one time. You can workaround the problem by opening " +
			"the plane in tiles; for further details, see: " +
			"http://www.openmicroscopy.org/site/support/faq/bio-formats/" +
			"i-see-an-outofmemory-or-negativearraysize-error-message-when-" +
			"attempting-to-open-an-svs-or-jpeg-2000-file.-what-does-this-mean", e);
	}

	return openPlane(imageIndex, planeIndex, plane, bounds, config);
}
 
Example #11
Source File: MeshGeneratorJobManager.java    From paintera with GNU General Public License v2.0 6 votes vote down vote up
private ShapeKey<T> createShapeKey(
		final CellGrid grid,
		final long index,
		final int scaleLevel,
		final SceneUpdateParameters sceneUpdateParameters)
{
	final Interval blockInterval = Grids.getCellInterval(grid, index);
	return new ShapeKey<>(
			identifier,
			scaleLevel,
			sceneUpdateParameters.simplificationIterations,
			sceneUpdateParameters.smoothingLambda,
			sceneUpdateParameters.smoothingIterations,
			sceneUpdateParameters.minLabelRatio,
			Intervals.minAsLongArray(blockInterval),
			Intervals.maxAsLongArray(blockInterval)
		);
}
 
Example #12
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 #13
Source File: MaskedSource.java    From paintera with GNU General Public License v2.0 6 votes vote down vote up
public static TLongSet affectedBlocks(final long[] gridDimensions, final int[] blockSize, final Interval interval)
{
	final TLongHashSet blocks              = new TLongHashSet();
	final int[]        ones                = IntStream.generate(() -> 1).limit(blockSize.length).toArray();
	final long[]       relevantIntervalMin = new long[blockSize.length];
	final long[]       relevantIntervalMax = new long[blockSize.length];
	Arrays.setAll(relevantIntervalMin, d -> (interval.min(d) / blockSize[d]));
	Arrays.setAll(relevantIntervalMax, d -> (interval.max(d) / blockSize[d]));
	Grids.forEachOffset(
			relevantIntervalMin,
			relevantIntervalMax,
			ones,
			offset -> blocks.add(IntervalIndexer.positionToIndex(offset, gridDimensions))
	                   );

	return blocks;
}
 
Example #14
Source File: MaskedSource.java    From paintera with GNU General Public License v2.0 6 votes vote down vote up
public static TLongSet affectedBlocks(final long[] gridDimensions, final int[] blockSize, final Interval...
		intervals)
{
	final TLongHashSet blocks              = new TLongHashSet();
	final int[]        ones                = IntStream.generate(() -> 1).limit(blockSize.length).toArray();
	final long[]       relevantIntervalMin = new long[blockSize.length];
	final long[]       relevantIntervalMax = new long[blockSize.length];
	for (final Interval interval : intervals)
	{
		Arrays.setAll(relevantIntervalMin, d -> (interval.min(d) / blockSize[d]));
		Arrays.setAll(relevantIntervalMax, d -> (interval.max(d) / blockSize[d]));
		Grids.forEachOffset(
				relevantIntervalMin,
				relevantIntervalMax,
				ones,
				offset -> blocks.add(IntervalIndexer.positionToIndex(offset, gridDimensions))
		                   );
	}

	return blocks;
}
 
Example #15
Source File: ListDilate.java    From imagej-ops with BSD 2-Clause "Simplified" License 6 votes vote down vote up
@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);
}
 
Example #16
Source File: GIFFormat.java    From scifio with BSD 2-Clause "Simplified" License 5 votes vote down vote up
@Override
public ByteArrayPlane openPlane(final int imageIndex, final long planeIndex,
	final ByteArrayPlane plane, final Interval bounds,
	final SCIFIOConfig config) throws FormatException, IOException
{
	final byte[] buf = plane.getData();
	final Metadata meta = getMetadata();
	final int xIndex = meta.get(imageIndex).getAxisIndex(Axes.X);
	final int yIndex = meta.get(imageIndex).getAxisIndex(Axes.Y);
	plane.setColorTable(meta.getColorTable(0, 0));
	FormatTools.checkPlaneForReading(meta, imageIndex, planeIndex, buf.length,
		bounds);
	final int x = (int) bounds.min(xIndex);
	final int y = (int) bounds.min(yIndex);
	final int w = (int) bounds.dimension(xIndex);
	final int h = (int) bounds.dimension(yIndex);
	final int[] act = meta.getColorTables().get((int) planeIndex);

	final byte[] b = meta.getImages().get((int) planeIndex);
	if (planeIndex > 0 && meta.isTransparency()) {
		final byte[] prev = meta.getImages().get((int) planeIndex - 1);
		int idx = meta.getTransIndex();
		if (idx >= 127) idx = 0;
		for (int i = 0; i < b.length; i++) {
			if ((act[b[i] & 0xff] & 0xffffff) == idx) {
				b[i] = prev[i];
			}
		}
		meta.getImages().setElementAt(b, (int) planeIndex);
	}

	for (int row = 0; row < h; row++) {
		System.arraycopy(b, (row + y) * (int) meta.get(imageIndex)
			.getAxisLength(Axes.X) + x, buf, row * w, w);
	}

	return plane;
}
 
Example #17
Source File: AbstractReader.java    From scifio with BSD 2-Clause "Simplified" License 5 votes vote down vote up
@Override
public P openPlane(final int imageIndex, final long planeIndex,
	final Plane plane, final Interval bounds) throws FormatException,
	IOException
{
	return openPlane(imageIndex, planeIndex, this.<P> castToTypedPlane(plane),
		bounds);
}
 
Example #18
Source File: Blending.java    From BigStitcher with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 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 Blending( final Interval interval, final float[] border, final float[] blending )
{
	// in case the interval is actually image data re-instantiate just a simple FinalInterval
	this.interval = new FinalInterval( interval );
	this.border = border;
	this.blending = blending;
}
 
Example #19
Source File: FractalSpimDataGenerator.java    From BigStitcher with GNU General Public License v2.0 5 votes vote down vote up
public static List< RealLocalizable > getTileMins(List<Interval> intervals)
{
	final List<RealLocalizable> mins = new ArrayList<>();
	for(Interval iv : intervals)
	{
		RealPoint min = new RealPoint( iv.numDimensions() );
		iv.min( min );
		mins.add( min );
	}
	return mins;
}
 
Example #20
Source File: PadInput.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();

	paddingIntervalCentered = (BinaryFunctionOp) Functions.unary(ops(),
		PaddingIntervalCentered.class, Interval.class,
		RandomAccessibleInterval.class, paddedDimensions.getClass());
}
 
Example #21
Source File: AbstractReaderFilter.java    From scifio with BSD 2-Clause "Simplified" License 5 votes vote down vote up
@Override
public Plane readPlane(final DataHandle<Location> s, final int imageIndex,
	final Interval bounds, final Plane plane) throws IOException
{
	readPlaneHelper();
	return getParent().readPlane(s, imageIndex, bounds, plane);
}
 
Example #22
Source File: ChannelFiller.java    From scifio with BSD 2-Clause "Simplified" License 5 votes vote down vote up
@Override
public Plane openPlane(final int imageIndex, final long planeIndex,
	final Plane plane, final SCIFIOConfig config) throws FormatException,
	IOException
{
	final Interval bounds = planarBounds(imageIndex);
	return openPlane(imageIndex, planeIndex, plane, bounds, config);
}
 
Example #23
Source File: MaskedSource.java    From paintera with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Downsample affected blocks of img.
 * @param source
 * @param img
 * @param affectedBlocks
 * @param steps
 * @param interval
 */
public static void downsampleBlocks(
		final RandomAccessible<UnsignedLongType> source,
		final CachedCellImg<UnsignedLongType, LongAccess> img,
		final TLongSet affectedBlocks,
		final int[] steps,
		final Interval interval)
{
	final BlockSpec blockSpec = new BlockSpec(img.getCellGrid());

	final long[] intersectedCellMin = new long[blockSpec.grid.numDimensions()];
	final long[] intersectedCellMax = new long[blockSpec.grid.numDimensions()];

	LOG.debug("Initializing affected blocks: {}", affectedBlocks);
	for (final TLongIterator it = affectedBlocks.iterator(); it.hasNext(); )
	{
		final long blockId = it.next();
		blockSpec.fromLinearIndex(blockId);

		Arrays.setAll(intersectedCellMin, d -> blockSpec.min[d]);
		Arrays.setAll(intersectedCellMax, d -> blockSpec.max[d]);

		intersect(intersectedCellMin, intersectedCellMax, interval);

		if (isNonEmpty(intersectedCellMin, intersectedCellMax))
		{
			LOG.trace("Downsampling for intersected min/max: {} {}", intersectedCellMin, intersectedCellMax);
			downsample(source, Views.interval(img, intersectedCellMin, intersectedCellMax), steps);
		}
	}
}
 
Example #24
Source File: FractalSpimDataGenerator.java    From BigStitcher with GNU General Public License v2.0 5 votes vote down vote up
/**
 * @param start the first interval
 * @param n number of tiles in x
 * @param m number of tiles in y
 * @param overlap overlap e (0-1)
 * @return intervals
 */
public static List<Interval> generateTileList(Interval start, int n, int m, double overlap)
{
	List<Interval> res = new ArrayList<>();
	for (int x = 0; x < n; ++x){
		for (int y = 0; y < m; ++y){
			
			Interval tInterval = new FinalInterval( start );
			tInterval = Intervals.translate( tInterval, (long) ( x * (1 - overlap) * start.dimension( 0 ) ), 0 );
			tInterval = Intervals.translate( tInterval, (long) ( y * (1 - overlap) * start.dimension( 1 ) ), 1 );
			res.add( tInterval );
		}
	}
	return res;
}
 
Example #25
Source File: DimensionSwapper.java    From scifio with BSD 2-Clause "Simplified" License 5 votes vote down vote up
@Override
public Plane openPlane(final int imageIndex, final long planeIndex,
	final Plane plane, final Interval bounds, final SCIFIOConfig config)
	throws FormatException, IOException
{
	return super.openPlane(imageIndex, reorder(imageIndex, planeIndex), plane,
		bounds, config);
}
 
Example #26
Source File: CreateNamespace.java    From imagej-ops with BSD 2-Clause "Simplified" License 5 votes vote down vote up
@OpMethod(
	op = net.imagej.ops.create.imgLabeling.CreateImgLabelingFromInterval.class)
public <L, T extends IntegerType<T>> ImgLabeling<L, T> imgLabeling(
	final Interval interval)
{
	@SuppressWarnings("unchecked")
	final ImgLabeling<L, T> result =
		(ImgLabeling<L, T>) ops().run(
			Ops.Create.ImgLabeling.class,
			interval);
	return result;
}
 
Example #27
Source File: StratecPQCTFormatTest.java    From scifio with BSD 2-Clause "Simplified" License 5 votes vote down vote up
@Test
public void testOpenPlane() throws Exception {
	final short width = 10;
	final short height = 10;
	final int planeBytes = width * height * 2;
	final ByteArrayPlane plane = new ByteArrayPlane();
	plane.setData(new byte[planeBytes]);
	final ByteBuffer buffer = ByteBuffer.allocate(
		StratecPQCTFormat.HEADER_SIZE + planeBytes);
	buffer.order(ByteOrder.LITTLE_ENDIAN);
	buffer.position(1529);
	buffer.putShort(width);
	buffer.putShort(height);
	final DataHandle<Location> handle = handles.create(new BytesLocation(buffer
		.array()));
	final Reader reader = (Reader) format.createReader();
	reader.setSource(handle);

	// EXECUTE
	final Interval bounds = new FinalInterval(width, height);
	reader.openPlane(0, 0, plane, bounds, new SCIFIOConfig());

	// VERIFY
	assertEquals(
		"Position of stream incorrect: should point to the end of the stream",
		StratecPQCTFormat.HEADER_SIZE + planeBytes, handle.offset());
}
 
Example #28
Source File: Blending.java    From SPIM_Registration with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 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 Blending( final Interval interval, final float[] border, final float[] blending )
{
	// in case the interval is actually image data re-instantiate just a simple FinalInterval
	this.interval = new FinalInterval( interval );
	this.border = border;
	this.blending = blending;
}
 
Example #29
Source File: TransformNamespace.java    From imagej-ops with BSD 2-Clause "Simplified" License 5 votes vote down vote up
/**
 * Executes the "crop" operation on the given arguments.
 *
 * @param in
 * @param interval
 * @param dropSingleDimensions
 * @return
 */
@OpMethod(op = net.imagej.ops.transform.crop.CropImgPlus.class)
public <T extends Type<T>> ImgPlus<T> crop(final ImgPlus<T> in,
	final Interval interval, final boolean dropSingleDimensions)
{
	@SuppressWarnings("unchecked")
	final ImgPlus<T> result = (ImgPlus<T>) ops().run(Ops.Transform.Crop.class,
		in, interval, dropSingleDimensions);
	return result;
}
 
Example #30
Source File: TransformNamespace.java    From imagej-ops with BSD 2-Clause "Simplified" License 5 votes vote down vote up
/**
 * Executes the "crop" operation on the given arguments.
 *
 * @param in
 * @param interval
 * @param dropSingleDimensions
 * @return
 */
@OpMethod(op = net.imagej.ops.transform.crop.CropRAI.class)
public <T> RandomAccessibleInterval<T> crop(
	final RandomAccessibleInterval<T> in, final Interval interval,
	final boolean dropSingleDimensions)
{
	@SuppressWarnings("unchecked")
	final RandomAccessibleInterval<T> result =
		(RandomAccessibleInterval<T>) ops().run(Ops.Transform.Crop.class, in,
			interval, dropSingleDimensions);
	return result;
}