public class MTBImageTileAdapter extends Object implements Iterable<MTBImage>
The class performs lazy evalutation, i.e. only actually instantiates a
tile image upon request. However, the tiles are not cached, i.e. on each
call to getTile(int, int)
or getAllTiles()
new images
are generated.
Modifier and Type | Class and Description |
---|---|
class |
MTBImageTileAdapter.TileIterator
Iterates from top-left to bottom-right over the tiles of an image.
|
Modifier and Type | Field and Description |
---|---|
protected MTBImage |
inImg
Image to process.
|
protected int |
shiftX
Offset of the tiles in x dimension.
|
protected int |
shiftY
Offset of the tiles in y dimension.
|
protected int |
tileColumns
Number of tile columns.
|
protected int |
tileRows
Number of tile rows.
|
protected int |
tileSizeX
Size of a tile in x-dimension.
|
protected int |
tileSizeY
Size of a tile in y-dimension.
|
Constructor and Description |
---|
MTBImageTileAdapter(MTBImage img,
int sizeX,
int sizeY)
Default constructor.
|
MTBImageTileAdapter(MTBImage img,
int sizeX,
int sizeY,
int shiftInX,
int shiftInY)
Default constructor.
|
Modifier and Type | Method and Description |
---|---|
MTBImage[][] |
getAllTiles()
Generates and returns array of all tiles.
|
MTBImage |
getTile(int idX,
int idY)
Returns tile with given indices.
|
double |
getTileCenterX(int idX)
Returns x-coordinate of tile center.
|
double |
getTileCenterY(int idY)
Returns x-coordinate of tile center.
|
int |
getTileCols()
Returns number of tiles and colums, respectively, in x-dimension.
|
int |
getTileRows()
Returns number of tiles and rows, respectively, in y-dimension.
|
Iterator<MTBImage> |
iterator() |
void |
saveTilesToFiles(String prefix)
Saves all tiles to the given path.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
forEach, spliterator
@Parameter(label="Size X", required=true, dataIOOrder=1, direction=IN, description="Size X") protected int tileSizeX
Note that the last tile might be smaller if the image size in x is not dividable by the tile size without remainder.
@Parameter(label="Size Y", required=true, dataIOOrder=1, direction=IN, description="Size Y") protected int tileSizeY
Note that the last tile might be smaller if the image size in y is not dividable by the tile size without remainder.
@Parameter(label="Shift X", required=true, dataIOOrder=1, direction=IN, description="Shift X") protected int shiftX
If the offset is smaller than the specified tileSizeX
, tiles are
overlapping. If it is larger, gaps result.
@Parameter(label="Shift Y", required=true, dataIOOrder=1, direction=IN, description="Shift Y") protected int shiftY
If the offset is smaller than the specified tileSizeY
, tiles are
overlapping. If it is larger, gaps result.
@Parameter(label="Input Image", required=true, direction=IN, description="Input Image") protected MTBImage inImg
protected int tileRows
protected int tileColumns
public MTBImageTileAdapter(MTBImage img, int sizeX, int sizeY, int shiftInX, int shiftInY)
img
- Image to be tiled.sizeX
- Tile size in x dimension.sizeY
- Tile size in y dimension.shiftInX
- Tile offset in x dimension.shiftInY
- Tile offset in y dimension.public MTBImageTileAdapter(MTBImage img, int sizeX, int sizeY)
img
- Image to be tiled.sizeX
- Tile size in x dimension.sizeY
- Tile size in y dimension.public int getTileRows()
public int getTileCols()
public MTBImage getTile(int idX, int idY)
idX
- Column index.idY
- Row index.public MTBImage[][] getAllTiles()
The tiles are arranged in the same order like in the image, i.e. the first index refers to the column and the second index to the row.
public double getTileCenterX(int idX)
idX
- Column index.public double getTileCenterY(int idY)
idY
- Row index.public void saveTilesToFiles(String prefix)
The tiles are saved in .tiff format. The file names are formed by the
prefix followed by '-ImageWriterMTB
is used,
however, the calls are not documented in the processing history.
prefix
- Path or filename where to save the images.Copyright © 2010–2020 Martin Luther University Halle-Wittenberg, Institute of Computer Science, Pattern Recognition and Bioinformatics. All rights reserved.