Class FloatType
- java.lang.Object
-
- net.imglib2.type.numeric.complex.AbstractComplexType<T>
-
- net.imglib2.type.numeric.real.AbstractRealType<FloatType>
-
- net.imglib2.type.numeric.real.FloatType
-
- All Implemented Interfaces:
java.lang.Comparable<FloatType>,NativeType<FloatType>,ComplexType<FloatType>,NumericType<FloatType>,RealType<FloatType>,Add<FloatType>,Div<FloatType>,Mul<FloatType>,MulFloatingPoint,Pow<FloatType>,PowFloatingPoint,SetOne,SetZero,Sub<FloatType>,ValueEquals<FloatType>,Type<FloatType>
- Direct Known Subclasses:
VolatileFloatType.WrappedFloatType
public class FloatType extends AbstractRealType<FloatType> implements NativeType<FloatType>
TODO
-
-
Field Summary
Fields Modifier and Type Field Description protected FloatAccessdataAccessprivate Indexiprotected NativeImg<?,? extends FloatAccess>imgprivate static NativeTypeFactory<FloatType,FloatAccess>typeFactory
-
Constructor Summary
Constructors Constructor Description FloatType()FloatType(float value)FloatType(FloatAccess access)FloatType(NativeImg<?,? extends FloatAccess> floatStorage)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidadd(FloatType c)intcompareTo(FloatType other)FloatTypecopy()FloatTypecreateVariable()Creates a newTypevariable which can only store one value.static RealComposite<FloatType>createVector(int n)voiddec()voiddiv(FloatType c)FloatTypeduplicateTypeOnSameNativeImg()Creates a newNativeTypewhich stores in the same physical array.static booleanequals(float a, float b)booleanequals(java.lang.Object obj)floatget()intgetBitsPerPixel()FractiongetEntitiesPerPixel()Get the number of entities in the storage array required to store one pixel value.doublegetMaxValue()doublegetMinIncrement()doublegetMinValue()NativeTypeFactory<FloatType,FloatAccess>getNativeTypeFactory()doublegetRealDouble()floatgetRealFloat()inthashCode()voidinc()Indexindex()Get the (modifiable) index into the current data array.voidmul(double c)voidmul(float c)voidmul(FloatType c)voidset(float f)voidset(FloatType c)Sets the value of anotherType.voidsetOne()voidsetReal(double real)voidsetReal(float real)voidsetZero()voidsub(FloatType c)voidupdateContainer(java.lang.Object c)This method is used by an accessor (e.g., aCursor) to request an update of the current data array.booleanvalueEquals(FloatType other)static RealComposite<FloatType>wrapVector(float[] array)Wrap an array as an n-dimensionalRealCompositeofFloatType.-
Methods inherited from class net.imglib2.type.numeric.real.AbstractRealType
getImaginaryDouble, getImaginaryFloat, getPhaseDouble, getPhaseFloat, getPowerDouble, getPowerFloat, pow, pow, setImaginary, setImaginary, toString
-
Methods inherited from class net.imglib2.type.numeric.complex.AbstractComplexType
complexConjugate, setComplexNumber, setComplexNumber
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface net.imglib2.type.numeric.ComplexType
complexConjugate, setComplexNumber, setComplexNumber
-
Methods inherited from interface net.imglib2.type.NativeType
decIndex, decIndex, getIndex, incIndex, incIndex, updateIndex
-
-
-
-
Field Detail
-
i
private final Index i
-
img
protected final NativeImg<?,? extends FloatAccess> img
-
dataAccess
protected FloatAccess dataAccess
-
typeFactory
private static final NativeTypeFactory<FloatType,FloatAccess> typeFactory
-
-
Constructor Detail
-
FloatType
public FloatType(NativeImg<?,? extends FloatAccess> floatStorage)
-
FloatType
public FloatType(float value)
-
FloatType
public FloatType(FloatAccess access)
-
FloatType
public FloatType()
-
-
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<FloatType>- 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<FloatType>
-
duplicateTypeOnSameNativeImg
public FloatType duplicateTypeOnSameNativeImg()
Description copied from interface:NativeTypeCreates a newNativeTypewhich stores in the same physical array. This is only used internally.- Specified by:
duplicateTypeOnSameNativeImgin interfaceNativeType<FloatType>- Returns:
- a new
NativeTypeinstance working on the sameNativeImg
-
getNativeTypeFactory
public NativeTypeFactory<FloatType,FloatAccess> getNativeTypeFactory()
- Specified by:
getNativeTypeFactoryin interfaceNativeType<FloatType>
-
get
public float get()
-
set
public void set(float f)
-
getRealFloat
public float getRealFloat()
- Specified by:
getRealFloatin interfaceComplexType<FloatType>
-
getRealDouble
public double getRealDouble()
- Specified by:
getRealDoublein interfaceComplexType<FloatType>
-
setReal
public void setReal(float real)
- Specified by:
setRealin interfaceComplexType<FloatType>
-
setReal
public void setReal(double real)
- Specified by:
setRealin interfaceComplexType<FloatType>
-
getMaxValue
public double getMaxValue()
- Specified by:
getMaxValuein interfaceRealType<FloatType>
-
getMinValue
public double getMinValue()
- Specified by:
getMinValuein interfaceRealType<FloatType>
-
getMinIncrement
public double getMinIncrement()
- Specified by:
getMinIncrementin interfaceRealType<FloatType>
-
mul
public void mul(float c)
- Specified by:
mulin interfaceMulFloatingPoint- Overrides:
mulin classAbstractRealType<FloatType>
-
mul
public void mul(double c)
- Specified by:
mulin interfaceMulFloatingPoint- Overrides:
mulin classAbstractRealType<FloatType>
-
add
public void add(FloatType c)
-
div
public void div(FloatType c)
-
mul
public void mul(FloatType c)
-
sub
public void sub(FloatType c)
-
set
public void set(FloatType c)
Description copied from interface:TypeSets the value of anotherType.
-
setOne
public void setOne()
- Specified by:
setOnein interfaceSetOne- Overrides:
setOnein classAbstractRealType<FloatType>
-
setZero
public void setZero()
- Specified by:
setZeroin interfaceSetZero- Overrides:
setZeroin classAbstractRealType<FloatType>
-
inc
public void inc()
-
dec
public void dec()
-
createVariable
public FloatType createVariable()
Description copied from interface:TypeCreates a newTypevariable which can only store one value.- Specified by:
createVariablein interfaceType<FloatType>- Returns:
- a new
Typevariable
-
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<FloatType>- Returns:
- the number of storage type entities required to store one pixel value.
-
getBitsPerPixel
public int getBitsPerPixel()
- Specified by:
getBitsPerPixelin interfaceRealType<FloatType>
-
compareTo
public int compareTo(FloatType other)
- Specified by:
compareToin interfacejava.lang.Comparable<FloatType>- Overrides:
compareToin classAbstractRealType<FloatType>
-
valueEquals
public boolean valueEquals(FloatType other)
- Specified by:
valueEqualsin interfaceValueEquals<FloatType>- Overrides:
valueEqualsin classAbstractRealType<FloatType>
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equalsin classAbstractRealType<FloatType>
-
hashCode
public int hashCode()
- Overrides:
hashCodein classAbstractRealType<FloatType>
-
equals
public static boolean equals(float a, float b)
-
createVector
public static RealComposite<FloatType> createVector(int n)
- Parameters:
n- number of dimensions- Returns:
-
wrapVector
public static RealComposite<FloatType> wrapVector(float[] array)
Wrap an array as an n-dimensionalRealCompositeofFloatType.- Parameters:
array-- Returns:
-
-