public class Unsigned128BitType extends AbstractIntegerType<Unsigned128BitType> implements NativeType<Unsigned128BitType>
Type with a bit depth of 128.
Each value is stored in two adjacent long in an array,
with the lower long first, then the upper long.
Currently the math methods defined in the superinterface NumericType are implemented using BigInteger and BigDecimal.
This class is not Thread-safe; do a copy() first to operate on a different Thread.| Modifier and Type | Field and Description |
|---|---|
protected byte[] |
bytes |
protected LongAccess |
dataAccess |
protected NativeImg<?,? extends LongAccess> |
img |
| Constructor and Description |
|---|
Unsigned128BitType() |
Unsigned128BitType(BigInteger value) |
Unsigned128BitType(LongAccess access) |
Unsigned128BitType(long lower,
long upper) |
Unsigned128BitType(NativeImg<?,? extends LongAccess> bitStorage) |
| Modifier and Type | Method and Description |
|---|---|
void |
add(Unsigned128BitType t)
Relies on
BigInteger.add(BigInteger). |
int |
compareTo(Unsigned128BitType t) |
Unsigned128BitType |
copy()
|
NativeImg<Unsigned128BitType,? extends LongAccess> |
createSuitableNativeImg(NativeImgFactory<Unsigned128BitType> storageFactory,
long[] dim)
The
NativeType creates the NativeImg used for storing
image data; based on the given storage strategy and its size. |
Unsigned128BitType |
createVariable()
Creates a new
Type variable which can only store one value. |
void |
dec() |
void |
decIndex()
Decrement the index into the current data array.
|
void |
decIndex(int decrement)
Decrease the index into the current data array by
decrement
steps. |
void |
div(Unsigned128BitType t)
Relies on
BigInteger.divide(BigInteger). |
Unsigned128BitType |
duplicateTypeOnSameNativeImg()
Creates a new
NativeType which stores in the same physical array. |
BigInteger |
get() |
BigInteger |
getBigInteger() |
int |
getBitsPerPixel() |
Fraction |
getEntitiesPerPixel()
Get the number of entities in the storage array required to store one
pixel value.
|
int |
getIndex()
Get the current index into the current data array.
|
int |
getInteger()
Return the lowest 32 bits, like
BigInteger.intValue(). |
long |
getIntegerLong()
Return the lowest 64 bits, like
BigInteger.intValue(). |
BigInteger |
getMaxBigIntegerValue()
The true maximum value, unlike
getMaxValue() which cannot represent
it in a double. |
double |
getMaxValue()
The maximum value that can be stored is
Math.pow(2, 128) -1,
which cannot be represented with precision using a double |
double |
getMinValue() |
void |
inc() |
void |
incIndex()
Increment the index into the current data array.
|
void |
incIndex(int increment)
Increases the index into the current data array by
increment
steps. |
void |
mul(double c)
Implemented using
BigDecimal.multiply(BigDecimal) and BigDecimal.toBigInteger(). |
void |
mul(float c)
See
mul(double). |
void |
mul(Unsigned128BitType t)
Relies on
BigInteger.multiply(BigInteger). |
void |
set(BigInteger value) |
void |
set(byte[] bytes)
The first byte is the most significant byte, like in
BigInteger.toByteArray(). |
void |
set(long lower,
long upper) |
void |
setBigInteger(BigInteger b) |
void |
setInteger(int value) |
void |
setInteger(long value) |
void |
setOne() |
void |
setZero() |
void |
sub(Unsigned128BitType t)
Relies on
BigInteger.subtract(BigInteger). |
void |
updateContainer(Object c)
This method is used by an accessor (e.g., a
Cursor) to request an
update of the current data array. |
void |
updateIndex(int index)
Set the index into the current data array.
|
boolean |
valueEquals(Unsigned128BitType t) |
getMinIncrement, getRealDouble, getRealFloat, hashCode, setReal, setReal, toStringequals, getImaginaryDouble, getImaginaryFloat, getPhaseDouble, getPhaseFloat, getPowerDouble, getPowerFloat, set, setImaginary, setImaginarycomplexConjugate, setComplexNumber, setComplexNumberclone, finalize, getClass, notify, notifyAll, wait, wait, waitcomplexConjugate, getImaginaryDouble, getImaginaryFloat, getPhaseDouble, getPhaseFloat, getPowerDouble, getPowerFloat, setComplexNumber, setComplexNumber, setImaginary, setImaginaryprotected final NativeImg<?,? extends LongAccess> img
protected final byte[] bytes
protected LongAccess dataAccess
public Unsigned128BitType(NativeImg<?,? extends LongAccess> bitStorage)
public Unsigned128BitType(long lower,
long upper)
public Unsigned128BitType(BigInteger value)
public Unsigned128BitType(LongAccess access)
public Unsigned128BitType()
public NativeImg<Unsigned128BitType,? extends LongAccess> createSuitableNativeImg(NativeImgFactory<Unsigned128BitType> storageFactory, long[] dim)
NativeTypeNativeType 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.createSuitableNativeImg in interface NativeType<Unsigned128BitType>storageFactory - which storage strategy is useddim - the dimensionsNativeImg where only the Type
knows the BasicType it contains.public void updateContainer(Object c)
NativeTypeCursor) 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
.
updateContainer in interface NativeType<Unsigned128BitType>c - reference to an accessor which can be passed on to the
container (which will know what to do with it).public Unsigned128BitType duplicateTypeOnSameNativeImg()
NativeTypeNativeType which stores in the same physical array.
This is only used internally.duplicateTypeOnSameNativeImg in interface NativeType<Unsigned128BitType>NativeType instance working on the same
NativeImgpublic void set(byte[] bytes)
BigInteger.toByteArray().
Only the last 16 bytes are read, if there are more.public BigInteger get()
public void set(BigInteger value)
public void set(long lower,
long upper)
public int getInteger()
BigInteger.intValue().getInteger in interface IntegerType<Unsigned128BitType>public long getIntegerLong()
BigInteger.intValue().getIntegerLong in interface IntegerType<Unsigned128BitType>public BigInteger getBigInteger()
getBigInteger in interface IntegerType<Unsigned128BitType>public void setInteger(int value)
setInteger in interface IntegerType<Unsigned128BitType>public void setInteger(long value)
setInteger in interface IntegerType<Unsigned128BitType>public void setBigInteger(BigInteger b)
setBigInteger in interface IntegerType<Unsigned128BitType>public double getMaxValue()
Math.pow(2, 128) -1,
which cannot be represented with precision using a doublegetMaxValue in interface RealType<Unsigned128BitType>public BigInteger getMaxBigIntegerValue()
getMaxValue() which cannot represent
it in a double.public double getMinValue()
getMinValue in interface RealType<Unsigned128BitType>public int getIndex()
NativeType
This is used by accessors (e.g., a Cursor) to position the
NativeType in the container.
getIndex in interface NativeType<Unsigned128BitType>public void updateIndex(int index)
NativeType
This is used by accessors (e.g., a Cursor) to position the
NativeType in the container.
updateIndex in interface NativeType<Unsigned128BitType>index - the new array indexpublic void incIndex()
NativeType
This is used by accessors (e.g., a Cursor) to position the
NativeType in the container.
incIndex in interface NativeType<Unsigned128BitType>public void incIndex(int increment)
NativeTypeincrement
steps.
This is used by accessors (e.g., a Cursor) to position the
NativeType in the container.
incIndex in interface NativeType<Unsigned128BitType>increment - how many stepspublic void decIndex()
NativeType
This is used by accessors (e.g., a Cursor) to position the
NativeType in the container.
decIndex in interface NativeType<Unsigned128BitType>public void decIndex(int decrement)
NativeTypedecrement
steps.
This is used by accessors (e.g., a Cursor) to position the
NativeType in the container.
decIndex in interface NativeType<Unsigned128BitType>decrement - how many stepspublic Unsigned128BitType createVariable()
TypeType variable which can only store one value.createVariable in interface Type<Unsigned128BitType>Type variablepublic Unsigned128BitType copy()
Typecopy in interface Type<Unsigned128BitType>Type variablepublic Fraction getEntitiesPerPixel()
NativeTypegetEntitiesPerPixel in interface NativeType<Unsigned128BitType>public int getBitsPerPixel()
getBitsPerPixel in interface RealType<Unsigned128BitType>public void inc()
inc in interface RealType<Unsigned128BitType>inc in class AbstractIntegerType<Unsigned128BitType>public void dec()
dec in interface RealType<Unsigned128BitType>dec in class AbstractIntegerType<Unsigned128BitType>public void setZero()
setZero in interface SetZerosetZero in class AbstractIntegerType<Unsigned128BitType>public void setOne()
setOne in interface SetOnesetOne in class AbstractIntegerType<Unsigned128BitType>public void mul(float c)
mul(double).mul in interface MulFloatingPointmul in class AbstractRealType<Unsigned128BitType>public void mul(double c)
BigDecimal.multiply(BigDecimal) and BigDecimal.toBigInteger().mul in interface MulFloatingPointmul in class AbstractRealType<Unsigned128BitType>public void add(Unsigned128BitType t)
BigInteger.add(BigInteger).add in interface Add<Unsigned128BitType>add in class AbstractRealType<Unsigned128BitType>public void sub(Unsigned128BitType t)
BigInteger.subtract(BigInteger).sub in interface Sub<Unsigned128BitType>sub in class AbstractRealType<Unsigned128BitType>public void mul(Unsigned128BitType t)
BigInteger.multiply(BigInteger).mul in interface Mul<Unsigned128BitType>mul in class AbstractRealType<Unsigned128BitType>public void div(Unsigned128BitType t)
BigInteger.divide(BigInteger).div in interface Div<Unsigned128BitType>div in class AbstractRealType<Unsigned128BitType>public int compareTo(Unsigned128BitType t)
compareTo in interface Comparable<Unsigned128BitType>compareTo in class AbstractIntegerType<Unsigned128BitType>public boolean valueEquals(Unsigned128BitType t)
valueEquals in interface ValueEquals<Unsigned128BitType>Copyright © 2009–2017 ImgLib2. All rights reserved.