Package net.imglib2.img.cell
Class CellGrid
java.lang.Object
net.imglib2.img.cell.CellGrid
Defines
AbstractCellImg
geometry and translates between image, cell,
and grid coordinates.- Author:
- Tobias Pietzsch
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionint
cellDimension
(int d) Get the number of pixels in a standard cell in a given dimension d.void
cellDimensions
(int[] dimensions) Write the number of pixels in a standard cell in each dimension into long[].boolean
void
getCellDimensions
(long[] cellGridPosition, long[] cellMin, int[] cellDims) From the position of a cell in the grid, compute the image position of the first pixel of the cell (the offset of the cell in image coordinates) and the dimensions of the cell.void
getCellDimensions
(long index, long[] cellMin, int[] cellDims) From the index of a cell in the grid, compute the image position of the first pixel of the cell (the offset of the cell in image coordinates) and the dimensions of the cell.void
getCellGridPositionFlat
(long index, long[] cellGridPosition) From the flattened index of a cell in the grid, compute the position of a cell in the grid.void
getCellPosition
(long[] position, long[] cellPos) Get the grid position of the cell containing the element atposition
.void
getCellPosition
(long[] position, Positionable cellPos) Get the grid position of the cell containing the element atposition
.long[]
long[]
Get the number of pixels in each dimension as a new long[].long
gridDimension
(int d) void
gridDimensions
(long[] s) int
hashCode()
long
imgDimension
(int d) Get the number of pixels in a given dimension d.void
imgDimensions
(long[] dimensions) Write the number of pixels in each dimension into long[].int
toString()
-
Constructor Details
-
CellGrid
public CellGrid(long[] dimensions, int[] cellDimensions) -
CellGrid
-
-
Method Details
-
numDimensions
public int numDimensions() -
getGridDimensions
public long[] getGridDimensions() -
gridDimensions
public void gridDimensions(long[] s) -
gridDimension
public long gridDimension(int d) -
getImgDimensions
public long[] getImgDimensions()Get the number of pixels in each dimension as a new long[]. Note, that this is the number of pixels in all cells combined, not the number of cells! -
imgDimensions
public void imgDimensions(long[] dimensions) Write the number of pixels in each dimension into long[]. Note, that this is the number of pixels in all cells combined, not the number of cells!- Parameters:
dimensions
-
-
imgDimension
public long imgDimension(int d) Get the number of pixels in a given dimension d. Note, that this is the number of pixels in all cells combined, not the number of cells!- Parameters:
d
-
-
cellDimensions
public void cellDimensions(int[] dimensions) Write the number of pixels in a standard cell in each dimension into long[]. Cells on the max border of the image may be cut off and have different dimensions.- Parameters:
dimensions
-
-
cellDimension
public int cellDimension(int d) Get the number of pixels in a standard cell in a given dimension d. Cells on the max border of the image may be cut off and have different dimensions.- Parameters:
d
-
-
getCellDimensions
public void getCellDimensions(long index, long[] cellMin, int[] cellDims) From the index of a cell in the grid, compute the image position of the first pixel of the cell (the offset of the cell in image coordinates) and the dimensions of the cell. The dimensions will be the standardcellDimensions
unless the cell is at the border of the image in which case it might be truncated.Note, that this method assumes that the cell grid has flat iteration order. It this is not the case, use
getCellDimensions(long[], long[], int[])
.- Parameters:
index
- flattened grid coordinates of the cell.cellMin
- offset of the cell in image coordinates are written here.cellDims
- dimensions of the cell are written here.
-
getCellDimensions
public void getCellDimensions(long[] cellGridPosition, long[] cellMin, int[] cellDims) From the position of a cell in the grid, compute the image position of the first pixel of the cell (the offset of the cell in image coordinates) and the dimensions of the cell. The dimensions will be the standardcellDimensions
unless the cell is at the border of the image in which case it might be truncated.- Parameters:
cellGridPosition
- grid coordinates of the cell.cellMin
- offset of the cell in image coordinates are written here.cellDims
- dimensions of the cell are written here.
-
getCellGridPositionFlat
public void getCellGridPositionFlat(long index, long[] cellGridPosition) From the flattened index of a cell in the grid, compute the position of a cell in the grid.- Parameters:
index
- flattened grid coordinates of the cell.cellGridPosition
- grid coordinates of the cell are written here.
-
getCellPosition
public void getCellPosition(long[] position, long[] cellPos) Get the grid position of the cell containing the element atposition
.- Parameters:
position
- position of an element in the image.cellPos
- is set to the grid position of the cell containing the element.
-
getCellPosition
Get the grid position of the cell containing the element atposition
.- Parameters:
position
- position of an element in the image.cellPos
- is set to the grid position of the cell containing the element.
-
hashCode
public int hashCode() -
equals
-
toString
-