Class DoubleType

All Implemented Interfaces:
Comparable<DoubleType>, NativeType<DoubleType>, ComplexType<DoubleType>, NumericType<DoubleType>, RealType<DoubleType>, Add<DoubleType>, Div<DoubleType>, Mul<DoubleType>, MulFloatingPoint, SetOne, SetZero, Sub<DoubleType>, ValueEquals<DoubleType>, Type<DoubleType>

public class DoubleType extends AbstractRealType<DoubleType> implements NativeType<DoubleType>
TODO
Author:
Stephan Preibisch, Stephan Saalfeld
  • Field Details

  • Constructor Details

    • DoubleType

      public DoubleType(NativeImg<?,? extends DoubleAccess> doubleStorage)
    • DoubleType

      public DoubleType(double value)
    • DoubleType

      public DoubleType(DoubleAccess access)
    • DoubleType

      public DoubleType()
  • Method Details

    • createSuitableNativeImg

      public NativeImg<DoubleType,? extends DoubleAccess> createSuitableNativeImg(NativeImgFactory<DoubleType> storageFactory, long[] dim)
      Description copied from interface: NativeType
      The NativeType creates the NativeImg 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 containers and the basic types.
      Specified by:
      createSuitableNativeImg in interface NativeType<DoubleType>
      Parameters:
      storageFactory - which storage strategy is used
      dim - the dimensions
      Returns:
      the instantiated NativeImg where only the Type knows the BasicType it contains.
    • updateContainer

      public void updateContainer(Object c)
      Description copied from interface: NativeType
      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 .

      Specified by:
      updateContainer in interface NativeType<DoubleType>
      Parameters:
      c - reference to an accessor which can be passed on to the container (which will know what to do with it).
    • duplicateTypeOnSameNativeImg

      public DoubleType duplicateTypeOnSameNativeImg()
      Description copied from interface: NativeType
      Creates a new NativeType which stores in the same physical array. This is only used internally.
      Specified by:
      duplicateTypeOnSameNativeImg in interface NativeType<DoubleType>
      Returns:
      a new NativeType instance working on the same NativeImg
    • get

      public double get()
    • set

      public void set(double f)
    • getRealFloat

      public float getRealFloat()
      Specified by:
      getRealFloat in interface ComplexType<DoubleType>
    • getRealDouble

      public double getRealDouble()
      Specified by:
      getRealDouble in interface ComplexType<DoubleType>
    • setReal

      public void setReal(float real)
      Specified by:
      setReal in interface ComplexType<DoubleType>
    • setReal

      public void setReal(double real)
      Specified by:
      setReal in interface ComplexType<DoubleType>
    • getMaxValue

      public double getMaxValue()
      Specified by:
      getMaxValue in interface RealType<DoubleType>
    • getMinValue

      public double getMinValue()
      Specified by:
      getMinValue in interface RealType<DoubleType>
    • getMinIncrement

      public double getMinIncrement()
      Specified by:
      getMinIncrement in interface RealType<DoubleType>
    • createVariable

      public DoubleType createVariable()
      Description copied from interface: Type
      Creates a new Type variable which can only store one value.
      Specified by:
      createVariable in interface Type<DoubleType>
      Returns:
      a new Type variable
    • copy

      public DoubleType copy()
      Description copied from interface: Type
      Creates a new Type variable that has the value of this Type
      Specified by:
      copy in interface Type<DoubleType>
      Returns:
      a new Type variable
    • getEntitiesPerPixel

      public Fraction getEntitiesPerPixel()
      Description copied from interface: NativeType
      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.
      Specified by:
      getEntitiesPerPixel in interface NativeType<DoubleType>
      Returns:
      the number of storage type entities required to store one pixel value.
    • updateIndex

      public void updateIndex(int index)
      Description copied from interface: NativeType
      Set the index into the current data array.

      This is used by accessors (e.g., a Cursor) to position the NativeType in the container.

      Specified by:
      updateIndex in interface NativeType<DoubleType>
      Parameters:
      index - the new array index
    • getIndex

      public int getIndex()
      Description copied from interface: NativeType
      Get the current index into the current data array.

      This is used by accessors (e.g., a Cursor) to position the NativeType in the container.

      Specified by:
      getIndex in interface NativeType<DoubleType>
      Returns:
      the current index into the underlying data array
    • incIndex

      public void incIndex()
      Description copied from interface: NativeType
      Increment the index into the current data array.

      This is used by accessors (e.g., a Cursor) to position the NativeType in the container.

      Specified by:
      incIndex in interface NativeType<DoubleType>
    • incIndex

      public void incIndex(int increment)
      Description copied from interface: NativeType
      Increases the index into the current data array by increment steps.

      This is used by accessors (e.g., a Cursor) to position the NativeType in the container.

      Specified by:
      incIndex in interface NativeType<DoubleType>
      Parameters:
      increment - how many steps
    • decIndex

      public void decIndex()
      Description copied from interface: NativeType
      Decrement the index into the current data array.

      This is used by accessors (e.g., a Cursor) to position the NativeType in the container.

      Specified by:
      decIndex in interface NativeType<DoubleType>
    • decIndex

      public void decIndex(int decrement)
      Description copied from interface: NativeType
      Decrease the index into the current data array by decrement steps.

      This is used by accessors (e.g., a Cursor) to position the NativeType in the container.

      Specified by:
      decIndex in interface NativeType<DoubleType>
      Parameters:
      decrement - how many steps
    • getBitsPerPixel

      public int getBitsPerPixel()
      Specified by:
      getBitsPerPixel in interface RealType<DoubleType>
    • valueEquals

      public boolean valueEquals(DoubleType t)
      Specified by:
      valueEquals in interface ValueEquals<DoubleType>