Class SparseImageServer

All Implemented Interfaces:
AutoCloseable, ImageServer<BufferedImage>

public class SparseImageServer extends AbstractTileableImageServer
An ImageServer that combines regions from multiple separate ImageServers, repositioning these as necessary to generate one larger field of view.

Regions are currently defined within a JSON file passed as the 'path' argument, and this also contains the full paths to the other ImageServers.

Author:
Pete Bankhead
  • Method Details

    • getDefaultColorModel

      protected ColorModel getDefaultColorModel()
      Description copied from class: AbstractTileableImageServer
      Get an appropriate colormodel that may be used. The default implementation uses the default RGB color model for RGB images, or else requests a low-resolution thumbnail to extract the color model from it. If neither implementation is sufficient, subclasses should override this method.
      Overrides:
      getDefaultColorModel in class AbstractTileableImageServer
      Returns:
    • getURIs

      public Collection<URI> getURIs()
      Description copied from interface: ImageServer
      Get the URIs for images required for this server. In the simplest case, this is a singleton list returning a URI representing a local file. However, some ImageServers may not have an associated URI at all, whereas others may depend upon multiple URIs (e.g. if concatenating images).

      Note: A URI alone may not be sufficient to recreate even a simple ImageServer; see ImageServer.getBuilder().

      Returns:
    • createID

      protected String createID()
      Returns a UUID.
      Specified by:
      createID in class AbstractImageServer<BufferedImage>
      Returns:
    • getManager

      Get the manager, which defines from whence the regions originate.
      Returns:
    • getServerType

      public String getServerType()
      Description copied from interface: ImageServer
      A string describing the type of server, for example the name of the library used (Openslide, Bioformats...)
      Returns:
    • getOriginalMetadata

      public ImageServerMetadata getOriginalMetadata()
      Description copied from interface: ImageServer
      Get the original metadata read during creation of the server. This may or may not be correct.
      Returns:
      See Also:
    • createServerBuilder

      protected ImageServerBuilder.ServerBuilder<BufferedImage> createServerBuilder()
      Description copied from class: AbstractImageServer
      Create a ServerBuilder, which can be used to construct an identical ImageServer. This should also include the current metadata. It is permissible to return null for an ImageServer that cannot be recreated via a ImageServerBuilder.ServerBuilder.
      Specified by:
      createServerBuilder in class AbstractImageServer<BufferedImage>
      Returns:
    • close

      public void close() throws Exception
      Specified by:
      close in interface AutoCloseable
      Overrides:
      close in class AbstractImageServer<BufferedImage>
      Throws:
      Exception
    • readTile

      protected BufferedImage readTile(TileRequest tileRequest) throws IOException
      Description copied from class: AbstractTileableImageServer
      Read a single image tile.
      Specified by:
      readTile in class AbstractTileableImageServer
      Parameters:
      tileRequest -
      Returns:
      Throws:
      IOException
    • splitConnectedRegions

      public static List<SparseImageServer> splitConnectedRegions(SparseImageServer server, double distancePixels, boolean permitBoundsOverlap) throws IOException
      Split a SparseImageServer into multiple servers, whereby each split server represents one connected region. This can be useful whenever a sparse server contains (for example) multiple pieces of tissue with a substantial gap between them, because it allows each piece to be treated as a separate image.
      Parameters:
      server - the sparse server to be split
      distancePixels - the maximum separation between regions for them to be considered part of the same server after splitting. Must be a positive value or zero; suggested default is 1.
      permitBoundsOverlap - if true, the bounding boxes for each server may overlap. If unsure, it is strongly advised to use 'false', since otherwise part of a returned server may be 'empty' because the corresponding region was assigned to another server, creating the misleading impression there was nothing there.
      Returns:
      Throws:
      IOException