@Transactional(readOnly=true) public class ThumbnailBean extends AbstractLevel2Service implements ThumbnailStore, Serializable
Modifier and Type | Field and Description |
---|---|
static float |
DEFAULT_COMPRESSION_QUALITY
The default compression quality in fractional percent.
|
static String |
DEFAULT_MIME_TYPE
The default MIME type.
|
static int |
DEFAULT_X_WIDTH
The default X-width for a thumbnail.
|
static int |
DEFAULT_Y_WIDTH
The default Y-width for a thumbnail.
|
iQuery, iUpdate, metadata, queryFactory, sec
Constructor and Description |
---|
ThumbnailBean()
default constructor
|
ThumbnailBean(boolean checking)
overridden to allow Spring to set boolean
|
Modifier and Type | Method and Description |
---|---|
void |
activate()
Completely restore this service for active use from whatever
passivation it has implemented.
|
void |
close()
signals the end of the service lifecycle.
|
void |
createThumbnail(Integer sizeX,
Integer sizeY)
Creates a thumbnail for a pixels set using a given set of rendering
settings (RenderingDef) in the on-disk cache.
|
void |
createThumbnails()
Creates thumbnails for a pixels set using a given set of rendering
settings (RenderingDef) in the on-disk cache for every
sizeX/sizeY combination already cached.
|
void |
createThumbnailsByLongestSideSet(Integer size,
Set<Long> pixelsIds)
Creates thumbnails for a number of pixels sets using a given set of
rendering settings (RenderingDef) in the on-disk cache.
|
protected void |
errorIfInvalidState() |
protected void |
errorIfNullPixels() |
protected void |
errorIfNullPixelsAndRenderingDef() |
protected void |
errorIfNullRenderingDef() |
EventContext |
getCurrentEventContext()
Returns the current
EventContext for this instance. |
long |
getRenderingDefId()
Return the id of the
RenderingDef loaded in
this instance. |
Class<? extends ServiceInterface> |
getServiceInterface() |
byte[] |
getThumbnail(Integer sizeX,
Integer sizeY)
Retrieves a thumbnail for a pixels set using a given set of rendering
settings (RenderingDef).
|
byte[] |
getThumbnailByLongestSide(Integer size)
Retrieves a thumbnail for a pixels set using a given set of rendering
settings (RenderingDef).
|
byte[] |
getThumbnailByLongestSideDirect(Integer size)
Retrieves a thumbnail for a pixels set using a given set of rendering
settings (RenderingDef).
|
Map<Long,byte[]> |
getThumbnailByLongestSideSet(Integer size,
Set<Long> pixelsIds)
Retrieves a number of thumbnails for pixels sets using given sets of
rendering settings (RenderingDef).
|
byte[] |
getThumbnailDirect(Integer sizeX,
Integer sizeY)
Retrieves a thumbnail for a pixels set using a given set of rendering
settings (RenderingDef).
|
byte[] |
getThumbnailForSectionByLongestSideDirect(int theZ,
int theT,
Integer size)
Retrieves a thumbnail for a pixels set using a given set of rendering
settings (RenderingDef) for a particular section.
|
byte[] |
getThumbnailForSectionDirect(int theZ,
int theT,
Integer sizeX,
Integer sizeY)
Retrieves a thumbnail for a pixels set using a given set of rendering
settings (RenderingDef) for a particular section.
|
Map<Long,byte[]> |
getThumbnailSet(Integer sizeX,
Integer sizeY,
Set<Long> pixelsIds)
Retrieves a number of thumbnails for pixels sets using given sets of
rendering settings (RenderingDef).
|
boolean |
isDiskSpaceChecking() |
boolean |
isInProgress()
This returns the last available in progress state for a
thumbnail.
|
void |
passivate()
Perform whatever passivation is possible or throw an exception.
|
void |
resetDefaults()
Resets the rendering definition for the active pixels set to its
default settings.
|
void |
setCompressionService(LocalCompress compressionService)
Compression service Bean injector.
|
void |
setDiskSpaceChecking(boolean diskSpaceChecking) |
void |
setInProgressImageResource(Resource inProgressImageResource)
In-progress image resource Bean injector.
|
void |
setIoService(ThumbnailService ioService)
I/O service (ThumbnailService) Bean injector.
|
void |
setIPixels(IPixels iPixels)
Pixels service Bean injector.
|
void |
setIRepositoryInfo(IRepositoryInfo iRepositoryInfo)
Disk Space Usage service Bean injector
|
void |
setPixelDataService(PixelsService pixelDataService)
Pixels data service Bean injector.
|
boolean |
setPixelsId(long id)
This method manages the state of the service; it must be invoked before
using any other methods.
|
void |
setRenderingDefId(long id)
This method manages the state of the service; it should be invoked
directly after
ThumbnailStore.setPixelsId(long) . |
void |
setScaleService(IScale iScale)
Scale service Bean injector.
|
void |
setSettingsService(IRenderingSettings settingsService)
Rendering settings service Bean injector.
|
boolean |
thumbnailExists(Integer sizeX,
Integer sizeY)
Checks if a thumbnail of a particular size exists for a pixels set.
|
getBeanHelper, getExtendedMetadata, getQueryFactory, getSecuritySystem, selfConfigure, setExtendedMetadata, setQueryFactory, setQueryService, setSecuritySystem, setUpdateService
public static final int DEFAULT_X_WIDTH
public static final int DEFAULT_Y_WIDTH
public static final float DEFAULT_COMPRESSION_QUALITY
public static final String DEFAULT_MIME_TYPE
public ThumbnailBean()
public ThumbnailBean(boolean checking)
checking
- public Class<? extends ServiceInterface> getServiceInterface()
getServiceInterface
in interface SelfConfigurableService
@Transactional(readOnly=true) public void passivate()
StatefulServiceInterface
passivate
in interface StatefulServiceInterface
@Transactional(readOnly=true) public void activate()
StatefulServiceInterface
activate
in interface StatefulServiceInterface
public void close()
StatefulServiceInterface
close
in interface StatefulServiceInterface
public long getRenderingDefId()
ThumbnailStore
RenderingDef
loaded in
this instance.getRenderingDefId
in interface ThumbnailStore
public EventContext getCurrentEventContext()
StatefulServiceInterface
EventContext
for this instance. This is
useful for later identifying changes made by this Event
.getCurrentEventContext
in interface StatefulServiceInterface
@Transactional(readOnly=false) public boolean setPixelsId(long id)
ThumbnailStore
ThumbnailStorerelies on the
RenderingEngine, a valid rendering definition must be available for it to work.
setPixelsId
in interface ThumbnailStore
id
- an Pixels
id.true
if a RenderingDef
exists for the
Pixels
set, otherwise false
public boolean isInProgress()
ThumbnailStore
isInProgress
in interface ThumbnailStore
true
if the image is in the process of being
imported or a pyramid is being generated for it.public void setRenderingDefId(long id)
ThumbnailStore
ThumbnailStore.setPixelsId(long)
. If it is not invoked with a
valid rendering definition ID before using the thumbnail accessor
methods execution continues as if renderingDefId were set to
null
.setRenderingDefId
in interface ThumbnailStore
id
- an RenderingDef
id.
null
specifies the user's currently active
rendering settings to be used.public void setInProgressImageResource(Resource inProgressImageResource)
inProgressImageResource
- The in-progress image resource we'll be
using for in progress images.public void setPixelDataService(PixelsService pixelDataService)
pixelDataService
- a PixelsService
.public void setIPixels(IPixels iPixels)
iPixels
- an IPixels
.public void setScaleService(IScale iScale)
iScale
- an IScale
.public void setIoService(ThumbnailService ioService)
ioService
- a ThumbnailService
.public final void setIRepositoryInfo(IRepositoryInfo iRepositoryInfo)
iRepositoryInfo
- an IRepositoryInfo
public void setCompressionService(LocalCompress compressionService)
compressionService
- an ICompress
.public void setSettingsService(IRenderingSettings settingsService)
settingsService
- an IRenderingSettings
.protected void errorIfInvalidState()
protected void errorIfNullPixelsAndRenderingDef()
protected void errorIfNullPixels()
protected void errorIfNullRenderingDef()
@Transactional(readOnly=false) public void createThumbnail(Integer sizeX, Integer sizeY)
ThumbnailStore
createThumbnail
in interface ThumbnailStore
sizeX
- the X-axis width of the thumbnail. null
specifies the default size of 48.sizeY
- the Y-axis width of the thumbnail. null
specifies the default size of 48.ThumbnailStore.getThumbnail(Integer, Integer)
,
ThumbnailStore.getThumbnailDirect(Integer, Integer)
@Transactional(readOnly=false) public void createThumbnails()
ThumbnailStore
createThumbnails
in interface ThumbnailStore
ThumbnailStore.getThumbnail(Integer, Integer)
,
ThumbnailStore.getThumbnailDirect(Integer, Integer)
@Transactional(readOnly=false) public void createThumbnailsByLongestSideSet(Integer size, Set<Long> pixelsIds)
ThumbnailStore
ThumbnailStore.setPixelsId(long)
. This method will not
reset or modify rendering settings in any way. If rendering settings for
a pixels set are not present, thumbnail creation for that pixels set
will not be performed.createThumbnailsByLongestSideSet
in interface ThumbnailStore
size
- the size of the longest side of the thumbnail requested.
null
specifies the default size of 48.pixelsIds
- the Pixels sets to retrieve thumbnails for.ThumbnailStore.createThumbnail(Integer, Integer)
,
ThumbnailStore.createThumbnails()
@Transactional(readOnly=false) public Map<Long,byte[]> getThumbnailSet(Integer sizeX, Integer sizeY, Set<Long> pixelsIds)
ThumbnailStore
ThumbnailStore.getThumbnailDirect(Integer, Integer)
, placed in
the on-disk cache and returned. Unlike the other thumbnail retrieval
methods, this method may be called without first calling
ThumbnailStore.setPixelsId(long)
.getThumbnailSet
in interface ThumbnailStore
sizeX
- the X-axis width of the thumbnail. null
specifies the default size of 48.sizeY
- the Y-axis width of the thumbnail. null
specifies the default size of 48.pixelsIds
- the Pixels sets to retrieve thumbnails for.Map
whose keys are pixels ids and values are JPEG
thumbnail byte buffers or null
if an exception was thrown
while attempting to retrieve the thumbnail for that particular Pixels
set.ThumbnailStore.getThumbnail(Integer, Integer)
@Transactional(readOnly=false) public Map<Long,byte[]> getThumbnailByLongestSideSet(Integer size, Set<Long> pixelsIds)
ThumbnailStore
ThumbnailStore.getThumbnailByLongestSideDirect(java.lang.Integer)
. The longest
side of the image will be used to calculate the size for the smaller
side in order to keep the aspect ratio of the original image. Unlike the
other thumbnail retrieval methods, this method may be called
without first calling ThumbnailStore.setPixelsId(long)
.getThumbnailByLongestSideSet
in interface ThumbnailStore
size
- the size of the longest side of the thumbnail requested.
null
specifies the default size of 48.pixelsIds
- the Pixels sets to retrieve thumbnails for.Map
whose keys are pixels ids and values are JPEG
thumbnail byte buffers or null
if an exception was thrown
while attempting to retrieve the thumbnail for that particular Pixels
set.ThumbnailStore.getThumbnailSet(Integer, Integer, Set)
@Transactional(readOnly=false) public byte[] getThumbnail(Integer sizeX, Integer sizeY)
ThumbnailStore
ThumbnailStore.getThumbnailDirect(Integer, Integer)
, placed in the on-disk
cache and returned.getThumbnail
in interface ThumbnailStore
sizeX
- the X-axis width of the thumbnail. null
specifies the default size of 48.sizeY
- the Y-axis width of the thumbnail. null
specifies the default size of 48.ThumbnailStore.getThumbnailDirect(Integer, Integer)
@Transactional(readOnly=false) public byte[] getThumbnailByLongestSide(Integer size)
ThumbnailStore
ThumbnailStore.getThumbnailDirect(Integer, Integer)
, placed in the on-disk
cache and returned. The longest side of the image will be used to
calculate the size for the smaller side in order to keep the aspect
ratio of the original image.getThumbnailByLongestSide
in interface ThumbnailStore
size
- the size of the longest side of the thumbnail requested.
null
specifies the default size of 48.ThumbnailStore.getThumbnail(Integer, Integer)
public byte[] getThumbnailDirect(Integer sizeX, Integer sizeY)
ThumbnailStore
getThumbnailDirect
in interface ThumbnailStore
sizeX
- the X-axis width of the thumbnail. null
specifies the default size of 48.sizeY
- the Y-axis width of the thumbnail. null
specifies the default size of 48.ThumbnailStore.getThumbnail(Integer, Integer)
public byte[] getThumbnailForSectionDirect(int theZ, int theT, Integer sizeX, Integer sizeY)
ThumbnailStore
getThumbnailForSectionDirect
in interface ThumbnailStore
theZ
- the optical section (offset across the Z-axis) to use.theT
- the timepoint (offset across the T-axis) to use.sizeX
- the X-axis width of the thumbnail. null
specifies the default size of 48.sizeY
- the Y-axis width of the thumbnail. null
specifies the default size of 48.ThumbnailStore.getThumbnail(Integer, Integer)
public byte[] getThumbnailByLongestSideDirect(Integer size)
ThumbnailStore
getThumbnailByLongestSideDirect
in interface ThumbnailStore
size
- the size of the longest side of the thumbnail requested.
null
specifies the default size of 48.ThumbnailStore.getThumbnailDirect(Integer, Integer)
public byte[] getThumbnailForSectionByLongestSideDirect(int theZ, int theT, Integer size)
ThumbnailStore
getThumbnailForSectionByLongestSideDirect
in interface ThumbnailStore
theZ
- the optical section (offset across the Z-axis) to use.theT
- the timepoint (offset across the T-axis) to use.size
- the size of the longest side of the thumbnail requested.
null
specifies the default size of 48.ThumbnailStore.getThumbnailDirect(Integer, Integer)
public boolean thumbnailExists(Integer sizeX, Integer sizeY)
ThumbnailStore
thumbnailExists
in interface ThumbnailStore
sizeX
- the X-axis width of the thumbnail. null
specifies use the default size of 48.sizeY
- the Y-axis width of the thumbnail. null
specifies user the default size of 48.ThumbnailStore.getThumbnail(Integer, Integer)
,
ThumbnailStore.getThumbnailDirect(Integer, Integer)
@Transactional(readOnly=false) public void resetDefaults()
ThumbnailStore
resetDefaults
in interface ThumbnailStore
public boolean isDiskSpaceChecking()
public void setDiskSpaceChecking(boolean diskSpaceChecking)
Version: 5.2.0-ice35-b12
Copyright © 2015 The University of Dundee & Open Microscopy Environment. All Rights Reserved.