public class ImgUtils extends Object
RandomAccessibleInterval
sModifier and Type | Method and Description |
---|---|
static List<Interval> |
createIntervals(long[] sourceDimensions,
long[] blockDimensions)
Partition the source dimensions into a list of
Interval s with given dimensions. |
static <T extends RealType<T>> |
getCtSlice(Dataset dataset,
int channelIndex,
int frameIndex)
Get a view of the
Dataset at the specified channel and frame. |
static <T extends RealType<T>> |
getCtSlice3d(Dataset dataset,
int channelIndex,
int frameIndex)
Get a 3D view of a
Dataset at the specified channel and frame. |
static int |
maxDimension(long[] dimensions) |
static boolean |
outOfBounds(long[] pos,
long[] min,
long[] max)
Checks if pos is outside the bounds given by min and max
|
static <T extends NumericType<T>> |
raiToImp(RandomAccessibleInterval<T> rai,
String title)
Convert a
RandomAccessibleInterval to an ImagePlus . |
static <T> List<IntervalView<T>> |
splitIntoBlocks(RandomAccessibleInterval<T> source,
long[] blockDimensions)
Partition the source rai into a list of
IntervalView with given dimensions. |
static <T> RandomAccessibleInterval<T> |
subInterval(RandomAccessibleInterval<T> img,
Localizable p1,
Localizable p2,
long padPixels)
Get an N-D sub-interval of an N-D image, given two corner points and specified padding.
|
static <T> RandomAccessibleInterval<T> |
subVolume(RandomAccessibleInterval<T> img,
long x1,
long y1,
long z1,
long x2,
long y2,
long z2,
long padPixels)
Get a 3D sub-volume of an image, given two corner points and specified padding.
|
public static int maxDimension(long[] dimensions)
dimensions
- public static <T> RandomAccessibleInterval<T> subVolume(RandomAccessibleInterval<T> img, long x1, long y1, long z1, long x2, long y2, long z2, long padPixels)
T
- img
- the source intervalx1
- x-coordinate of the first corner pointy1
- y-coordinate of the first corner pointz1
- z-coordinate of the first corner pointx2
- x-coordinate of the second corner pointy2
- y-cooridnate of the second corner pointz2
- z-coordinate of the second corner pointpadPixels
- the amount of padding in each dimension, in pixelspublic static <T> RandomAccessibleInterval<T> subInterval(RandomAccessibleInterval<T> img, Localizable p1, Localizable p2, long padPixels)
T
- img
- the source intervalp1
- the first corner pointp2
- the second corner pointpadPixels
- the amount of padding in each dimension, in pixelspublic static <T> List<IntervalView<T>> splitIntoBlocks(RandomAccessibleInterval<T> source, long[] blockDimensions)
IntervalView
with given dimensions. If the block dimensions are not
multiples of the image dimensions, some blocks will have truncated dimensions.T
- source
- the source raiblockDimensions
- the target block sizepublic static List<Interval> createIntervals(long[] sourceDimensions, long[] blockDimensions)
Interval
s with given dimensions. If the block dimensions
are not multiples of the image dimensions, some blocks will have slightly different dimensions.sourceDimensions
- the source dimensionsblockDimensions
- the target block sizepublic static <T extends NumericType<T>> ij.ImagePlus raiToImp(RandomAccessibleInterval<T> rai, String title)
RandomAccessibleInterval
to an ImagePlus
. If the input has 3 dimensions,
the 3rd dimension is treated as depth.T
- rai
- the source raititle
- the title for the converted ImagePluspublic static <T extends RealType<T>> RandomAccessibleInterval<T> getCtSlice3d(Dataset dataset, int channelIndex, int frameIndex)
Dataset
at the specified channel and frame. If the Dataset is 2D, a singleton dimension
is added.T
- dataset
- the input DatasetchannelIndex
- the channel position, 0-indexedframeIndex
- the time position, 0-indexedpublic static <T extends RealType<T>> RandomAccessibleInterval<T> getCtSlice(Dataset dataset, int channelIndex, int frameIndex)
Dataset
at the specified channel and frame.T
- dataset
- the input DatasetchannelIndex
- the channel position, 0-indexedframeIndex
- the time position, 0-indexedpublic static boolean outOfBounds(long[] pos, long[] min, long[] max)
pos
- the position to checkmin
- the minimum of the intervalmax
- the maximum of the intervalCopyright © 2015–2021 Fiji. All rights reserved.