Package loci.formats.services
Class JPEGTurboServiceImpl
java.lang.Object
loci.formats.services.JPEGTurboServiceImpl
- All Implemented Interfaces:
Service,JPEGTurboService
Based upon the NDPI to OME-TIFF converter by Matthias Baldauf:
http://matthias-baldauf.at/software/ndpi_converter/
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Free resources associated with the initialized stream.byte[]getCompressedTile(byte[] data, int tileX, int tileY) Similar to getTile(int, int), but returns the JPEG-compressed bytes.byte[]getCompressedTile(int tileX, int tileY) Similar to getTile(int, int), but returns the JPEG-compressed bytes.long[]byte[]getTile(byte[] buf, int xCoordinate, int yCoordinate, int width, int height) Get the uncompressed bytes representing the given bounding box.byte[]getTile(int tileX, int tileY) Get the uncompressed bytes representing the given tile index.intintintintvoidinitialize(RandomAccessInputStream jpeg, int width, int height) Initialize the given stream, which represents an image of the given width and height.booleanvoidsetRestartMarkers(long[] markers)
-
Constructor Details
-
JPEGTurboServiceImpl
public JPEGTurboServiceImpl()
-
-
Method Details
-
setRestartMarkers
public void setRestartMarkers(long[] markers) - Specified by:
setRestartMarkersin interfaceJPEGTurboService- Parameters:
markers- precalculated restart markers associated with the current JPEG stream
-
getRestartMarkers
public long[] getRestartMarkers()- Specified by:
getRestartMarkersin interfaceJPEGTurboService- Returns:
- the restart markers associated with the current JPEG stream
-
initialize
public void initialize(RandomAccessInputStream jpeg, int width, int height) throws ServiceException, IOException Description copied from interface:JPEGTurboServiceInitialize the given stream, which represents an image of the given width and height. This service is primarily intended for very large JPEG images whose width and/or height exceed 65535 (the maximum that can be recorded in a JPEG stream).- Specified by:
initializein interfaceJPEGTurboService- Parameters:
jpeg- open stream containing JPEG datawidth- total image widthheight- total image height- Throws:
ServiceExceptionIOException
-
getTileWidth
public int getTileWidth()- Specified by:
getTileWidthin interfaceJPEGTurboService- Returns:
- the width (in pixels) of a tile
-
getTileHeight
public int getTileHeight()- Specified by:
getTileHeightin interfaceJPEGTurboService- Returns:
- the height (in pixels) of a tile
-
getTileRows
public int getTileRows()- Specified by:
getTileRowsin interfaceJPEGTurboService- Returns:
- the number of rows of tiles
-
getTileColumns
public int getTileColumns()- Specified by:
getTileColumnsin interfaceJPEGTurboService- Returns:
- the number of columns of tiles
-
getTile
public byte[] getTile(byte[] buf, int xCoordinate, int yCoordinate, int width, int height) throws IOException Description copied from interface:JPEGTurboServiceGet the uncompressed bytes representing the given bounding box.- Specified by:
getTilein interfaceJPEGTurboService- Parameters:
buf- array in which to store uncompressed bytesxCoordinate- upper-left X coordinate of bounding boxyCoordinate- upper-left Y coordinate of bounding boxwidth- width of bounding boxheight- height of bounding box- Returns:
- uncompressed bytes
- Throws:
IOException
-
getTile
Description copied from interface:JPEGTurboServiceGet the uncompressed bytes representing the given tile index.- Specified by:
getTilein interfaceJPEGTurboService- Parameters:
tileX- column index of the tiletileY- row index of the tile- Returns:
- uncompressed bytes
- Throws:
IOException
-
getCompressedTile
Description copied from interface:JPEGTurboServiceSimilar to getTile(int, int), but returns the JPEG-compressed bytes.- Specified by:
getCompressedTilein interfaceJPEGTurboService- Parameters:
tileX- column index of the tiletileY- row index of the tile- Returns:
- JPEG-compressed bytes
- Throws:
IOException
-
getCompressedTile
Description copied from interface:JPEGTurboServiceSimilar to getTile(int, int), but returns the JPEG-compressed bytes.- Specified by:
getCompressedTilein interfaceJPEGTurboService- Parameters:
data- preallocated array for storing tiletileX- column index of the tiletileY- row index of the tile- Returns:
- JPEG-compressed bytes
- Throws:
IOException
-
close
Description copied from interface:JPEGTurboServiceFree resources associated with the initialized stream.- Specified by:
closein interfaceJPEGTurboService- Throws:
IOException
-
isLibraryLoaded
public boolean isLibraryLoaded()- Specified by:
isLibraryLoadedin interfaceJPEGTurboService- Returns:
- true if the underlying native library was successfully loaded
-