Class GenericShortType<T extends GenericShortType<T>>
- java.lang.Object
-
- net.imglib2.type.numeric.complex.AbstractComplexType<T>
-
- net.imglib2.type.numeric.real.AbstractRealType<T>
-
- net.imglib2.type.numeric.integer.AbstractIntegerType<T>
-
- net.imglib2.type.numeric.integer.GenericShortType<T>
-
- All Implemented Interfaces:
java.lang.Comparable<T>
,NativeType<T>
,ComplexType<T>
,IntegerType<T>
,NumericType<T>
,RealType<T>
,Add<T>
,Div<T>
,Mul<T>
,MulFloatingPoint
,SetOne
,SetZero
,Sub<T>
,ValueEquals<T>
,Type<T>
- Direct Known Subclasses:
ShortType
,UnsignedShortType
public abstract class GenericShortType<T extends GenericShortType<T>> extends AbstractIntegerType<T> implements NativeType<T>
Abstract base class fornative
IntegerType
s that encode their value into a 16bit short.- Author:
- Stephan Preibisch, Stephan Saalfeld
-
-
Field Summary
Fields Modifier and Type Field Description protected ShortAccess
dataAccess
protected NativeImg<?,? extends ShortAccess>
img
-
Constructor Summary
Constructors Constructor Description GenericShortType()
GenericShortType(short value)
GenericShortType(ShortAccess access)
GenericShortType(NativeImg<?,? extends ShortAccess> shortStorage)
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description void
add(T c)
int
compareTo(T c)
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
div(T c)
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.short
getShort()
Returns the primitive short value that is used to store this type.protected short
getValue()
Deprecated.UsegetShort()
instead.int
hashCode()
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
mul(T c)
void
set(T c)
Sets the value of anotherType
.void
setOne()
void
setShort(short f)
Sets the primitive short value that is used to store this type.protected void
setValue(short f)
Deprecated.UsesetShort(short)
instead.void
setZero()
void
sub(T c)
java.lang.String
toString()
void
updateContainer(java.lang.Object c)
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
valueEquals(T t)
-
Methods inherited from class net.imglib2.type.numeric.integer.AbstractIntegerType
getMinIncrement, getRealDouble, getRealFloat, 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, setComplexNumber, setComplexNumber, setImaginary, setImaginary
-
Methods inherited from interface net.imglib2.type.numeric.IntegerType
getBigInteger, getInteger, getIntegerLong, setBigInteger, setInteger, setInteger
-
Methods inherited from interface net.imglib2.type.NativeType
createSuitableNativeImg, duplicateTypeOnSameNativeImg
-
Methods inherited from interface net.imglib2.type.numeric.RealType
getMaxValue, getMinValue
-
Methods inherited from interface net.imglib2.type.Type
copy, createVariable
-
-
-
-
Field Detail
-
img
protected final NativeImg<?,? extends ShortAccess> img
-
dataAccess
protected ShortAccess dataAccess
-
-
Constructor Detail
-
GenericShortType
public GenericShortType(NativeImg<?,? extends ShortAccess> shortStorage)
-
GenericShortType
public GenericShortType(short value)
-
GenericShortType
public GenericShortType(ShortAccess access)
-
GenericShortType
public GenericShortType()
-
-
Method Detail
-
getEntitiesPerPixel
public Fraction 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<T extends GenericShortType<T>>
- Returns:
- the number of storage type entities required to store one pixel value.
-
updateContainer
public void updateContainer(java.lang.Object c)
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<T extends GenericShortType<T>>
- Parameters:
c
- reference to an accessor which can be passed on to the container (which will know what to do with it).
-
getValue
@Deprecated protected short getValue()
Deprecated.UsegetShort()
instead.
-
setValue
@Deprecated protected void setValue(short f)
Deprecated.UsesetShort(short)
instead.
-
getShort
public short getShort()
Returns the primitive short value that is used to store this type.- Returns:
- primitive short value
-
setShort
public void setShort(short f)
Sets the primitive short value that is used to store this type.
-
mul
public void mul(float c)
- Specified by:
mul
in interfaceMulFloatingPoint
- Overrides:
mul
in classAbstractRealType<T extends GenericShortType<T>>
-
mul
public void mul(double c)
- Specified by:
mul
in interfaceMulFloatingPoint
- Overrides:
mul
in classAbstractRealType<T extends GenericShortType<T>>
-
add
public void add(T c)
- Specified by:
add
in interfaceAdd<T extends GenericShortType<T>>
- Overrides:
add
in classAbstractRealType<T extends GenericShortType<T>>
-
div
public void div(T c)
- Specified by:
div
in interfaceDiv<T extends GenericShortType<T>>
- Overrides:
div
in classAbstractRealType<T extends GenericShortType<T>>
-
mul
public void mul(T c)
- Specified by:
mul
in interfaceMul<T extends GenericShortType<T>>
- Overrides:
mul
in classAbstractRealType<T extends GenericShortType<T>>
-
sub
public void sub(T c)
- Specified by:
sub
in interfaceSub<T extends GenericShortType<T>>
- Overrides:
sub
in classAbstractRealType<T extends GenericShortType<T>>
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classAbstractIntegerType<T extends GenericShortType<T>>
-
compareTo
public int compareTo(T c)
- Specified by:
compareTo
in interfacejava.lang.Comparable<T extends GenericShortType<T>>
- Overrides:
compareTo
in classAbstractIntegerType<T extends GenericShortType<T>>
-
set
public void set(T c)
Description copied from interface:Type
Sets the value of anotherType
.- Specified by:
set
in interfaceType<T extends GenericShortType<T>>
- Overrides:
set
in classAbstractRealType<T extends GenericShortType<T>>
- Parameters:
c
- the new value
-
setOne
public void setOne()
- Specified by:
setOne
in interfaceSetOne
- Overrides:
setOne
in classAbstractIntegerType<T extends GenericShortType<T>>
-
setZero
public void setZero()
- Specified by:
setZero
in interfaceSetZero
- Overrides:
setZero
in classAbstractIntegerType<T extends GenericShortType<T>>
-
inc
public void inc()
- Specified by:
inc
in interfaceRealType<T extends GenericShortType<T>>
- Overrides:
inc
in classAbstractIntegerType<T extends GenericShortType<T>>
-
dec
public void dec()
- Specified by:
dec
in interfaceRealType<T extends GenericShortType<T>>
- Overrides:
dec
in classAbstractIntegerType<T extends GenericShortType<T>>
-
toString
public java.lang.String toString()
- Overrides:
toString
in classAbstractIntegerType<T extends GenericShortType<T>>
-
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<T extends GenericShortType<T>>
- 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<T extends GenericShortType<T>>
- 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<T extends GenericShortType<T>>
-
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<T extends GenericShortType<T>>
- 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<T extends GenericShortType<T>>
-
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<T extends GenericShortType<T>>
- Parameters:
decrement
- how many steps
-
getBitsPerPixel
public int getBitsPerPixel()
- Specified by:
getBitsPerPixel
in interfaceRealType<T extends GenericShortType<T>>
-
valueEquals
public boolean valueEquals(T t)
- Specified by:
valueEquals
in interfaceValueEquals<T extends GenericShortType<T>>
-
-