Package loci.formats.services
Class JPEGTurboServiceImpl
java.lang.Object
loci.formats.services.JPEGTurboServiceImpl
- All Implemented Interfaces:
loci.common.services.Service,JPEGTurboService
Based upon the NDPI to OME-TIFF converter by Matthias Baldauf:
http://matthias-baldauf.at/software/ndpi_converter/
- Author:
- Melissa Linkert melissa at glencoesoftware.com
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final intprivate static final intprivate byte[]private longprivate intprivate intprivate loci.common.RandomAccessInputStreamprivate static booleanprivate Loggerprivate static final org.slf4j.Loggerprivate intprivate intprivate static final Stringprivate longprivate intprivate static final intprivate static final intprivate static final intprivate longprivate static final intprivate intprivate intprivate intprivate int -
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.private byte[]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(loci.common.RandomAccessInputStream jpeg, int width, int height) Initialize the given stream, which represents an image of the given width and height.booleanprivate voidparseSOF()voidsetRestartMarkers(long[] markers)
-
Field Details
-
LOGGER
private static final org.slf4j.Logger LOGGER -
NATIVE_LIB_CLASS
- See Also:
-
SOF0
private static final int SOF0- See Also:
-
DRI
private static final int DRI- See Also:
-
SOS
private static final int SOS- See Also:
-
RST0
private static final int RST0- See Also:
-
RST7
private static final int RST7- See Also:
-
EOI
private static final int EOI- See Also:
-
logger
-
imageWidth
private int imageWidth -
imageHeight
private int imageHeight -
offset
private long offset -
in
private loci.common.RandomAccessInputStream in -
restartInterval
private int restartInterval -
sos
private long sos -
imageDimensions
private long imageDimensions -
mcuWidth
private int mcuWidth -
mcuHeight
private int mcuHeight -
tileWidth
private int tileWidth -
tileHeight
private int tileHeight -
xTiles
private int xTiles -
yTiles
private int yTiles -
restartMarkers
-
header
private byte[] header -
libraryLoaded
private static boolean libraryLoaded
-
-
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(loci.common.RandomAccessInputStream jpeg, int width, int height) throws loci.common.services.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:
loci.common.services.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
-
getFixedHeader
- Throws:
IOException
-
parseSOF
- Throws:
IOException
-