|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectde.unihalle.informatik.MiToBo.core.datatypes.images.MTBImageTileAdapter
public class MTBImageTileAdapter
Adapter class to support tile-wise processing of images.
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.
Nested Class Summary | |
---|---|
class |
MTBImageTileAdapter.TileIterator
Iterates from top-left to bottom-right over the tiles of an image. |
Field Summary | |
---|---|
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 Summary | |
---|---|
MTBImageTileAdapter(MTBImage img,
int sizeX,
int sizeY)
Default constructor. |
|
MTBImageTileAdapter(MTBImage img,
int sizeX,
int sizeY,
int shiftInX,
int shiftInY)
Default constructor. |
Method Summary | |
---|---|
MTBImage[][] |
getAllTiles()
Generates and returns array of all tiles. |
MTBImage |
getTile(int idX,
int idY)
Returns tile with given indices. |
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. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
@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
Constructor Detail |
---|
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.Method Detail |
---|
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 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.
public Iterator<MTBImage> iterator()
iterator
in interface Iterable<MTBImage>
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |