T
- public class LabelingType<T extends Comparable<T>> extends TypeImpl<LabelingType<T>> implements Type<LabelingType<T>>
Modifier and Type | Field and Description |
---|---|
protected IntAccess |
access |
protected long[] |
generation |
protected mpicbg.imglib.labeling.LabelingMapping<T,Integer> |
mapping |
protected DirectAccessContainer<LabelingType<T>,? extends IntAccess> |
storage |
protected List<T> |
value |
Modifier | Constructor and Description |
---|---|
|
LabelingType() |
|
LabelingType(DirectAccessContainer<LabelingType<T>,? extends IntAccess> storage)
A labeling that supports 2^31 different kinds of label assignments
|
protected |
LabelingType(DirectAccessContainer<LabelingType<T>,? extends IntAccess> storage,
mpicbg.imglib.labeling.LabelingMapping<T,Integer> mapping,
IntAccess access,
long[] generation) |
|
LabelingType(List<T> value) |
Modifier and Type | Method and Description |
---|---|
LabelingType<T> |
copy()
|
LabelingType<T>[] |
createArray1D(int size1)
Creates a 1d array of the generic
Type |
LabelingType<T>[][] |
createArray2D(int size1,
int size2)
Creates a 2d array of the generic
Type |
LabelingType<T>[][][] |
createArray3D(int size1,
int size2,
int size3)
Creates a 3d array of the generic
Type |
DirectAccessContainer<LabelingType<T>,? extends IntAccess> |
createSuitableDirectAccessContainer(DirectAccessContainerFactory storageFactory,
int[] dim)
The
Type creates the DirectAccessContainer used for storing image data; based on the given storage strategy and its size. |
LabelingType<T> |
createVariable()
Creates a new
Type which can only store one value. |
LabelingType<T> |
duplicateTypeOnSameDirectAccessContainer()
Creates a new
Type which stores in the same physical array. |
Display<LabelingType<T>> |
getDefaultDisplay(Image<LabelingType<T>> image)
|
int |
getEntitiesPerPixel() |
List<T> |
getLabeling()
Get the labels defined at the type's current pixel or
|
List<T> |
intern(List<T> labeling)
This method returns the canonical object for the given labeling.
|
List<T> |
intern(T label)
Return the canonical labeling object representing the single labeling.
|
void |
set(LabelingType<T> c)
Sets the value of another
Type . |
void |
setLabel(T label)
Assign a pixel a single label
|
void |
setLabeling(List<T> labeling)
Set the labeling at the current pixel
|
void |
setLabeling(T[] labeling) |
String |
toString() |
void |
updateContainer(Cursor<?> c)
|
decIndex, decIndex, getIndex, incIndex, incIndex, updateIndex
protected final DirectAccessContainer<LabelingType<T extends Comparable<T>>,? extends IntAccess> storage
protected final mpicbg.imglib.labeling.LabelingMapping<T extends Comparable<T>,Integer> mapping
protected List<T extends Comparable<T>> value
protected IntAccess access
protected long[] generation
public LabelingType(DirectAccessContainer<LabelingType<T>,? extends IntAccess> storage)
storage
- public LabelingType()
protected LabelingType(DirectAccessContainer<LabelingType<T>,? extends IntAccess> storage, mpicbg.imglib.labeling.LabelingMapping<T,Integer> mapping, IntAccess access, long[] generation)
public List<T> getLabeling()
public void setLabeling(List<T> labeling)
labeling
- public void setLabeling(T[] labeling)
public void setLabel(T label)
label
- - the label to assignpublic List<T> intern(List<T> labeling)
labeling
- public List<T> intern(T label)
label
- - a label for a pixel.public int getEntitiesPerPixel()
getEntitiesPerPixel
in interface Type<LabelingType<T extends Comparable<T>>>
public DirectAccessContainer<LabelingType<T>,? extends IntAccess> createSuitableDirectAccessContainer(DirectAccessContainerFactory storageFactory, int[] dim)
Type
Type
creates the DirectAccessContainer used for storing image data; based on the given storage strategy and its size. It
basically only decides here which BasicType it uses (float, int, byte, bit, ...) and how many entities per pixel it needs
(e.g. 2 floats per pixel for a complex number). This enables the separation of Image
and the basic types.createSuitableDirectAccessContainer
in interface Type<LabelingType<T extends Comparable<T>>>
storageFactory
- - Which storage strategy is useddim
- - the dimensionsType
knowns the BasicType it contains.public void updateContainer(Cursor<?> c)
Type
Cursor
s to update the data current data array
of the Type
, for example when moving from one Cell
to the next.
If it is only an Array
the Cursor
s never have to call that function.
The idea behind this concept is maybe not obvious. The Type
knows which basic type
is used (float, int, byte, ...) but does not know how it is stored (Array
, CellDirectAccessContainer
, ...) to
prevent multiple implementations of Type
.
That's why Type
asks the DataAccess
to give the actual basic array by passing the Cursor
that calls the method. The DataAccess
is also an Array
, CellDirectAccessContainer
, ... which
can then communicate with the ArrayCursor
, CellCursor
, ... and return the current basic type array.
A typical implementation of this method looks like that (this is the FloatType
implementation):
float[] v = floatStorage.getCurrentStorageArray( c );updateContainer
in interface Type<LabelingType<T extends Comparable<T>>>
c
- - the Cursor
gives a link to itself so that the Type
tell its DataAccess
to get the new basic type array.public LabelingType<T> createVariable()
Type
Type
which can only store one value.createVariable
in interface Type<LabelingType<T extends Comparable<T>>>
Type
instancepublic LabelingType<T> copy()
Type
copy
in interface Type<LabelingType<T extends Comparable<T>>>
copy
in class TypeImpl<LabelingType<T extends Comparable<T>>>
Type
instancepublic LabelingType<T> duplicateTypeOnSameDirectAccessContainer()
Type
Type
which stores in the same physical array. This is only used internally.duplicateTypeOnSameDirectAccessContainer
in interface Type<LabelingType<T extends Comparable<T>>>
Type
instance working on the same DirectAccessContainer
public void set(LabelingType<T> c)
Type
Type
.set
in interface Type<LabelingType<T extends Comparable<T>>>
c
- - the new valuepublic LabelingType<T>[] createArray1D(int size1)
Type
Type
createArray1D
in interface Type<LabelingType<T extends Comparable<T>>>
size1
- - the size of the arraypublic LabelingType<T>[][] createArray2D(int size1, int size2)
Type
Type
createArray2D
in interface Type<LabelingType<T extends Comparable<T>>>
size1
- - the size of the arraysize2
- - the size of the arraypublic LabelingType<T>[][][] createArray3D(int size1, int size2, int size3)
Type
Type
createArray3D
in interface Type<LabelingType<T extends Comparable<T>>>
size1
- - the size of the arraysize2
- - the size of the arraysize3
- - the size of the arraypublic String toString()
toString
in class TypeImpl<LabelingType<T extends Comparable<T>>>
public Display<LabelingType<T>> getDefaultDisplay(Image<LabelingType<T>> image)
Type
Type
creates the default Display
for displaying the image contents. Only Type
can do this as in Image
the Type
is only a Generic. Later the user can create its own Display
s if wanted.
This could be basically a static function.getDefaultDisplay
in interface Type<LabelingType<T extends Comparable<T>>>
image
- - the image to create the Display
forDisplay
Copyright © 2015–2021 Fiji. All rights reserved.