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
RenderingEngineallows 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 anotherRenderingEngineinstance. 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. (ARenderingEngineinstance 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 voidaddCodomainMap(CodomainMapContext mapCtx)Deprecated.voidaddCodomainMapToChannel(CodomainMapContext mapCtx, int w)Adds the context to the mapping chain.java.util.ListgetAvailableFamilies()Returns the list of mapping families supported by the Rendering engine.java.util.ListgetAvailableModels()Returns the list of color models supported by the Rendering engine.doublegetChannelCurveCoefficient(int w)Returns the coefficient identifying a map in the family.ome.model.enums.FamilygetChannelFamily(int w)Returns the family associated to the specified channel.java.lang.StringgetChannelLookupTable(int w)booleangetChannelNoiseReduction(int w)Returnstrueif the noise reduction algorithm used to map the pixels intensity values is turned on,falseif the algorithm is turned off.double[]getChannelStats(int w)doublegetChannelWindowEnd(int w)Returns the upper bound of the pixels intensity interval.doublegetChannelWindowStart(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.floatgetCompressionLevel()Returns the current compression level for the service.intgetDefaultT()Returns the default timepoint index.intgetDefaultZ()Returns the index of the default focal section.ome.model.enums.RenderingModelgetModel()Returns the model that dictates how transformed raw data has to be mapped onto a color space.ome.model.core.PixelsgetPixels()Returns thePixelsset the Rendering engine is for.doublegetPixelsTypeLowerBound(int w)Returns the minimum value for that channels depending on the pixels type and the original range (globalmax, globalmin)doublegetPixelsTypeUpperBound(int w)Returns the maximum value for that channels depending on the pixels type and the original range (globalmax, globalmin)ome.model.display.QuantumDefgetQuantumDef()Returns the quantization object.longgetRenderingDefId()Returns the id of theRenderingDefloaded by eitherlookupRenderingDef(long)orloadRenderingDef(long).java.lang.ObjectgetResolutionDescriptions()intgetResolutionLevel()intgetResolutionLevels()int[]getRGBA(int w)Returns a 4D-array representing the color associated to the specified channel.int[]getTileSize()booleanisActive(int w)Returnstrueif the channel is mapped,falseotherwise.booleanisPixelsTypeSigned()Returnstrueif the pixels type is signed,falseotherwise.voidload()Creates a instance of the rendering engine.voidloadRenderingDef(long renderingDefId)Loads a specific set of rendering settings that does not necessarily have to be linked to the given Pixels set.voidlookupPixels(long pixelsId)Loads thePixelsset this Rendering Engine is for.booleanlookupRenderingDef(long pixelsId)Loads the rendering settings associated to the specified pixels set.voidremoveCodomainMap(CodomainMapContext mapCtx)Deprecated.voidremoveCodomainMapFromChannel(CodomainMapContext mapCtx, int w)Removes the specified context from the chain.RGBBufferrender(PlaneDef pd)Renders the data selected bypdaccording to the current rendering settings.int[]renderAsPackedInt(PlaneDef pd)Renders the data selected bypdaccording to the current rendering settings.byte[]renderCompressed(PlaneDef pd)Renders the data selected bypdaccording 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.booleanrequiresPixelsPyramid()longresetDefaultSettings(boolean save)Resets the default settings i.e.longsaveAsNewSettings()Saves the current rendering settings in the database as a newRenderingDefand loads the object into the currentRenderingEngine.voidsaveCurrentSettings()Saves the current rendering settings in the database.voidsetActive(int w, boolean active)Maps the specified channel iftrue, unmaps the channel otherwise.voidsetChannelLookupTable(int w, java.lang.String lookup)voidsetChannelWindow(int w, double start, double end)Returns the pixels intensity interval.voidsetCodomainInterval(int start, int end)Sets the sub-interval of the device space i.e.voidsetCompressionLevel(float percentage)Sets the current compression level for the service.voidsetDefaultT(int t)Sets the default timepoint index.voidsetDefaultZ(int z)Sets the index of the default focal section.voidsetModel(ome.model.enums.RenderingModel model)Specifies the model that dictates how transformed raw data has to be mapped onto a color space.voidsetOverlays(java.util.Map<byte[],java.lang.Integer> overlays)Informs the rendering engine that it should render a set of overlays on each rendered frame.voidsetQuantizationMap(int w, ome.model.enums.Family family, double coefficient, boolean noiseReduction)Sets the quantization map, one per channel.voidsetQuantumStrategy(int bitResolution)Sets the quantization strategy.voidsetResolutionLevel(int resolutionLevel)voidsetRGBA(int w, int red, int green, int blue, int alpha)Sets the four components composing the color associated to the specified channel.voidupdateCodomainMap(CodomainMapContext mapCtx)Deprecated.voidupdateSettings(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 bypdaccording 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- Ifpdisnull.
-
renderAsPackedInt
int[] renderAsPackedInt(PlaneDef pd)
Renders the data selected bypdaccording 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- Ifpdisnull.- See Also:
render(PlaneDef)
-
renderCompressed
byte[] renderCompressed(PlaneDef pd)
Renders the data selected bypdaccording 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- Ifpdisnull.- 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_INTENSITYorIProjection.SUM_INTENSITY.stepping- Stepping value to use while calculating the projection. For example,stepping=1will use every optical section fromstarttoendwherestepping=2will use every other section fromstarttoendto 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:algorithmis unknowntimepointis out of rangestartis out of rangeendis out of rangestartis 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_INTENSITYorIProjection.SUM_INTENSITY.stepping- Stepping value to use while calculating the projection. For example,stepping=1will use every optical section fromstarttoendwherestepping=2will use every other section fromstarttoendto 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:algorithmis unknowntimepointis out of rangestartis out of rangeendis out of rangestartis greater thanend
- See Also:
IProjection.projectPixels(long, PixelsType, int, int, int, List, int, int, int, String)
-
lookupPixels
void lookupPixels(long pixelsId)
Loads thePixelsset this Rendering Engine is for.- Parameters:
pixelsId- The pixels set ID.
-
getRenderingDefId
long getRenderingDefId()
Returns the id of theRenderingDefloaded 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:
trueif aRenderingDefexists for thePixelsset, 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 aRenderingDefdoes not exist with the IDrenderingDefIdor if theRenderingDefis 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 thePixelsset 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- Passtrueto turn the noise reduction algorithm on,falseotherwise.- 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)
Returnstrueif the noise reduction algorithm used to map the pixels intensity values is turned on,falseif 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- Passtrueto map the channel,falseotherwise.
-
isActive
boolean isActive(int w)
Returnstrueif the channel is mapped,falseotherwise.- 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)
nullit will be skipped in its entirety. The underlying Renderer is not able to handle partial field updates. Furthermore,ChannelBindingreferences that arenulland indexes in theRenderingDef.WAVERENDERINGarray greater than the currently looked upPixels.SIZECwill 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 newRenderingDefand 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- Passtrueto save the settings,falseotherwise.
-
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 thepercentageis out of range.
-
getCompressionLevel
float getCompressionLevel()
Returns the current compression level for the service.- Returns:
- See above.
-
isPixelsTypeSigned
boolean isPixelsTypeSigned()
Returnstrueif the pixels type is signed,falseotherwise.- 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.
-
-