Package net.imglib2.img.cell
Class CellImgFactory<T extends NativeType<T>>
- java.lang.Object
-
- net.imglib2.img.ImgFactory<T>
-
- net.imglib2.img.NativeImgFactory<T>
-
- net.imglib2.img.cell.CellImgFactory<T>
-
public class CellImgFactory<T extends NativeType<T>> extends NativeImgFactory<T>
Factory for creatingCellImgs
. The cell dimensions for a standard cell can be supplied in the constructor of the factory. If no cell dimensions are given, the factory creates cells of size 10 x 10 x ... x 10.- Author:
- Tobias Pietzsch
-
-
Constructor Summary
Constructors Constructor Description CellImgFactory()
CellImgFactory(int... cellDimensions)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description CellImg<T,?>
create(long[] dim, T type)
CellImg<T,ByteArray>
createByteInstance(long[] dimensions, Fraction entitiesPerPixel)
CellImg<T,CharArray>
createCharInstance(long[] dimensions, Fraction entitiesPerPixel)
CellImg<T,DoubleArray>
createDoubleInstance(long[] dimensions, Fraction entitiesPerPixel)
CellImg<T,FloatArray>
createFloatInstance(long[] dimensions, Fraction entitiesPerPixel)
CellImg<T,IntArray>
createIntInstance(long[] dimensions, Fraction entitiesPerPixel)
CellImg<T,LongArray>
createLongInstance(long[] dimensions, Fraction entitiesPerPixel)
CellImg<T,ShortArray>
createShortInstance(long[] dimensions, Fraction entitiesPerPixel)
static int[]
getCellDimensions(int[] defaultCellDimensions, int n, Fraction entitiesPerPixel)
Computes cell size array by truncating or expandingdefaultCellDimensions
to lengthn
.<S> ImgFactory<S>
imgFactory(S type)
Creates the sameImgFactory
for a different generic parameter if possible.static void
verifyDimensions(int[] dimensions)
Verify thatdimensions
is not null or empty, and that no dimension is less than 1.static void
verifyDimensions(long[] dimensions)
Verify thatdimensions
is not null or empty, and that no dimension is less than 1.-
Methods inherited from class net.imglib2.img.ImgFactory
create, create, create, create, create, imgFactory
-
-
-
-
Method Detail
-
verifyDimensions
public static void verifyDimensions(int[] dimensions) throws java.lang.IllegalArgumentException
Verify thatdimensions
is not null or empty, and that no dimension is less than 1. ThrowIllegalArgumentException
otherwise.- Parameters:
dimensions
-- Throws:
java.lang.IllegalArgumentException
-
verifyDimensions
public static void verifyDimensions(long[] dimensions) throws java.lang.IllegalArgumentException
Verify thatdimensions
is not null or empty, and that no dimension is less than 1. ThrowIllegalArgumentException
otherwise.- Parameters:
dimensions
-- Throws:
java.lang.IllegalArgumentException
-
getCellDimensions
public static int[] getCellDimensions(int[] defaultCellDimensions, int n, Fraction entitiesPerPixel) throws java.lang.IllegalArgumentException
Computes cell size array by truncating or expandingdefaultCellDimensions
to lengthn
. Then verifies that a cell does not contain more thanInteger.MAX_VALUE
entities.- Parameters:
defaultCellDimensions
-n
-entitiesPerPixel
-- Returns:
- Throws:
java.lang.IllegalArgumentException
-
create
public CellImg<T,?> create(long[] dim, T type)
Description copied from class:NativeImgFactory
This class will ask theType
to create a suitableImg
for theType
and the dimensionality.Type
will then call one of the abstract methods defined below to create theNativeImg
- Overrides:
create
in classNativeImgFactory<T extends NativeType<T>>
- Returns:
Img
- the instantiated Container
-
createByteInstance
public CellImg<T,ByteArray> createByteInstance(long[] dimensions, Fraction entitiesPerPixel)
- Specified by:
createByteInstance
in classNativeImgFactory<T extends NativeType<T>>
-
createCharInstance
public CellImg<T,CharArray> createCharInstance(long[] dimensions, Fraction entitiesPerPixel)
- Specified by:
createCharInstance
in classNativeImgFactory<T extends NativeType<T>>
-
createShortInstance
public CellImg<T,ShortArray> createShortInstance(long[] dimensions, Fraction entitiesPerPixel)
- Specified by:
createShortInstance
in classNativeImgFactory<T extends NativeType<T>>
-
createIntInstance
public CellImg<T,IntArray> createIntInstance(long[] dimensions, Fraction entitiesPerPixel)
- Specified by:
createIntInstance
in classNativeImgFactory<T extends NativeType<T>>
-
createLongInstance
public CellImg<T,LongArray> createLongInstance(long[] dimensions, Fraction entitiesPerPixel)
- Specified by:
createLongInstance
in classNativeImgFactory<T extends NativeType<T>>
-
createFloatInstance
public CellImg<T,FloatArray> createFloatInstance(long[] dimensions, Fraction entitiesPerPixel)
- Specified by:
createFloatInstance
in classNativeImgFactory<T extends NativeType<T>>
-
createDoubleInstance
public CellImg<T,DoubleArray> createDoubleInstance(long[] dimensions, Fraction entitiesPerPixel)
- Specified by:
createDoubleInstance
in classNativeImgFactory<T extends NativeType<T>>
-
imgFactory
public <S> ImgFactory<S> imgFactory(S type) throws IncompatibleTypeException
Description copied from class:ImgFactory
Creates the sameImgFactory
for a different generic parameter if possible. If the type "S" does not suit the needs of theImgFactory
(for example implementNativeType
in allNativeImgFactory
, this method will throw anIncompatibleTypeException
.- Specified by:
imgFactory
in classImgFactory<T extends NativeType<T>>
- Type Parameters:
S
- the new type- Parameters:
type
- an instance of S- Returns:
ImgFactory
of type S- Throws:
IncompatibleTypeException
- if type S is not compatible
-
-