Class JPEGTurboServiceImpl

java.lang.Object
loci.formats.services.JPEGTurboServiceImpl
All Implemented Interfaces:
Service, JPEGTurboService

public class JPEGTurboServiceImpl extends Object implements JPEGTurboService
Based upon the NDPI to OME-TIFF converter by Matthias Baldauf: http://matthias-baldauf.at/software/ndpi_converter/
  • Constructor Details

    • JPEGTurboServiceImpl

      public JPEGTurboServiceImpl()
  • Method Details

    • setRestartMarkers

      public void setRestartMarkers(long[] markers)
      Specified by:
      setRestartMarkers in interface JPEGTurboService
      Parameters:
      markers - precalculated restart markers associated with the current JPEG stream
    • getRestartMarkers

      public long[] getRestartMarkers()
      Specified by:
      getRestartMarkers in interface JPEGTurboService
      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: JPEGTurboService
      Initialize 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:
      initialize in interface JPEGTurboService
      Parameters:
      jpeg - open stream containing JPEG data
      width - total image width
      height - total image height
      Throws:
      ServiceException
      IOException
    • getTileWidth

      public int getTileWidth()
      Specified by:
      getTileWidth in interface JPEGTurboService
      Returns:
      the width (in pixels) of a tile
    • getTileHeight

      public int getTileHeight()
      Specified by:
      getTileHeight in interface JPEGTurboService
      Returns:
      the height (in pixels) of a tile
    • getTileRows

      public int getTileRows()
      Specified by:
      getTileRows in interface JPEGTurboService
      Returns:
      the number of rows of tiles
    • getTileColumns

      public int getTileColumns()
      Specified by:
      getTileColumns in interface JPEGTurboService
      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: JPEGTurboService
      Get the uncompressed bytes representing the given bounding box.
      Specified by:
      getTile in interface JPEGTurboService
      Parameters:
      buf - array in which to store uncompressed bytes
      xCoordinate - upper-left X coordinate of bounding box
      yCoordinate - upper-left Y coordinate of bounding box
      width - width of bounding box
      height - height of bounding box
      Returns:
      uncompressed bytes
      Throws:
      IOException
    • getTile

      public byte[] getTile(int tileX, int tileY) throws IOException
      Description copied from interface: JPEGTurboService
      Get the uncompressed bytes representing the given tile index.
      Specified by:
      getTile in interface JPEGTurboService
      Parameters:
      tileX - column index of the tile
      tileY - row index of the tile
      Returns:
      uncompressed bytes
      Throws:
      IOException
    • getCompressedTile

      public byte[] getCompressedTile(int tileX, int tileY) throws IOException
      Description copied from interface: JPEGTurboService
      Similar to getTile(int, int), but returns the JPEG-compressed bytes.
      Specified by:
      getCompressedTile in interface JPEGTurboService
      Parameters:
      tileX - column index of the tile
      tileY - row index of the tile
      Returns:
      JPEG-compressed bytes
      Throws:
      IOException
    • getCompressedTile

      public byte[] getCompressedTile(byte[] data, int tileX, int tileY) throws IOException
      Description copied from interface: JPEGTurboService
      Similar to getTile(int, int), but returns the JPEG-compressed bytes.
      Specified by:
      getCompressedTile in interface JPEGTurboService
      Parameters:
      data - preallocated array for storing tile
      tileX - column index of the tile
      tileY - row index of the tile
      Returns:
      JPEG-compressed bytes
      Throws:
      IOException
    • close

      public void close() throws IOException
      Description copied from interface: JPEGTurboService
      Free resources associated with the initialized stream.
      Specified by:
      close in interface JPEGTurboService
      Throws:
      IOException
    • isLibraryLoaded

      public boolean isLibraryLoaded()
      Specified by:
      isLibraryLoaded in interface JPEGTurboService
      Returns:
      true if the underlying native library was successfully loaded