Package net.imglib2.type.numeric.integer
Class UnsignedVariableBitLengthType
java.lang.Object
net.imglib2.type.AbstractBitType<UnsignedVariableBitLengthType>
net.imglib2.type.AbstractBit64Type<UnsignedVariableBitLengthType>
net.imglib2.type.numeric.integer.UnsignedVariableBitLengthType
- All Implemented Interfaces:
Comparable<UnsignedVariableBitLengthType>
,NativeType<UnsignedVariableBitLengthType>
,ComplexType<UnsignedVariableBitLengthType>
,IntegerType<UnsignedVariableBitLengthType>
,NumericType<UnsignedVariableBitLengthType>
,RealType<UnsignedVariableBitLengthType>
,Add<UnsignedVariableBitLengthType>
,Div<UnsignedVariableBitLengthType>
,Mul<UnsignedVariableBitLengthType>
,MulFloatingPoint
,SetOne
,SetZero
,Sub<UnsignedVariableBitLengthType>
,ValueEquals<UnsignedVariableBitLengthType>
,Type<UnsignedVariableBitLengthType>
public class UnsignedVariableBitLengthType
extends AbstractBit64Type<UnsignedVariableBitLengthType>
implements IntegerType<UnsignedVariableBitLengthType>
A
Type
with arbitrary bit depth up to maximum 64 bits.
The behavior beyond 64 bits is undefined.
The performance of this type is traded off for the gain in memory storage.
The set(long)
operation takes have the time as the get()
operation.
The performance may degrade very slightly with increasing bit depth, but the decrease is barely noticeable.- Author:
- Albert Cardona, Stephan Preibisch
-
Field Summary
Fields inherited from class net.imglib2.type.AbstractBitType
dataAccess, i, img, nBits
-
Constructor Summary
ConstructorsConstructorDescriptionUnsignedVariableBitLengthType
(int nBits) UnsignedVariableBitLengthType
(long value, int nBits) UnsignedVariableBitLengthType
(LongAccess access, int nBits) UnsignedVariableBitLengthType
(NativeImg<?, ? extends LongAccess> bitStorage, int nBits) -
Method Summary
Modifier and TypeMethodDescriptionvoid
int
void
copy()
NativeImg
<UnsignedVariableBitLengthType, ? extends LongAccess> createSuitableNativeImg
(NativeImgFactory<UnsignedVariableBitLengthType> storageFactory, long[] dim) TheNativeType
creates theNativeImg
used for storing image data; based on the given storage strategy and its size.Creates a newType
variable which can only store one value.void
dec()
void
Creates a newNativeType
which stores in the same physical array.long
get()
int
double
float
int
long
double
The maximum value that can be stored isMath.pow(2, nBits) -1
.double
double
double
float
double
float
double
float
void
inc()
void
mul
(double c) void
mul
(float c) void
void
set
(long value) void
Sets the value of anotherType
.void
void
setComplexNumber
(double r, double i) void
setComplexNumber
(float r, float i) void
setImaginary
(double complex) void
setImaginary
(float complex) void
setInteger
(int f) void
setInteger
(long f) void
setOne()
void
setReal
(double real) void
setReal
(float real) void
setZero()
void
toString()
boolean
Default test at long precision.Methods inherited from class net.imglib2.type.AbstractBit64Type
getBits, setBits
Methods inherited from class net.imglib2.type.AbstractBitType
decIndex, decIndex, getEntitiesPerPixel, getIndex, incIndex, incIndex, updateContainer, updateIndex
-
Constructor Details
-
UnsignedVariableBitLengthType
-
UnsignedVariableBitLengthType
public UnsignedVariableBitLengthType(long value, int nBits) -
UnsignedVariableBitLengthType
-
UnsignedVariableBitLengthType
public UnsignedVariableBitLengthType(int nBits)
-
-
Method Details
-
createSuitableNativeImg
public NativeImg<UnsignedVariableBitLengthType,? extends LongAccess> createSuitableNativeImg(NativeImgFactory<UnsignedVariableBitLengthType> storageFactory, long[] dim) Description copied from interface:NativeType
TheNativeType
creates theNativeImg
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 interfaceNativeType<UnsignedVariableBitLengthType>
- Parameters:
storageFactory
- which storage strategy is useddim
- the dimensions- Returns:
- the instantiated
NativeImg
where only theType
knows the BasicType it contains.
-
set
public void set(long value) -
get
public long get() -
set
Description copied from interface:Type
Sets the value of anotherType
.- Specified by:
set
in interfaceType<UnsignedVariableBitLengthType>
- Parameters:
c
- the new value
-
duplicateTypeOnSameNativeImg
Description copied from interface:NativeType
Creates a newNativeType
which stores in the same physical array. This is only used internally.- Specified by:
duplicateTypeOnSameNativeImg
in interfaceNativeType<UnsignedVariableBitLengthType>
- Returns:
- a new
NativeType
instance working on the sameNativeImg
-
createVariable
Description copied from interface:Type
Creates a newType
variable which can only store one value.- Specified by:
createVariable
in interfaceType<UnsignedVariableBitLengthType>
- Returns:
- a new
Type
variable
-
copy
Description copied from interface:Type
- Specified by:
copy
in interfaceType<UnsignedVariableBitLengthType>
- Returns:
- a new
Type
variable
-
div
- Specified by:
div
in interfaceDiv<UnsignedVariableBitLengthType>
- See Also:
-
compareTo
- Specified by:
compareTo
in interfaceComparable<UnsignedVariableBitLengthType>
- See Also:
-
mul
public void mul(float c) - Specified by:
mul
in interfaceMulFloatingPoint
-
mul
public void mul(double c) - Specified by:
mul
in interfaceMulFloatingPoint
-
getRealFloat
public float getRealFloat()- Specified by:
getRealFloat
in interfaceComplexType<UnsignedVariableBitLengthType>
-
getRealDouble
public double getRealDouble()- Specified by:
getRealDouble
in interfaceComplexType<UnsignedVariableBitLengthType>
-
setReal
public void setReal(float real) - Specified by:
setReal
in interfaceComplexType<UnsignedVariableBitLengthType>
-
setReal
public void setReal(double real) - Specified by:
setReal
in interfaceComplexType<UnsignedVariableBitLengthType>
-
setZero
public void setZero() -
setOne
public void setOne() -
getBitsPerPixel
public int getBitsPerPixel()- Specified by:
getBitsPerPixel
in interfaceRealType<UnsignedVariableBitLengthType>
-
getMinIncrement
public double getMinIncrement()- Specified by:
getMinIncrement
in interfaceRealType<UnsignedVariableBitLengthType>
-
toString
-
getInteger
public int getInteger()- Specified by:
getInteger
in interfaceIntegerType<UnsignedVariableBitLengthType>
-
getIntegerLong
public long getIntegerLong()- Specified by:
getIntegerLong
in interfaceIntegerType<UnsignedVariableBitLengthType>
-
getBigInteger
- Specified by:
getBigInteger
in interfaceIntegerType<UnsignedVariableBitLengthType>
-
setInteger
public void setInteger(int f) - Specified by:
setInteger
in interfaceIntegerType<UnsignedVariableBitLengthType>
-
setInteger
public void setInteger(long f) - Specified by:
setInteger
in interfaceIntegerType<UnsignedVariableBitLengthType>
-
setBigInteger
- Specified by:
setBigInteger
in interfaceIntegerType<UnsignedVariableBitLengthType>
-
getMaxValue
public double getMaxValue()The maximum value that can be stored isMath.pow(2, nBits) -1
.- Specified by:
getMaxValue
in interfaceRealType<UnsignedVariableBitLengthType>
-
getMinValue
public double getMinValue()- Specified by:
getMinValue
in interfaceRealType<UnsignedVariableBitLengthType>
-
inc
public void inc()- Specified by:
inc
in interfaceRealType<UnsignedVariableBitLengthType>
-
dec
public void dec()- Specified by:
dec
in interfaceRealType<UnsignedVariableBitLengthType>
-
add
- Specified by:
add
in interfaceAdd<UnsignedVariableBitLengthType>
-
sub
- Specified by:
sub
in interfaceSub<UnsignedVariableBitLengthType>
-
mul
- Specified by:
mul
in interfaceMul<UnsignedVariableBitLengthType>
-
getImaginaryFloat
public float getImaginaryFloat()- Specified by:
getImaginaryFloat
in interfaceComplexType<UnsignedVariableBitLengthType>
-
getImaginaryDouble
public double getImaginaryDouble()- Specified by:
getImaginaryDouble
in interfaceComplexType<UnsignedVariableBitLengthType>
-
setImaginary
public void setImaginary(float complex) - Specified by:
setImaginary
in interfaceComplexType<UnsignedVariableBitLengthType>
-
setImaginary
public void setImaginary(double complex) - Specified by:
setImaginary
in interfaceComplexType<UnsignedVariableBitLengthType>
-
getPhaseFloat
public float getPhaseFloat()- Specified by:
getPhaseFloat
in interfaceComplexType<UnsignedVariableBitLengthType>
-
getPhaseDouble
public double getPhaseDouble()- Specified by:
getPhaseDouble
in interfaceComplexType<UnsignedVariableBitLengthType>
-
getPowerFloat
public float getPowerFloat()- Specified by:
getPowerFloat
in interfaceComplexType<UnsignedVariableBitLengthType>
-
getPowerDouble
public double getPowerDouble()- Specified by:
getPowerDouble
in interfaceComplexType<UnsignedVariableBitLengthType>
-
setComplexNumber
public void setComplexNumber(float r, float i) - Specified by:
setComplexNumber
in interfaceComplexType<UnsignedVariableBitLengthType>
-
setComplexNumber
public void setComplexNumber(double r, double i) - Specified by:
setComplexNumber
in interfaceComplexType<UnsignedVariableBitLengthType>
-
complexConjugate
public void complexConjugate()- Specified by:
complexConjugate
in interfaceComplexType<UnsignedVariableBitLengthType>
-
valueEquals
Default test at long precision. Please override for types longer than 64bit.- Specified by:
valueEquals
in interfaceValueEquals<UnsignedVariableBitLengthType>
- Parameters:
t
-- Returns:
-