Class AbstractBitType<T extends AbstractBitType<T>>
- All Implemented Interfaces:
NativeType<T>,ValueEquals<T>,Type<T>
- Direct Known Subclasses:
AbstractBit64Type,AbstractIntegerBitType
- Author:
- Albert Cardona, Stephan Preibisch
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected LongAccessprotected longprotected final NativeImg<?, ? extends LongAccess> protected final int -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoiddecIndex()Decrement the index into the current data array.voiddecIndex(int decrement) Decrease the index into the current data array bydecrementsteps.Get the number of entities in the storage array required to store one pixel value.intgetIndex()Get the current index into the current data array.voidincIndex()Increment the index into the current data array.voidincIndex(int increment) Increases the index into the current data array byincrementsteps.voidThis method is used by an accessor (e.g., aCursor) to request an update of the current data array.voidupdateIndex(int index) Set the index into the current data array.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface net.imglib2.type.NativeType
createSuitableNativeImg, duplicateTypeOnSameNativeImgMethods inherited from interface net.imglib2.type.Type
copy, createVariable, setMethods inherited from interface net.imglib2.type.operators.ValueEquals
valueEquals
-
Field Details
-
i
protected long i -
nBits
protected final int nBits -
img
-
dataAccess
-
-
Constructor Details
-
AbstractBitType
-
-
Method Details
-
updateContainer
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).
-
getIndex
public int getIndex()Description copied from interface:NativeTypeGet the current index into the current data array.This is used by accessors (e.g., a
Cursor) to position theNativeTypein the container.- Specified by:
getIndexin interfaceNativeType<T extends AbstractBitType<T>>- Returns:
- the current index into the underlying data array
-
updateIndex
public void updateIndex(int index) Description copied from interface:NativeTypeSet the index into the current data array.This is used by accessors (e.g., a
Cursor) to position theNativeTypein the container.- Specified by:
updateIndexin interfaceNativeType<T extends AbstractBitType<T>>- Parameters:
index- the new array index
-
incIndex
public void incIndex()Description copied from interface:NativeTypeIncrement the index into the current data array.This is used by accessors (e.g., a
Cursor) to position theNativeTypein the container.- Specified by:
incIndexin interfaceNativeType<T extends AbstractBitType<T>>
-
incIndex
public void incIndex(int increment) Description copied from interface:NativeTypeIncreases the index into the current data array byincrementsteps.This is used by accessors (e.g., a
Cursor) to position theNativeTypein the container.- Specified by:
incIndexin interfaceNativeType<T extends AbstractBitType<T>>- Parameters:
increment- how many steps
-
decIndex
public void decIndex()Description copied from interface:NativeTypeDecrement the index into the current data array.This is used by accessors (e.g., a
Cursor) to position theNativeTypein the container.- Specified by:
decIndexin interfaceNativeType<T extends AbstractBitType<T>>
-
decIndex
public void decIndex(int decrement) Description copied from interface:NativeTypeDecrease the index into the current data array bydecrementsteps.This is used by accessors (e.g., a
Cursor) to position theNativeTypein the container.- Specified by:
decIndexin interfaceNativeType<T extends AbstractBitType<T>>- Parameters:
decrement- how many steps
-
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.
-