Interface NativeType<T extends NativeType<T>>
-
- All Superinterfaces:
Type<T>,ValueEquals<T>
- All Known Implementing Classes:
AbstractBit64Type,AbstractBitType,AbstractIntegerBitType,AbstractNativeType,AbstractVolatileNativeNumericType,AbstractVolatileNativeRealType,ARGBType,BasePairBitType,BasePairCharType,BitType,ByteType,ComplexDoubleType,ComplexFloatType,DoubleType,FloatType,GenericByteType,GenericIntType,GenericLongType,GenericShortType,IntType,LongType,NativeARGBDoubleType,NativeBoolType,ShortType,Unsigned128BitType,Unsigned12BitType,Unsigned2BitType,Unsigned4BitType,UnsignedByteType,UnsignedIntType,UnsignedLongType,UnsignedShortType,UnsignedVariableBitLengthType,VolatileARGBType,VolatileARGBType.WrappedARGBType,VolatileByteType,VolatileByteType.WrappedByteType,VolatileDoubleType,VolatileDoubleType.WrappedDoubleType,VolatileFloatType,VolatileFloatType.WrappedFloatType,VolatileIntType,VolatileIntType.WrappedIntType,VolatileLongType,VolatileLongType.WrappedLongType,VolatileShortType,VolatileShortType.WrappedShortType,VolatileUnsignedByteType,VolatileUnsignedByteType.WrappedUnsignedByteType,VolatileUnsignedIntType,VolatileUnsignedIntType.WrappedUnsignedIntType,VolatileUnsignedLongType,VolatileUnsignedLongType.WrappedUnsignedLongType,VolatileUnsignedShortType,VolatileUnsignedShortType.WrappedUnsignedShortType
public interface NativeType<T extends NativeType<T>> extends Type<T>
ANativeTypeis aTypethat that provides access to data stored in Java primitive arrays. To this end, implementations maintain a reference to the current storage array and the index of an element in that array. TheNativeTypeis positioned on the correct storage array and index by accessors (CursorsandRandomAccesses).The
NativeTypeis the only class that is aware of the actual data type, i.e., which Java primitive type is used to store the data. On the other hand it does not know the storage layout, i.e., how n-dimensional pixel coordinates map to indices in the current array. It also doesn't know whether and how the data is split into multiple chunks. This is determined by the container implementation (e.g.,ArrayImg,CellImg, ...). Separating the storage layout from access and operations on theTypeavoids re-implementation for each container type.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Deprecated Methods Modifier and Type Method Description default voiddecIndex()Deprecated.Useindex().dec()instead.default voiddecIndex(int decrement)Deprecated.Useindex().dec(int)instead.TduplicateTypeOnSameNativeImg()Creates a newNativeTypewhich stores in the same physical array.FractiongetEntitiesPerPixel()Get the number of entities in the storage array required to store one pixel value.default intgetIndex()Deprecated.Useindex().get()instead.NativeTypeFactory<T,?>getNativeTypeFactory()default voidincIndex()Deprecated.Useindex().inc()instead.default voidincIndex(int increment)Deprecated.Useindex().inc(int)instead.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.default voidupdateIndex(int i)Deprecated.Useindex().set(int)instead.-
Methods inherited from interface net.imglib2.type.Type
copy, createVariable, set
-
Methods inherited from interface net.imglib2.type.operators.ValueEquals
valueEquals
-
-
-
-
Method Detail
-
getEntitiesPerPixel
Fraction getEntitiesPerPixel()
Get 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.- Returns:
- the number of storage type entities required to store one pixel value.
-
duplicateTypeOnSameNativeImg
T duplicateTypeOnSameNativeImg()
Creates a newNativeTypewhich stores in the same physical array. This is only used internally.- Returns:
- a new
NativeTypeinstance working on the sameNativeImg
-
getNativeTypeFactory
NativeTypeFactory<T,?> getNativeTypeFactory()
-
updateContainer
void updateContainer(java.lang.Object c)
This 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.- Parameters:
c- reference to an accessor which can be passed on to the container (which will know what to do with it).
-
index
Index index()
Get the (modifiable) index into the current data array. The returned instance will always be the same for the same Type.
-
updateIndex
@Deprecated default void updateIndex(int i)
Deprecated.Useindex().set(int)instead. If possible, request theindex()object only once and re-use it.Set the index into the current data array.
-
getIndex
@Deprecated default int getIndex()
Deprecated.Useindex().get()instead. If possible, request theindex()object only once and re-use it.Get the current index into the current data array.
-
incIndex
@Deprecated default void incIndex()
Deprecated.Useindex().inc()instead. If possible, request theindex()object only once and re-use it.Increment the index into the current data array.
-
incIndex
@Deprecated default void incIndex(int increment)
Deprecated.Useindex().inc(int)instead. If possible, request theindex()object only once and re-use it.Increases the index into the current data array byincrementsteps.
-
decIndex
@Deprecated default void decIndex()
Deprecated.Useindex().dec()instead. If possible, request theindex()object only once and re-use it.Decrement the index into the current data array.
-
decIndex
@Deprecated default void decIndex(int decrement)
Deprecated.Useindex().dec(int)instead. If possible, request theindex()object only once and re-use it.Decrease the index into the current data array bydecrementsteps.
-
-