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 TypeMethodDescriptionvoidintvoidcopy()NativeImg<UnsignedVariableBitLengthType, ? extends LongAccess> createSuitableNativeImg(NativeImgFactory<UnsignedVariableBitLengthType> storageFactory, long[] dim) TheNativeTypecreates theNativeImgused for storing image data; based on the given storage strategy and its size.Creates a newTypevariable which can only store one value.voiddec()voidCreates a newNativeTypewhich stores in the same physical array.longget()intdoublefloatintlongdoubleThe maximum value that can be stored isMath.pow(2, nBits) -1.doubledoubledoublefloatdoublefloatdoublefloatvoidinc()voidmul(double c) voidmul(float c) voidvoidset(long value) voidSets the value of anotherType.voidvoidsetComplexNumber(double r, double i) voidsetComplexNumber(float r, float i) voidsetImaginary(double complex) voidsetImaginary(float complex) voidsetInteger(int f) voidsetInteger(long f) voidsetOne()voidsetReal(double real) voidsetReal(float real) voidsetZero()voidtoString()booleanDefault test at long precision.Methods inherited from class net.imglib2.type.AbstractBit64Type
getBits, setBitsMethods 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:NativeTypeTheNativeTypecreates theNativeImgused 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:
createSuitableNativeImgin interfaceNativeType<UnsignedVariableBitLengthType>- Parameters:
storageFactory- which storage strategy is useddim- the dimensions- Returns:
- the instantiated
NativeImgwhere only theTypeknows the BasicType it contains.
-
set
public void set(long value) -
get
public long get() -
set
Description copied from interface:TypeSets the value of anotherType.- Specified by:
setin interfaceType<UnsignedVariableBitLengthType>- Parameters:
c- the new value
-
duplicateTypeOnSameNativeImg
Description copied from interface:NativeTypeCreates a newNativeTypewhich stores in the same physical array. This is only used internally.- Specified by:
duplicateTypeOnSameNativeImgin interfaceNativeType<UnsignedVariableBitLengthType>- Returns:
- a new
NativeTypeinstance working on the sameNativeImg
-
createVariable
Description copied from interface:TypeCreates a newTypevariable which can only store one value.- Specified by:
createVariablein interfaceType<UnsignedVariableBitLengthType>- Returns:
- a new
Typevariable
-
copy
Description copied from interface:Type- Specified by:
copyin interfaceType<UnsignedVariableBitLengthType>- Returns:
- a new
Typevariable
-
div
- Specified by:
divin interfaceDiv<UnsignedVariableBitLengthType>- See Also:
-
compareTo
- Specified by:
compareToin interfaceComparable<UnsignedVariableBitLengthType>- See Also:
-
mul
public void mul(float c) - Specified by:
mulin interfaceMulFloatingPoint
-
mul
public void mul(double c) - Specified by:
mulin interfaceMulFloatingPoint
-
getRealFloat
public float getRealFloat()- Specified by:
getRealFloatin interfaceComplexType<UnsignedVariableBitLengthType>
-
getRealDouble
public double getRealDouble()- Specified by:
getRealDoublein interfaceComplexType<UnsignedVariableBitLengthType>
-
setReal
public void setReal(float real) - Specified by:
setRealin interfaceComplexType<UnsignedVariableBitLengthType>
-
setReal
public void setReal(double real) - Specified by:
setRealin interfaceComplexType<UnsignedVariableBitLengthType>
-
setZero
public void setZero() -
setOne
public void setOne() -
getBitsPerPixel
public int getBitsPerPixel()- Specified by:
getBitsPerPixelin interfaceRealType<UnsignedVariableBitLengthType>
-
getMinIncrement
public double getMinIncrement()- Specified by:
getMinIncrementin interfaceRealType<UnsignedVariableBitLengthType>
-
toString
-
getInteger
public int getInteger()- Specified by:
getIntegerin interfaceIntegerType<UnsignedVariableBitLengthType>
-
getIntegerLong
public long getIntegerLong()- Specified by:
getIntegerLongin interfaceIntegerType<UnsignedVariableBitLengthType>
-
getBigInteger
- Specified by:
getBigIntegerin interfaceIntegerType<UnsignedVariableBitLengthType>
-
setInteger
public void setInteger(int f) - Specified by:
setIntegerin interfaceIntegerType<UnsignedVariableBitLengthType>
-
setInteger
public void setInteger(long f) - Specified by:
setIntegerin interfaceIntegerType<UnsignedVariableBitLengthType>
-
setBigInteger
- Specified by:
setBigIntegerin interfaceIntegerType<UnsignedVariableBitLengthType>
-
getMaxValue
public double getMaxValue()The maximum value that can be stored isMath.pow(2, nBits) -1.- Specified by:
getMaxValuein interfaceRealType<UnsignedVariableBitLengthType>
-
getMinValue
public double getMinValue()- Specified by:
getMinValuein interfaceRealType<UnsignedVariableBitLengthType>
-
inc
public void inc()- Specified by:
incin interfaceRealType<UnsignedVariableBitLengthType>
-
dec
public void dec()- Specified by:
decin interfaceRealType<UnsignedVariableBitLengthType>
-
add
- Specified by:
addin interfaceAdd<UnsignedVariableBitLengthType>
-
sub
- Specified by:
subin interfaceSub<UnsignedVariableBitLengthType>
-
mul
- Specified by:
mulin interfaceMul<UnsignedVariableBitLengthType>
-
getImaginaryFloat
public float getImaginaryFloat()- Specified by:
getImaginaryFloatin interfaceComplexType<UnsignedVariableBitLengthType>
-
getImaginaryDouble
public double getImaginaryDouble()- Specified by:
getImaginaryDoublein interfaceComplexType<UnsignedVariableBitLengthType>
-
setImaginary
public void setImaginary(float complex) - Specified by:
setImaginaryin interfaceComplexType<UnsignedVariableBitLengthType>
-
setImaginary
public void setImaginary(double complex) - Specified by:
setImaginaryin interfaceComplexType<UnsignedVariableBitLengthType>
-
getPhaseFloat
public float getPhaseFloat()- Specified by:
getPhaseFloatin interfaceComplexType<UnsignedVariableBitLengthType>
-
getPhaseDouble
public double getPhaseDouble()- Specified by:
getPhaseDoublein interfaceComplexType<UnsignedVariableBitLengthType>
-
getPowerFloat
public float getPowerFloat()- Specified by:
getPowerFloatin interfaceComplexType<UnsignedVariableBitLengthType>
-
getPowerDouble
public double getPowerDouble()- Specified by:
getPowerDoublein interfaceComplexType<UnsignedVariableBitLengthType>
-
setComplexNumber
public void setComplexNumber(float r, float i) - Specified by:
setComplexNumberin interfaceComplexType<UnsignedVariableBitLengthType>
-
setComplexNumber
public void setComplexNumber(double r, double i) - Specified by:
setComplexNumberin interfaceComplexType<UnsignedVariableBitLengthType>
-
complexConjugate
public void complexConjugate()- Specified by:
complexConjugatein interfaceComplexType<UnsignedVariableBitLengthType>
-
valueEquals
Default test at long precision. Please override for types longer than 64bit.- Specified by:
valueEqualsin interfaceValueEquals<UnsignedVariableBitLengthType>- Parameters:
t-- Returns:
-