Interface NativeType<T extends NativeType<T>>

    • 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 new NativeType which stores in the same physical array. This is only used internally.
        Returns:
        a new NativeType instance working on the same NativeImg
      • updateContainer

        void updateContainer​(java.lang.Object c)
        This method is used by an accessor (e.g., a Cursor) to request an update of the current data array.

        As an example consider a CellCursor moving on a CellImg. The cursor maintains a NativeType which provides access to the image data. When the cursor moves from one cell to the next, the underlying data array of the NativeType must be switched to the data array of the new cell.

        To achieve this, the CellCursor calls updateContainer() with itself as the argument. updateContainer() in turn will call NativeImg.update(Object) on it's container, passing along the reference to the cursor. In this example, the container would be a CellImg. While the NativeType does not know about the type of the cursor, the container does. CellImg knows that it is passed a CellCursor instance, which can be used to figure out the current cell and the underlying data array, which is then returned to the NativeType.

        The idea behind this concept is maybe not obvious. The NativeType knows 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 of NativeType .

        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.
        Use index().set(int) instead. If possible, request the index() object only once and re-use it.
        Set the index into the current data array.
      • getIndex

        @Deprecated
        default int getIndex()
        Deprecated.
        Use index().get() instead. If possible, request the index() object only once and re-use it.
        Get the current index into the current data array.
      • incIndex

        @Deprecated
        default void incIndex()
        Deprecated.
        Use index().inc() instead. If possible, request the index() object only once and re-use it.
        Increment the index into the current data array.
      • incIndex

        @Deprecated
        default void incIndex​(int increment)
        Deprecated.
        Use index().inc(int) instead. If possible, request the index() object only once and re-use it.
        Increases the index into the current data array by increment steps.
      • decIndex

        @Deprecated
        default void decIndex()
        Deprecated.
        Use index().dec() instead. If possible, request the index() object only once and re-use it.
        Decrement the index into the current data array.
      • decIndex

        @Deprecated
        default void decIndex​(int decrement)
        Deprecated.
        Use index().dec(int) instead. If possible, request the index() object only once and re-use it.
        Decrease the index into the current data array by decrement steps.