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 another RenderingEngine 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. (A RenderingEngine instance takes this into account automatically as it is always bound to a given experimenter.)

    This service is thread-safe.

    Since:
    OME2.2
    • Method Detail

      • render

        RGBBuffer render​(PlaneDef pd)
        Renders the data selected by pd 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 - If pd is null.
      • renderAsPackedInt

        int[] renderAsPackedInt​(PlaneDef pd)
        Renders the data selected by pd 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 - If pd is null.
        See Also:
        render(PlaneDef)
      • renderCompressed

        byte[] renderCompressed​(PlaneDef pd)
        Renders the data selected by pd 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 - If pd is null.
        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 or IProjection.SUM_INTENSITY.
        stepping - Stepping value to use while calculating the projection. For example, stepping=1 will use every optical section from start to end where stepping=2 will use every other section from start to end 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 unknown
        • timepoint is out of range
        • start is out of range
        • end is out of range
        • start is greater than end
        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 or IProjection.SUM_INTENSITY.
        stepping - Stepping value to use while calculating the projection. For example, stepping=1 will use every optical section from start to end where stepping=2 will use every other section from start to end 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 unknown
        • timepoint is out of range
        • start is out of range
        • end is out of range
        • start is greater than end
        See Also:
        IProjection.projectPixels(long, PixelsType, int, int, int, List, int, int, int, String)
      • lookupPixels

        void lookupPixels​(long pixelsId)
        Loads the Pixels set this Rendering Engine is for.
        Parameters:
        pixelsId - The pixels set ID.
      • lookupRenderingDef

        boolean lookupRenderingDef​(long pixelsId)
        Loads the rendering settings associated to the specified pixels set.
        Parameters:
        pixelsId - The pixels set ID.
        Returns:
        true if a RenderingDef exists for the Pixels set, otherwise false.
      • 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 by IRenderingSettings.sanityCheckPixels(Pixels, Pixels).
        Parameters:
        renderingDefId - The rendering definition ID.
        Throws:
        ome.conditions.ValidationException - If a RenderingDef does not exist with the ID renderingDefId or if the RenderingDef 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 the Pixels 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.
      • 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)
        Returns true 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 if true, unmaps the channel otherwise.
        Parameters:
        w - The channel index.
        active - Pass true to map the channel, false otherwise.
      • isActive

        boolean isActive​(int w)
        Returns true 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)
      • saveCurrentSettings

        void saveCurrentSettings()
        Saves the current rendering settings in the database.
      • saveAsNewSettings

        long saveAsNewSettings()
        Saves the current rendering settings in the database as a new RenderingDef and loads the object into the current RenderingEngine.
      • 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 - Pass true 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 the percentage is out of range.
      • getCompressionLevel

        float getCompressionLevel()
        Returns the current compression level for the service.
        Returns:
        See above.
      • isPixelsTypeSigned

        boolean isPixelsTypeSigned()
        Returns true 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.