Interface RenderingEngine
-
- All Superinterfaces:
ServiceInterface
,StatefulServiceInterface
public interface RenderingEngine extends StatefulServiceInterface
Defines a service to render a given pixels set.A pixels set is a 5D array that stores the pixels data of an image, that is the pixels intensity values. Every instance of this service is paired up to a pixels set. Use this service to transform planes within the pixels set onto an RGB image.
The
RenderingEngine
allows to fine-tune the settings that define the transformation context that is, a specification of how raw pixels data is to be transformed into an image that can be displayed on screen. Those settings are referred to as rendering settings or display options. After tuning those settings it is possible to save them to the metadata repository so that they can be used the next time the pixels set is accessed for rendering; for example by anotherRenderingEngine
instance. Note that the display options are specific to the given pixels set and are experimenter scoped that is, two different users can specify different display options for the same pixels set. (ARenderingEngine
instance takes this into account automatically as it is always bound to a given experimenter.)This service is thread-safe.
- Since:
- OME2.2
-
-
Method Summary
All Methods Instance Methods Abstract Methods Deprecated Methods Modifier and Type Method Description void
addCodomainMap(CodomainMapContext mapCtx)
Deprecated.void
addCodomainMapToChannel(CodomainMapContext mapCtx, int w)
Adds the context to the mapping chain.java.util.List
getAvailableFamilies()
Returns the list of mapping families supported by the Rendering engine.java.util.List
getAvailableModels()
Returns the list of color models supported by the Rendering engine.double
getChannelCurveCoefficient(int w)
Returns the coefficient identifying a map in the family.ome.model.enums.Family
getChannelFamily(int w)
Returns the family associated to the specified channel.java.lang.String
getChannelLookupTable(int w)
boolean
getChannelNoiseReduction(int w)
Returnstrue
if the noise reduction algorithm used to map the pixels intensity values is turned on,false
if the algorithm is turned off.double[]
getChannelStats(int w)
double
getChannelWindowEnd(int w)
Returns the upper bound of the pixels intensity interval.double
getChannelWindowStart(int w)
Returns the lower bound of the pixels intensity interval.java.util.List<CodomainMapContext>
getCodomainMapContext(int w)
Returns the list of codomain contexts associated to the specified channel.float
getCompressionLevel()
Returns the current compression level for the service.int
getDefaultT()
Returns the default timepoint index.int
getDefaultZ()
Returns the index of the default focal section.ome.model.enums.RenderingModel
getModel()
Returns the model that dictates how transformed raw data has to be mapped onto a color space.ome.model.core.Pixels
getPixels()
Returns thePixels
set the Rendering engine is for.double
getPixelsTypeLowerBound(int w)
Returns the minimum value for that channels depending on the pixels type and the original range (globalmax, globalmin)double
getPixelsTypeUpperBound(int w)
Returns the maximum value for that channels depending on the pixels type and the original range (globalmax, globalmin)ome.model.display.QuantumDef
getQuantumDef()
Returns the quantization object.long
getRenderingDefId()
Returns the id of theRenderingDef
loaded by eitherlookupRenderingDef(long)
orloadRenderingDef(long)
.java.lang.Object
getResolutionDescriptions()
int
getResolutionLevel()
int
getResolutionLevels()
int[]
getRGBA(int w)
Returns a 4D-array representing the color associated to the specified channel.int[]
getTileSize()
boolean
isActive(int w)
Returnstrue
if the channel is mapped,false
otherwise.boolean
isPixelsTypeSigned()
Returnstrue
if the pixels type is signed,false
otherwise.void
load()
Creates a instance of the rendering engine.void
loadRenderingDef(long renderingDefId)
Loads a specific set of rendering settings that does not necessarily have to be linked to the given Pixels set.void
lookupPixels(long pixelsId)
Loads thePixels
set this Rendering Engine is for.boolean
lookupRenderingDef(long pixelsId)
Loads the rendering settings associated to the specified pixels set.void
removeCodomainMap(CodomainMapContext mapCtx)
Deprecated.void
removeCodomainMapFromChannel(CodomainMapContext mapCtx, int w)
Removes the specified context from the chain.RGBBuffer
render(PlaneDef pd)
Renders the data selected bypd
according to the current rendering settings.int[]
renderAsPackedInt(PlaneDef pd)
Renders the data selected bypd
according to the current rendering settings.byte[]
renderCompressed(PlaneDef pd)
Renders the data selected bypd
according to the current rendering settings and compresses the resulting RGBA composite image.int[]
renderProjectedAsPackedInt(int algorithm, int timepoint, int stepping, int start, int end)
Performs a projection through selected optical sections of a particular timepoint with the currently active channels and renders the data for display.byte[]
renderProjectedCompressed(int algorithm, int timepoint, int stepping, int start, int end)
Performs a projection through selected optical sections of a particular timepoint with the currently active channels, renders the data for display and compresses the resulting RGBA composite image.boolean
requiresPixelsPyramid()
long
resetDefaultSettings(boolean save)
Resets the default settings i.e.long
saveAsNewSettings()
Saves the current rendering settings in the database as a newRenderingDef
and loads the object into the currentRenderingEngine
.void
saveCurrentSettings()
Saves the current rendering settings in the database.void
setActive(int w, boolean active)
Maps the specified channel iftrue
, unmaps the channel otherwise.void
setChannelLookupTable(int w, java.lang.String lookup)
void
setChannelWindow(int w, double start, double end)
Returns the pixels intensity interval.void
setCodomainInterval(int start, int end)
Sets the sub-interval of the device space i.e.void
setCompressionLevel(float percentage)
Sets the current compression level for the service.void
setDefaultT(int t)
Sets the default timepoint index.void
setDefaultZ(int z)
Sets the index of the default focal section.void
setModel(ome.model.enums.RenderingModel model)
Specifies the model that dictates how transformed raw data has to be mapped onto a color space.void
setOverlays(java.util.Map<byte[],java.lang.Integer> overlays)
Informs the rendering engine that it should render a set of overlays on each rendered frame.void
setQuantizationMap(int w, ome.model.enums.Family family, double coefficient, boolean noiseReduction)
Sets the quantization map, one per channel.void
setQuantumStrategy(int bitResolution)
Sets the quantization strategy.void
setResolutionLevel(int resolutionLevel)
void
setRGBA(int w, int red, int green, int blue, int alpha)
Sets the four components composing the color associated to the specified channel.void
updateCodomainMap(CodomainMapContext mapCtx)
Deprecated.void
updateSettings(ome.model.display.RenderingDef settings)
Updates the current rendering settings based on a provided rendering definition and associated sub-objects.-
Methods inherited from interface ome.api.StatefulServiceInterface
activate, close, getCurrentEventContext, passivate
-
-
-
-
Method Detail
-
render
RGBBuffer render(PlaneDef pd)
Renders the data selected bypd
according to the current rendering settings. The passed argument selects a plane orthogonal to one of the X, Y, or Z axes. How many wavelengths are rendered and what color model is used depends on the current rendering settings.- Parameters:
pd
- Selects a plane orthogonal to one of the X, Y, or Z axes.- Returns:
- An RGB image ready to be displayed on screen.
- Throws:
ome.conditions.ValidationException
- Ifpd
isnull
.
-
renderAsPackedInt
int[] renderAsPackedInt(PlaneDef pd)
Renders the data selected bypd
according to the current rendering settings. The passed argument selects a plane orthogonal to one of the X, Y, or Z axes. How many wavelengths are rendered and what color model is used depends on the current rendering settings.- Parameters:
pd
- Selects a plane orthogonal to one of the X, Y, or Z axes.- Returns:
- An RGB image ready to be displayed on screen.
- Throws:
ome.conditions.ValidationException
- Ifpd
isnull
.- See Also:
render(PlaneDef)
-
renderCompressed
byte[] renderCompressed(PlaneDef pd)
Renders the data selected bypd
according to the current rendering settings and compresses the resulting RGBA composite image.- Parameters:
pd
- Selects a plane orthogonal to one of the X, Y, or Z axes.- Returns:
- A compressed RGBA JPEG for display.
- Throws:
ome.conditions.ValidationException
- Ifpd
isnull
.- See Also:
render(PlaneDef)
,renderAsPackedInt(PlaneDef)
-
renderProjectedAsPackedInt
int[] renderProjectedAsPackedInt(int algorithm, int timepoint, int stepping, int start, int end)
Performs a projection through selected optical sections of a particular timepoint with the currently active channels and renders the data for display.- Parameters:
algorithm
-IProjection.MAXIMUM_INTENSITY
,IProjection.MEAN_INTENSITY
orIProjection.SUM_INTENSITY
.stepping
- Stepping value to use while calculating the projection. For example,stepping=1
will use every optical section fromstart
toend
wherestepping=2
will use every other section fromstart
toend
to perform the projection.start
- Optical section to start projecting from.end
- Optical section to finish projecting.- Returns:
- A packed-integer RGBA rendered image of the projected pixels.
- Throws:
ome.conditions.ValidationException
- Where:algorithm
is unknowntimepoint
is out of rangestart
is out of rangeend
is out of rangestart
is greater thanend
- See Also:
IProjection.projectPixels(long, PixelsType, int, int, int, List, int, int, int, String)
-
renderProjectedCompressed
byte[] renderProjectedCompressed(int algorithm, int timepoint, int stepping, int start, int end)
Performs a projection through selected optical sections of a particular timepoint with the currently active channels, renders the data for display and compresses the resulting RGBA composite image.- Parameters:
algorithm
-IProjection.MAXIMUM_INTENSITY
,IProjection.MEAN_INTENSITY
orIProjection.SUM_INTENSITY
.stepping
- Stepping value to use while calculating the projection. For example,stepping=1
will use every optical section fromstart
toend
wherestepping=2
will use every other section fromstart
toend
to perform the projection.start
- Optical section to start projecting from.end
- Optical section to finish projecting.- Returns:
- A compressed RGBA rendered JPEG image of the projected pixels.
- Throws:
ome.conditions.ValidationException
- Where:algorithm
is unknowntimepoint
is out of rangestart
is out of rangeend
is out of rangestart
is greater thanend
- See Also:
IProjection.projectPixels(long, PixelsType, int, int, int, List, int, int, int, String)
-
lookupPixels
void lookupPixels(long pixelsId)
Loads thePixels
set this Rendering Engine is for.- Parameters:
pixelsId
- The pixels set ID.
-
getRenderingDefId
long getRenderingDefId()
Returns the id of theRenderingDef
loaded by eitherlookupRenderingDef(long)
orloadRenderingDef(long)
.
-
lookupRenderingDef
boolean lookupRenderingDef(long pixelsId)
Loads the rendering settings associated to the specified pixels set.- Parameters:
pixelsId
- The pixels set ID.- Returns:
true
if aRenderingDef
exists for thePixels
set, otherwisefalse
.
-
loadRenderingDef
void loadRenderingDef(long renderingDefId)
Loads a specific set of rendering settings that does not necessarily have to be linked to the given Pixels set. However, the rendering settings must be linked to a compatible Pixels set as defined byIRenderingSettings.sanityCheckPixels(Pixels, Pixels)
.- Parameters:
renderingDefId
- The rendering definition ID.- Throws:
ome.conditions.ValidationException
- If aRenderingDef
does not exist with the IDrenderingDefId
or if theRenderingDef
is incompatible due to differing pixels sets.
-
setOverlays
void setOverlays(java.util.Map<byte[],java.lang.Integer> overlays)
Informs the rendering engine that it should render a set of overlays on each rendered frame. These are expected to be binary masks.- Parameters:
overlays
- Binary mask to color map.
-
load
void load()
Creates a instance of the rendering engine.
-
setModel
void setModel(ome.model.enums.RenderingModel model)
Specifies the model that dictates how transformed raw data has to be mapped onto a color space.- Parameters:
model
- Identifies the color space model.
-
getModel
ome.model.enums.RenderingModel getModel()
Returns the model that dictates how transformed raw data has to be mapped onto a color space.- Returns:
- See above.
-
getDefaultZ
int getDefaultZ()
Returns the index of the default focal section.- Returns:
- See above.
-
getDefaultT
int getDefaultT()
Returns the default timepoint index.- Returns:
- See above.
-
setDefaultZ
void setDefaultZ(int z)
Sets the index of the default focal section. This index is used to define a default plane.- Parameters:
z
- The value to set.
-
setDefaultT
void setDefaultT(int t)
Sets the default timepoint index. This index is used to define a default plane.- Parameters:
t
- The value to set.
-
getPixels
ome.model.core.Pixels getPixels()
Returns thePixels
set the Rendering engine is for.- Returns:
- See above.
-
getAvailableModels
java.util.List getAvailableModels()
Returns the list of color models supported by the Rendering engine.- Returns:
- See above.
-
getAvailableFamilies
java.util.List getAvailableFamilies()
Returns the list of mapping families supported by the Rendering engine.- Returns:
- See above.
-
setQuantumStrategy
void setQuantumStrategy(int bitResolution)
Sets the quantization strategy. The strategy is common to all channels.- Parameters:
bitResolution
- The bit resolution defining associated to the strategy.
-
setCodomainInterval
void setCodomainInterval(int start, int end)
Sets the sub-interval of the device space i.e. a discrete sub-interval of [0, 255]- Parameters:
start
- The lower bound of the interval.end
- The upper bound of the interval.
-
getQuantumDef
ome.model.display.QuantumDef getQuantumDef()
Returns the quantization object.- Returns:
- See above.
-
setQuantizationMap
void setQuantizationMap(int w, ome.model.enums.Family family, double coefficient, boolean noiseReduction)
Sets the quantization map, one per channel.- Parameters:
w
- The channel index.family
- The mapping family.coefficient
- The coefficient identifying a curve in the family.noiseReduction
- Passtrue
to turn the noise reduction algorithm on,false
otherwise.- See Also:
getAvailableFamilies()
,getChannelCurveCoefficient(int)
,getChannelFamily(int)
,getChannelNoiseReduction(int)
-
getChannelFamily
ome.model.enums.Family getChannelFamily(int w)
Returns the family associated to the specified channel.- Parameters:
w
- The channel index.- Returns:
- See above.
- See Also:
getAvailableFamilies()
-
getChannelNoiseReduction
boolean getChannelNoiseReduction(int w)
Returnstrue
if the noise reduction algorithm used to map the pixels intensity values is turned on,false
if the algorithm is turned off. Each channel has an algorithm associated to it.- Parameters:
w
- The channel index.- Returns:
- See above.
-
getChannelStats
double[] getChannelStats(int w)
-
getChannelCurveCoefficient
double getChannelCurveCoefficient(int w)
Returns the coefficient identifying a map in the family. Each channel has a map associated to it.- Parameters:
w
- The channel index.- Returns:
- See above.
- See Also:
getChannelFamily(int)
-
setChannelWindow
void setChannelWindow(int w, double start, double end)
Returns the pixels intensity interval. Each channel has a pixels intensity interval associated to it.- Parameters:
w
- The channel index.start
- The lower bound of the interval.end
- The upper bound of the interval.
-
getChannelWindowStart
double getChannelWindowStart(int w)
Returns the lower bound of the pixels intensity interval. Each channel has a pixels intensity interval associated to it.- Parameters:
w
- The channel index.- Returns:
- See above.
-
getChannelWindowEnd
double getChannelWindowEnd(int w)
Returns the upper bound of the pixels intensity interval. Each channel has a pixels intensity interval associated to it.- Parameters:
w
- The channel index.- Returns:
- See above.
-
setRGBA
void setRGBA(int w, int red, int green, int blue, int alpha)
Sets the four components composing the color associated to the specified channel.- Parameters:
w
- The channel index.red
- The red component. A value between 0 and 255.green
- The green component. A value between 0 and 255.blue
- The blue component. A value between 0 and 255.alpha
- The alpha component. A value between 0 and 255.
-
getRGBA
int[] getRGBA(int w)
Returns a 4D-array representing the color associated to the specified channel. The first element corresponds to the red component (value between 0 and 255). The second corresponds to the green component (value between 0 and 255). The third corresponds to the blue component (value between 0 and 255). The fourth corresponds to the alpha component (value between 0 and 255).- Parameters:
w
- The channel index.- Returns:
- See above
-
setActive
void setActive(int w, boolean active)
Maps the specified channel iftrue
, unmaps the channel otherwise.- Parameters:
w
- The channel index.active
- Passtrue
to map the channel,false
otherwise.
-
isActive
boolean isActive(int w)
Returnstrue
if the channel is mapped,false
otherwise.- Parameters:
w
- The channel index.- Returns:
- See above.
-
addCodomainMap
@Deprecated void addCodomainMap(CodomainMapContext mapCtx)
Deprecated.Adds the context to the mapping chain. Only one context of the same type can be added to the chain. The codomain transformations are functions from the device space to device space. Each time a new context is added, the second LUT is rebuilt.- Parameters:
mapCtx
- The context to add.- See Also:
updateCodomainMap(CodomainMapContext)
,removeCodomainMap(CodomainMapContext)
-
addCodomainMapToChannel
void addCodomainMapToChannel(CodomainMapContext mapCtx, int w)
Adds the context to the mapping chain. Only one context of the same type can be added to the chain. The codomain transformations are functions from the device space to device space. Each time a new context is added, the second LUT is rebuilt.- Parameters:
mapCtx
- The context to add.w
- The channel to add the context to.- See Also:
removeCodomainMapFromChannel(CodomainMapContext, int)
-
updateCodomainMap
@Deprecated void updateCodomainMap(CodomainMapContext mapCtx)
Deprecated.Updates the specified context. The codomain chain already contains the specified context. Each time a new context is updated, the second LUT is rebuilt.- Parameters:
mapCtx
- The context to update.- See Also:
addCodomainMap(CodomainMapContext)
,removeCodomainMap(CodomainMapContext)
-
removeCodomainMap
@Deprecated void removeCodomainMap(CodomainMapContext mapCtx)
Deprecated.Removes the specified context from the chain. Each time a new context is removed, the second LUT is rebuilt.- Parameters:
mapCtx
- The context to remove.- See Also:
addCodomainMap(CodomainMapContext)
,updateCodomainMap(CodomainMapContext)
-
removeCodomainMapFromChannel
void removeCodomainMapFromChannel(CodomainMapContext mapCtx, int w)
Removes the specified context from the chain. Each time a new context is removed, the second LUT is rebuilt.- Parameters:
mapCtx
- The context to remove.- See Also:
addCodomainMapToChannel(CodomainMapContext, int)
-
updateSettings
void updateSettings(ome.model.display.RenderingDef settings)
Updates the current rendering settings based on a provided rendering definition and associated sub-objects.- Parameters:
settings
- Rendering definition to copy from. Each sub-object will be processed as though the specific method was called with related attributes provided as arguments. The following methods are called underneath:setModel(RenderingModel)
setDefaultZ(int)
setDefaultT(int)
setQuantumStrategy(int)
setCodomainInterval(int, int)
setActive(int, boolean)
setChannelWindow(int, double, double)
setQuantizationMap(int, Family, double, boolean)
setRGBA(int, int, int, int, int)
setChannelLookupTable(int, String)
null
it will be skipped in its entirety. The underlying Renderer is not able to handle partial field updates. Furthermore,ChannelBinding
references that arenull
and indexes in theRenderingDef.WAVERENDERING
array greater than the currently looked upPixels.SIZEC
will be skipped.
-
saveCurrentSettings
void saveCurrentSettings()
Saves the current rendering settings in the database.
-
saveAsNewSettings
long saveAsNewSettings()
Saves the current rendering settings in the database as a newRenderingDef
and loads the object into the currentRenderingEngine
.
-
resetDefaultSettings
long resetDefaultSettings(boolean save)
Resets the default settings i.e. the default values internal to the Rendering engine. The settings will be saved.- Parameters:
save
- Passtrue
to save the settings,false
otherwise.
-
setCompressionLevel
void setCompressionLevel(float percentage)
Sets the current compression level for the service. (The default is 85%)- Parameters:
percentage
- A percentage compression level from 1.00 (100%) to 0.01 (1%).- Throws:
ome.conditions.ValidationException
- if thepercentage
is out of range.
-
getCompressionLevel
float getCompressionLevel()
Returns the current compression level for the service.- Returns:
- See above.
-
isPixelsTypeSigned
boolean isPixelsTypeSigned()
Returnstrue
if the pixels type is signed,false
otherwise.- Returns:
- See above.
-
getPixelsTypeLowerBound
double getPixelsTypeLowerBound(int w)
Returns the minimum value for that channels depending on the pixels type and the original range (globalmax, globalmin)- Parameters:
w
- The channel index.- Returns:
- See above.
-
getPixelsTypeUpperBound
double getPixelsTypeUpperBound(int w)
Returns the maximum value for that channels depending on the pixels type and the original range (globalmax, globalmin)- Parameters:
w
- The channel index.- Returns:
- See above.
-
requiresPixelsPyramid
boolean requiresPixelsPyramid()
-
getResolutionDescriptions
java.lang.Object getResolutionDescriptions()
-
getResolutionLevels
int getResolutionLevels()
-
getResolutionLevel
int getResolutionLevel()
-
setResolutionLevel
void setResolutionLevel(int resolutionLevel)
-
getTileSize
int[] getTileSize()
-
setChannelLookupTable
void setChannelLookupTable(int w, java.lang.String lookup)
-
getChannelLookupTable
java.lang.String getChannelLookupTable(int w)
-
getCodomainMapContext
java.util.List<CodomainMapContext> getCodomainMapContext(int w)
Returns the list of codomain contexts associated to the specified channel.- Parameters:
w
- The channel the contexts are associated to.- Returns:
- see above.
-
-