ome.services
Class ThumbnailCtx

java.lang.Object
  extended by ome.services.ThumbnailCtx

public class ThumbnailCtx
extends Object


Field Summary
static String DEFAULT_MIME_TYPE
          Default thumbnail MIME type.
 
Constructor Summary
ThumbnailCtx(IQuery queryService, IUpdate updateService, IPixels pixelsService, IRenderingSettings settingsService, ThumbnailService thumbnailService, SecuritySystem securitySystem, long userId)
          Default constructor.
 
Method Summary
 Dimension calculateXYWidths(ome.model.core.Pixels pixels, int longestSide)
          Calculates the ratio of the two sides of a Pixel set and returns the X and Y widths based on the longest side maintaining aspect ratio.
 void createAndPrepareMissingRenderingSettings(Set<Long> pixelsIds)
          Resets a given set of Pixels rendering settings to the default effectively creating any which do not exist.
 ome.model.display.Thumbnail createThumbnailMetadata(ome.model.core.Pixels pixels, Dimension dimensions)
          Creates metadata for a thumbnail of a given set of pixels set and X-Y dimensions.
 boolean dirtyMetadata(long pixelsId)
          Whether or not the thumbnail metadata for a given Pixels ID is dirty (the RenderingDef has been updated since the Thumbnail was).
 ome.model.display.Thumbnail getMetadata(long pixelsId)
          Retrieves the Thumbnail object for a given Pixels ID.
 ome.model.core.Pixels getPixels(long pixelsId)
          Retrieves the Pixels object for a given Pixels ID.
 ome.model.display.RenderingDef getSettings(long pixelsId)
          Retrieves the RenderingDef object for a given Pixels ID.
 long getUserId()
          Retrieves the current user ID to use for queries.
 boolean hasMetadata(long pixelsId)
          Whether or not thumbnail metadata is available for a given Pixels ID.
 boolean hasSettings(long pixelsId)
          Whether or not settings are available for a given Pixels ID.
 boolean isExtendedGraphCritical(Set<Long> pixelsIds)
          Whether or not we're extended graph critical for a given set of dimension pools.
 boolean isThumbnailCached(long pixelsId)
          Checks to see if a thumbnail is in the on disk cache or not.
 List<ome.model.display.Thumbnail> loadAllMetadata(long pixelsId)
          Retrieves all thumbnail metadata available in the database for a given Pixels ID.
 void loadAndPrepareMetadata(Set<Long> pixelsIds, Dimension dimensions)
          Bulk loads and prepares metadata for a group of pixels sets.
 void loadAndPrepareMetadata(Set<Long> pixelsIds, int longestSide)
          Bulk loads and prepares metadata for a group of pixels sets.
 void loadAndPrepareRenderingSettings(long pixelsId, long settingsId)
          Loads and prepares a rendering settings for a Pixels ID and RenderingDef ID.
 void loadAndPrepareRenderingSettings(Set<Long> pixelsIds)
          Bulk loads a set of rendering settings for a group of pixels sets and prepares our internal data structures.
 void setUserId(long userId)
          Sets the user ID to use for queries.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_MIME_TYPE

public static final String DEFAULT_MIME_TYPE
Default thumbnail MIME type.

See Also:
Constant Field Values
Constructor Detail

ThumbnailCtx

public ThumbnailCtx(IQuery queryService,
                    IUpdate updateService,
                    IPixels pixelsService,
                    IRenderingSettings settingsService,
                    ThumbnailService thumbnailService,
                    SecuritySystem securitySystem,
                    long userId)
Default constructor.

Parameters:
queryService - OMERO query service to use.
updateService - OMERO update service to use.
pixelsService - OMERO pixels service to use.
settingsService - OMERO rendering settings service to use.
thumbnailService - OMERO thumbnail service to use.
securitySystem - OMERO security system for this session.
userId - Current user ID.
Method Detail

getUserId

public long getUserId()
Retrieves the current user ID to use for queries.

Returns:
See above.

setUserId

public void setUserId(long userId)
Sets the user ID to use for queries.

Parameters:
userId - The user ID to use for queries.

loadAndPrepareRenderingSettings

public void loadAndPrepareRenderingSettings(Set<Long> pixelsIds)
Bulk loads a set of rendering settings for a group of pixels sets and prepares our internal data structures.

Parameters:
pixelsIds - Set of Pixels IDs to prepare rendering settings for.

loadAndPrepareRenderingSettings

public void loadAndPrepareRenderingSettings(long pixelsId,
                                            long settingsId)
Loads and prepares a rendering settings for a Pixels ID and RenderingDef ID.

