public class Grid2D extends Grid implements Transformable
Grid
Constructor and Description |
---|
Grid2D(float[] buffer,
int[] size) |
Grid2D(float[] buffer,
int width,
int height) |
Grid2D(Grid2D input) |
Grid2D(int width,
int height) |
Modifier and Type | Method and Description |
---|---|
void |
addAtIndex(int i,
int j,
float val) |
void |
applyTransform(Transform t)
Applies the Transform t to the object.
|
Grid |
clone()
Deep copy the object
|
void |
divideAtIndex(int i,
int j,
float val) |
float |
getAtIndex(int i,
int j) |
float[] |
getBuffer()
Returns a reference to the linear buffer containing the 2D image in a row-first manner.
|
int |
getHeight()
Gets the grid's height
|
float[] |
getPixels() |
float |
getPixelValue(int x,
int y)
Get the pixel value at position (x,y)
|
Grid1D |
getSubGrid(int j)
Returns the corresponding Grid1D object that points on the linear 2D row memory
|
float |
getValue(int[] idx) |
int |
getWidth()
Gets the grid's width
|
double[] |
indexToPhysical(double i,
double j) |
void |
multiplyAtIndex(int i,
int j,
float val) |
double[] |
physicalToIndex(double x,
double y) |
void |
putPixelValue(int x,
int y,
double value)
Set a pixel value at position (x,y)
|
void |
putPixelValue(int x,
int y,
float value)
Set a pixel value at position (x,y)
|
void |
setAtIndex(int i,
int j,
float val) |
void |
setOrigin(double... origin)
Set the array origin's world coordinates, given in real world units (usually mm) of the first pixel's center (excluding borders), in all dimensions.
|
void |
setSpacing(double... spacing)
Set the array's spacings.
|
void |
show()
Show the object in an imageJ window
|
void |
show(java.lang.String title)
Show the object in an imageJ window with title
|
void |
subAtIndex(int i,
int j,
float val) |
java.lang.String |
toString()
Serialize the grid's content to a String.
|
getNumberOfElements, getOrigin, getSize, getSpacing
public Grid2D(int width, int height)
public Grid2D(float[] buffer, int[] size)
public Grid2D(float[] buffer, int width, int height)
public Grid2D(Grid2D input)
public float[] getBuffer()
public Grid1D getSubGrid(int j)
j
- The row-index (y-index, height-index)public double[] indexToPhysical(double i, double j)
public double[] physicalToIndex(double x, double y)
public float getAtIndex(int i, int j)
public void setAtIndex(int i, int j, float val)
public void addAtIndex(int i, int j, float val)
public void multiplyAtIndex(int i, int j, float val)
public void subAtIndex(int i, int j, float val)
public void divideAtIndex(int i, int j, float val)
public java.lang.String toString()
Grid
public void show(java.lang.String title)
Grid
public void show()
Grid
public float[] getPixels()
public int getWidth()
public int getHeight()
public void putPixelValue(int x, int y, float value)
x
- The value's x positiony
- The value's y positionvalue
- The value to setpublic void putPixelValue(int x, int y, double value)
x
- The value's x positiony
- The value's y positionvalue
- The value to setpublic float getPixelValue(int x, int y)
x
- The value's x positiony
- The value's y positionpublic void applyTransform(Transform t)
Transformable
applyTransform
in interface Transformable
t
- the transform to apply to the object.public void setSpacing(double... spacing)
Grid
setSpacing
in class Grid