Class BitType
- All Implemented Interfaces:
Comparable<BitType>
,BooleanType<BitType>
,NativeType<BitType>
,ComplexType<BitType>
,IntegerType<BitType>
,NumericType<BitType>
,RealType<BitType>
,Add<BitType>
,Div<BitType>
,Mul<BitType>
,MulFloatingPoint
,SetOne
,SetZero
,Sub<BitType>
,ValueEquals<BitType>
,Type<BitType>
- Author:
- Stephan Preibisch, Stephan Saalfeld
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected LongAccess
protected int
protected final NativeImg
<?, ? extends LongAccess> -
Constructor Summary
ConstructorsConstructorDescriptionBitType()
BitType
(boolean value) BitType
(LongAccess access) BitType
(NativeImg<?, ? extends LongAccess> bitStorage) -
Method Summary
Modifier and TypeMethodDescriptionvoid
void
int
copy()
NativeImg
<BitType, ? extends LongAccess> createSuitableNativeImg
(NativeImgFactory<BitType> 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
decIndex()
Decrement the index into the current data array.void
decIndex
(int decrement) Decrease the index into the current data array bydecrement
steps.void
Creates a newNativeType
which stores in the same physical array.boolean
get()
int
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
long
double
double
void
inc()
void
incIndex()
Increment the index into the current data array.void
incIndex
(int increment) Increases the index into the current data array byincrement
steps.void
mul
(double c) void
mul
(float c) void
void
not()
void
void
set
(boolean value) void
Sets the value of anotherType
.void
void
setInteger
(int f) void
setInteger
(long f) void
setOne()
void
setZero()
void
toString()
void
This method is used by an accessor (e.g., aCursor
) to request an update of the current data array.void
updateIndex
(int index) Set the index into the current data array.boolean
void
Methods inherited from class net.imglib2.type.numeric.integer.AbstractIntegerType
getMinIncrement, getRealDouble, getRealFloat, hashCode, setReal, setReal
Methods inherited from class net.imglib2.type.numeric.real.AbstractRealType
equals, getImaginaryDouble, getImaginaryFloat, getPhaseDouble, getPhaseFloat, getPowerDouble, getPowerFloat, setImaginary, setImaginary
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, getImaginaryDouble, getImaginaryFloat, getPhaseDouble, getPhaseFloat, getPowerDouble, getPowerFloat, getRealDouble, getRealFloat, setComplexNumber, setComplexNumber, setImaginary, setImaginary, setReal, setReal
Methods inherited from interface net.imglib2.type.numeric.RealType
getMinIncrement
-
Field Details
-
i
protected int i -
img
-
dataAccess
-
-
Constructor Details
-
BitType
-
BitType
public BitType(boolean value) -
BitType
-
BitType
public BitType()
-
-
Method Details
-
createSuitableNativeImg
public NativeImg<BitType,? extends LongAccess> createSuitableNativeImg(NativeImgFactory<BitType> 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<BitType>
- Parameters:
storageFactory
- which storage strategy is useddim
- the dimensions- Returns:
- the instantiated
NativeImg
where only theType
knows the BasicType it contains.
-
updateContainer
Description copied from interface:NativeType
This method is used by an accessor (e.g., aCursor
) to request an update of the current data array.As an example consider a
CellCursor
moving on aCellImg
. The cursor maintains aNativeType
which provides access to the image data. When the cursor moves from one cell to the next, the underlying data array of theNativeType
must be switched to the data array of the new cell.To achieve this, the
CellCursor
callsupdateContainer()
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 theNativeType
does not know about the type of the cursor, the container does.CellImg
knows that it is passed aCellCursor
instance, 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
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 ofNativeType
.- Specified by:
updateContainer
in interfaceNativeType<BitType>
- Parameters:
c
- reference to an accessor which can be passed on to the container (which will know what to do with it).
-
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<BitType>
- Returns:
- a new
NativeType
instance working on the sameNativeImg
-
get
public boolean get()- Specified by:
get
in interfaceBooleanType<BitType>
-
set
public void set(boolean value) - Specified by:
set
in interfaceBooleanType<BitType>
-
getInteger
public int getInteger()- Specified by:
getInteger
in interfaceIntegerType<BitType>
-
getIntegerLong
public long getIntegerLong()- Specified by:
getIntegerLong
in interfaceIntegerType<BitType>
-
getBigInteger
- Specified by:
getBigInteger
in interfaceIntegerType<BitType>
-
setInteger
public void setInteger(int f) - Specified by:
setInteger
in interfaceIntegerType<BitType>
-
setInteger
public void setInteger(long f) - Specified by:
setInteger
in interfaceIntegerType<BitType>
-
setBigInteger
- Specified by:
setBigInteger
in interfaceIntegerType<BitType>
-
getMaxValue
public double getMaxValue()- Specified by:
getMaxValue
in interfaceRealType<BitType>
-
getMinValue
public double getMinValue()- Specified by:
getMinValue
in interfaceRealType<BitType>
-
set
Description copied from interface:Type
Sets the value of anotherType
. -
and
- Specified by:
and
in interfaceBooleanType<BitType>
-
or
- Specified by:
or
in interfaceBooleanType<BitType>
-
xor
- Specified by:
xor
in interfaceBooleanType<BitType>
-
not
public void not()- Specified by:
not
in interfaceBooleanType<BitType>
-
add
-
div
-
mul
-
sub
-
mul
public void mul(float c) - Specified by:
mul
in interfaceMulFloatingPoint
- Overrides:
mul
in classAbstractRealType<BitType>
-
mul
public void mul(double c) - Specified by:
mul
in interfaceMulFloatingPoint
- Overrides:
mul
in classAbstractRealType<BitType>
-
setOne
public void setOne()- Specified by:
setOne
in interfaceSetOne
- Overrides:
setOne
in classAbstractIntegerType<BitType>
-
setZero
public void setZero()- Specified by:
setZero
in interfaceSetZero
- Overrides:
setZero
in classAbstractIntegerType<BitType>
-
inc
public void inc() -
dec
public void dec() -
compareTo
- Specified by:
compareTo
in interfaceComparable<BitType>
- Overrides:
compareTo
in classAbstractIntegerType<BitType>
-
createVariable
Description copied from interface:Type
Creates a newType
variable which can only store one value.- Specified by:
createVariable
in interfaceType<BitType>
- Returns:
- a new
Type
variable
-
copy
Description copied from interface:Type
-
toString
- Overrides:
toString
in classAbstractIntegerType<BitType>
-
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 interfaceNativeType<BitType>
- 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 theNativeType
in the container.- Specified by:
updateIndex
in interfaceNativeType<BitType>
- 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 theNativeType
in the container.- Specified by:
getIndex
in interfaceNativeType<BitType>
- 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 theNativeType
in the container.- Specified by:
incIndex
in interfaceNativeType<BitType>
-
incIndex
public void incIndex(int increment) Description copied from interface:NativeType
Increases the index into the current data array byincrement
steps.This is used by accessors (e.g., a
Cursor
) to position theNativeType
in the container.- Specified by:
incIndex
in interfaceNativeType<BitType>
- 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 theNativeType
in the container.- Specified by:
decIndex
in interfaceNativeType<BitType>
-
decIndex
public void decIndex(int decrement) Description copied from interface:NativeType
Decrease the index into the current data array bydecrement
steps.This is used by accessors (e.g., a
Cursor
) to position theNativeType
in the container.- Specified by:
decIndex
in interfaceNativeType<BitType>
- Parameters:
decrement
- how many steps
-
getBitsPerPixel
public int getBitsPerPixel()- Specified by:
getBitsPerPixel
in interfaceRealType<BitType>
-
valueEquals
- Specified by:
valueEquals
in interfaceValueEquals<BitType>
-