Parameters:
pixelsId - Pixels ID to load.
settingsId - RenderingDef ID to load an prepare settings for.

loadAndPrepareMetadata

public void loadAndPrepareMetadata(Set<Long> pixelsIds,
                                   int longestSide)
Bulk loads and prepares metadata for a group of pixels sets. Calling this method guarantees that metadata are available, creating them if they are not.

Parameters:
pixelsIds - Pixels IDs to prepare metadata for.
longestSide - The longest side of the thumbnails requested.

loadAndPrepareMetadata

public void loadAndPrepareMetadata(Set<Long> pixelsIds,
                                   Dimension dimensions)
Bulk loads and prepares metadata for a group of pixels sets. Calling this method guarantees that metadata are available, creating them if they are not.

Parameters:
pixelsIds - Pixels IDs to prepare metadata for.
dimensions - X-Y dimensions of the thumbnails requested.

loadAllMetadata

public List<ome.model.display.Thumbnail> loadAllMetadata(long pixelsId)
Retrieves all thumbnail metadata available in the database for a given Pixels ID.

Parameters:
pixelsId - Pixels ID to retrieve thumbnail metadata for.
Returns:
See above.

createAndPrepareMissingRenderingSettings

public void createAndPrepareMissingRenderingSettings(Set<Long> pixelsIds)
Resets a given set of Pixels rendering settings to the default effectively creating any which do not exist.

Parameters:
pixelsIds - Pixels IDs

hasSettings

public boolean hasSettings(long pixelsId)
Whether or not settings are available for a given Pixels ID.

Parameters:
pixelsId - Pixels ID to check for availability.
Returns:
true if settings are available and false otherwise.

hasMetadata

public boolean hasMetadata(long pixelsId)
Whether or not thumbnail metadata is available for a given Pixels ID.

Parameters:
pixelsId - Pixels ID to check for availability.
Returns:
true if metadata is available and false otherwise.

getPixels

public ome.model.core.Pixels getPixels(long pixelsId)
Retrieves the Pixels object for a given Pixels ID.

Parameters:
pixelsId - Pixels ID to retrieve the Pixels object for.
Returns:
See above.

getSettings

public ome.model.display.RenderingDef getSettings(long pixelsId)
Retrieves the RenderingDef object for a given Pixels ID.

Parameters:
pixelsId - Pixels ID to retrieve the RenderingDef object for.
Returns:
See above.

getMetadata

public ome.model.display.Thumbnail getMetadata(long pixelsId)
Retrieves the Thumbnail object for a given Pixels ID.

Parameters:
pixelsId - Pixels ID to retrieve the Thumbnail object for.
Returns:
See above.

dirtyMetadata

public boolean dirtyMetadata(long pixelsId)
Whether or not the thumbnail metadata for a given Pixels ID is dirty (the RenderingDef has been updated since the Thumbnail was).

Parameters:
pixelsId - Pixels ID to check for dirty metadata.
Returns:
true if the metadata is dirty false otherwise.

isThumbnailCached

public boolean isThumbnailCached(long pixelsId)
Checks to see if a thumbnail is in the on disk cache or not.

Parameters:
pixelsId - The Pixels set the thumbnail is for.
Returns:
Whether or not the thumbnail is in the on disk cache.

calculateXYWidths

public Dimension calculateXYWidths(ome.model.core.Pixels pixels,
                                   int longestSide)
Calculates the ratio of the two sides of a Pixel set and returns the X and Y widths based on the longest side maintaining aspect ratio.

Parameters:
pixels - The Pixels set to calculate against.
longestSide - The size of the longest side of the thumbnail requested.
Returns:
The calculated width (X) and height (Y).

isExtendedGraphCritical

public boolean isExtendedGraphCritical(Set<Long> pixelsIds)
Whether or not we're extended graph critical for a given set of dimension pools. We're extended graph critical if:

Parameters:
pixelsIds - Set of Pixels to check if we're graph critical for.
Returns:
true if we're graph critical, and false otherwise.

createThumbnailMetadata

public ome.model.display.Thumbnail createThumbnailMetadata(ome.model.core.Pixels pixels,
                                                           Dimension dimensions)
Creates metadata for a thumbnail of a given set of pixels set and X-Y dimensions.

Parameters:
pixels - The Pixels set to create thumbnail metadata for.
dimensions - The dimensions of the thumbnail.
Returns:
the thumbnail metadata as created.
See Also:
getThumbnailMetadata()


OmeroJava Api

Version: 4.3.3-00d1137e-b2894

Copyright © 2009 The University of Dundee. All Rights Reserved.