Class AbstractBitType<T extends AbstractBitType<T>>
- java.lang.Object
-
- net.imglib2.type.AbstractBitType<T>
-
- All Implemented Interfaces:
NativeType<T>,ValueEquals<T>,Type<T>
- Direct Known Subclasses:
AbstractBit64Type,AbstractIntegerBitType
public abstract class AbstractBitType<T extends AbstractBitType<T>> extends java.lang.Object implements NativeType<T>
Provides basic infrastructure to implement Types based on single bits stored in a LongAccess
-
-
Field Summary
Fields Modifier and Type Field Description protected LongAccessdataAccessprotected Indexiprotected NativeImg<?,? extends LongAccess>imgprotected intnBits
-
Constructor Summary
Constructors Constructor Description AbstractBitType(NativeImg<?,? extends LongAccess> bitStorage, int nBits)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description FractiongetEntitiesPerPixel()Get the number of entities in the storage array required to store one pixel value.abstract NativeTypeFactory<T,LongAccess>getNativeTypeFactory()Indexindex()Get the (modifiable) index into the current data array.voidupdateContainer(java.lang.Object c)This method is used by an accessor (e.g., aCursor) to request an update of the current data array.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface net.imglib2.type.NativeType
decIndex, decIndex, duplicateTypeOnSameNativeImg, getIndex, incIndex, incIndex, updateIndex
-
Methods inherited from interface net.imglib2.type.Type
copy, createVariable, set
-
Methods inherited from interface net.imglib2.type.operators.ValueEquals
valueEquals
-
-
-
-
Field Detail
-
i
protected final Index i
-
nBits
protected final int nBits
-
img
protected final NativeImg<?,? extends LongAccess> img
-
dataAccess
protected LongAccess dataAccess
-
-
Constructor Detail
-
AbstractBitType
public AbstractBitType(NativeImg<?,? extends LongAccess> bitStorage, int nBits)
-
-
Method Detail
-
updateContainer
public void updateContainer(java.lang.Object c)
Description copied from interface:NativeTypeThis method is used by an accessor (e.g., aCursor) to request an update of the current data array.As an example consider a
CellCursormoving on aCellImg. The cursor maintains aNativeTypewhich provides access to the image data. When the cursor moves from one cell to the next, the underlying data array of theNativeTypemust be switched to the data array of the new cell.To achieve this, the
CellCursorcallsupdateContainer()with itself as the argument.updateContainer()in turn will callNativeImg.update(Object)on it's container, passing along the reference to the cursor. In this example, the container would be aCellImg. While theNativeTypedoes not know about the type of the cursor, the container does.CellImgknows that it is passed aCellCursorinstance, which can be used to figure out the current cell and the underlying data array, which is then returned to theNativeType.The idea behind this concept is maybe not obvious. The
NativeTypeknows which basic type is used (float, int, byte, ...). However, it does not know how the data is stored (ArrayImg,CellImg, ...). This prevents the need for multiple implementations ofNativeType.- Specified by:
updateContainerin interfaceNativeType<T extends AbstractBitType<T>>- Parameters:
c- reference to an accessor which can be passed on to the container (which will know what to do with it).
-
index
public Index index()
Description copied from interface:NativeTypeGet the (modifiable) index into the current data array. The returned instance will always be the same for the same Type.- Specified by:
indexin interfaceNativeType<T extends AbstractBitType<T>>
-
getNativeTypeFactory
public abstract NativeTypeFactory<T,LongAccess> getNativeTypeFactory()
- Specified by:
getNativeTypeFactoryin interfaceNativeType<T extends AbstractBitType<T>>
-
getEntitiesPerPixel
public Fraction getEntitiesPerPixel()
Description copied from interface:NativeTypeGet the number of entities in the storage array required to store one pixel value. A pixel value may be spread over several or less than one entity. For example, a complex number may require 2 entries of a float[] array to store one pixel. Or a 12-bit type might need 12/64th entries of a long[] array.- Specified by:
getEntitiesPerPixelin interfaceNativeType<T extends AbstractBitType<T>>- Returns:
- the number of storage type entities required to store one pixel value.
-
-