omeis.providers.re
Class Renderer

java.lang.Object
  extended by omeis.providers.re.Renderer

public class Renderer
extends Object

Transforms raw image data into an RGB image that can be displayed on screen.

Every instance of this class works against a given pixels set within an OME Image (recall that an Image can have more than one pixels set) and holds the rendering environment for that pixels set. Said environment is composed of:

This class delegates the actual rendering to a RenderingStrategy, which is selected depending on how transformed data is to be mapped into a color space.

Since:
OME2.2
Version:
2.2 (Internal version: $Revision: 5745 $ $Date: 2005/07/05 16:13:52 $)
Author:
Jean-Marie Burel      j.burel@dundee.ac.uk,
Andrea Falconi      a.falconi@dundee.ac.uk
See Also:
RenderingDef, QuantumManager, CodomainChain, RenderingStrategy

Field Summary
static int MAX_CHANNELS
          The maximum number of channels.
static String MODEL_GREYSCALE
          Identifies the type used to store model values.
static String MODEL_HSB
          Identifies the type used to store model values.
static String MODEL_RGB
          Identifies the type used to store model values.
static String PHOTOMETRIC_MONOCHROME
          Identifies the type used to store photometric interpretation values.
 
Constructor Summary
Renderer(QuantumFactory quantumFactory, List<ome.model.enums.RenderingModel> renderingModels, ome.model.core.Pixels pixelsObj, ome.model.display.RenderingDef renderingDefObj, PixelBuffer bufferObj)
          Creates a new instance to render the specified pixels set and get this new instance ready for rendering.
 
Method Summary
 void close()
          Closes the buffer, cleaning up file state.
 ome.model.display.ChannelBinding[] getChannelBindings()
          Returns an array containing the channel bindings.
 List<ome.model.display.ChannelBinding> getChannelBindingsAsList()
          Returns a list containing the channel bindings.
 CodomainChain getCodomainChain()
          Returns the object that defines the sequence of spatial transformations to be applied to quantized data.
static int[] getColorArray(ome.model.display.ChannelBinding channel)
          Returns an array whose ascending indices represent the color components Red, Green and Blue.
 int getImageSize(PlaneDef pd)
          Returns the size, in bytes, of the RGBBuffer that would be rendered from the plane selected by pd.
 ome.model.core.Pixels getMetadata()
          Returns the Pixels set the rendering engine is for.
 Optimizations getOptimizations()
          Returns the optimizations that the renderer currently has enabled.
 Map<byte[],Integer> getOverlays()
          Returns the current set of overlays to be rendered.
 PixelBuffer getPixels()
          Returns the object that allows to access the pixels raw data.
 ome.model.enums.PixelsType getPixelsType()
          Returns the pixels type.
 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)
 String getPlaneDimsAsString(PlaneDef pd)
          Returns a string with the dimensions of the specified plane.
 omeis.providers.re.QuantumManager getQuantumManager()
          Returns the object that manages and allows to retrieve the objects that are used to quantize wavelength data.
 ome.model.display.RenderingDef getRenderingDef()
          Returns the settings that define the transformation context.
 RenderingStats getStats()
          Returns a RenderingStats object that the rendering strategy can use to track performance.
 boolean isPixelsTypeSigned()
          Returns true if the pixels type is signed, false otherwise.
 RGBBuffer render(PlaneDef pd)
          Renders the data selected by pd according to the current rendering settings.
 int[] renderAsPackedInt(PlaneDef pd, PixelBuffer newBuffer)
          Renders the data selected by pd according to the current rendering settings.
 int[] renderAsPackedIntAsRGBA(PlaneDef pd, PixelBuffer newBuffer)
          Renders the data selected by pd according to the current rendering settings.
 void setActive(int w, boolean active)
          Makes a particular channel active or inactive.
 void setChannelWindow(int w, double start, double end)
          Sets the pixels intensity interval for the specified channel.
 void setCodomainInterval(int start, int end)
          Sets the codomain interval i.e. a sub-interval of [0, 255].
 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(Map<byte[],Integer> overlays)
          Sets a map of overlays to be rendered.
 void setQuantizationMap(int w, ome.model.enums.Family family, double coefficient, boolean noiseReduction)
          Sets the mapping strategy for the specified channel.
 void setQuantumStrategy(int bitResolution)
          Sets the bit resolution.
 void setRGBA(int w, int red, int green, int blue, int alpha)
          Sets the color associated to the specified channel.
 void updateQuantumManager()
          Updates the QuantumManager and configures it according to the current quantum definition.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MAX_CHANNELS

public static final int MAX_CHANNELS
The maximum number of channels.

See Also:
Constant Field Values

MODEL_GREYSCALE

public static final String MODEL_GREYSCALE
Identifies the type used to store model values.

See Also:
Constant Field Values

MODEL_RGB

public static final String MODEL_RGB
Identifies the type used to store model values.

See Also:
Constant Field Values

MODEL_HSB

public static final String MODEL_HSB
Identifies the type used to store model values.

See Also:
Constant Field Values

PHOTOMETRIC_MONOCHROME

public static final String PHOTOMETRIC_MONOCHROME
Identifies the type used to store photometric interpretation values.

See Also:
Constant Field Values
Constructor Detail

Renderer

public Renderer(QuantumFactory quantumFactory,
                List<ome.model.enums.RenderingModel> renderingModels,
                ome.model.core.Pixels pixelsObj,
                ome.model.display.RenderingDef renderingDefObj,
                PixelBuffer bufferObj)
Creates a new instance to render the specified pixels set and get this new instance ready for rendering.

Parameters:
quantumFactory - a populated quantum factory.
renderingModels - an enumerated list of all rendering models.
pixelsObj - Pixels object.
renderingDefObj - Rendering definition object.
bufferObj - PixelBuffer object.
Throws:
NullPointerException - If null parameters are passed.
Method Detail

setModel

public void setModel(ome.model.enums.RenderingModel model)
Specifies the model that dictates how transformed raw data has to be mapped onto a color space. This class delegates the actual rendering to a RenderingStrategy, which is selected depending on that model. So setting the model also results in changing the rendering strategy.

Parameters:
model - Identifies the color space model.

setDefaultZ

public void setDefaultZ(int z)
Sets the index of the default focal section. This index is used to define a default plane.

Parameters:
z - The stack index.
See Also:
setDefaultT(int), #getDefaultPlaneDef()

setDefaultT

public void setDefaultT(int t)
Sets the default timepoint index. This index is used to define a default plane.

Parameters:
t - The timepoint index.
See Also:
setDefaultZ(int), #getDefaultPlaneDef()

setOverlays

public void setOverlays(Map<byte[],Integer> overlays)
Sets a map of overlays to be rendered.

Parameters:
overlays - Overlay to color map.

getOverlays

public Map<byte[],Integer> getOverlays()
Returns the current set of overlays to be rendered.

Returns:
Overlay to color map.

updateQuantumManager

public void updateQuantumManager()
Updates the QuantumManager and configures it according to the current quantum definition.


render

public RGBBuffer render(PlaneDef pd)
                 throws IOException,
                        QuantizationException
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:
IOException - If an error occurred while trying to pull out data from the pixels data repository.
QuantizationException - If an error occurred while quantizing the pixels raw data.
NullPointerException - If pd is null.

renderAsPackedInt

public int[] renderAsPackedInt(PlaneDef pd,
                               PixelBuffer newBuffer)
                        throws IOException,
                               QuantizationException
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.
newBuffer - The pixel buffer to use in place of the one currently defined in the renderer. This will not change the state of the Renderer. If null is passed the existing pixel buffer will be used.
Returns:
An RGB image ready to be displayed on screen.
Throws:
IOException - If an error occurred while trying to pull out data from the pixels data repository.
QuantizationException - If an error occurred while quantizing the pixels raw data.
NullPointerException - If pd is null.

renderAsPackedIntAsRGBA

public int[] renderAsPackedIntAsRGBA(PlaneDef pd,
                                     PixelBuffer newBuffer)
                              throws IOException,
                                     QuantizationException
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.
newBuffer - The pixel buffer to use in place of the one currently defined in the renderer. This will not change the state of the Renderer. If null is passed the existing pixel buffer will be used.
Returns:
An RGB image ready to be displayed on screen, using the colour format of RGBA.
Throws:
IOException - If an error occurred while trying to pull out data from the pixels data repository.
QuantizationException - If an error occurred while quantizing the pixels raw data.
NullPointerException - If pd is null.

getImageSize

public int getImageSize(PlaneDef pd)
Returns the size, in bytes, of the RGBBuffer that would be rendered from the plane selected by pd. Note that the returned value also depends on the current rendering strategy which is selected by the setModel method. So a subsequent invocation of this method may return a different value if the setModel method has been called since the first call to this method.

Parameters:
pd - Selects a plane orthogonal to one of the X, Y, or Z axes.
Returns:
See above.
Throws:
NullPointerException - If pd is null.

getPlaneDimsAsString

public String getPlaneDimsAsString(PlaneDef pd)
Returns a string with the dimensions of the specified plane. The returned string has the format AxB, where A is the number of pixels on the X1-axis and B the the number of pixels on the the X2-axis. The X1-axis is the X-axis in the case of an XY or XZ plane. Otherwise it is the Z-axis — ZY plane. The X2-axis is the Y-axis in the case of an XY or ZY plane. Otherwise it is the Z-axis — XZ plane.

Parameters:
pd - Selects a plane orthogonal to one of the X, Y, or Z axes.
Returns:
See above.
Throws:
NullPointerException - If pd is null.

getChannelBindings

public ome.model.display.ChannelBinding[] getChannelBindings()
Returns an array containing the channel bindings. The dimension of the array equals the number of channels.

Returns:
See above.

getChannelBindingsAsList

public List<ome.model.display.ChannelBinding> getChannelBindingsAsList()
Returns a list containing the channel bindings. The dimension of the array equals the number of channels.

Returns:
See above.

getRenderingDef

public ome.model.display.RenderingDef getRenderingDef()
Returns the settings that define the transformation context. That is, a specification of how raw data is to be transformed into an image that can be displayed on screen.

Returns:
See above.

getQuantumManager

public omeis.providers.re.QuantumManager getQuantumManager()
Returns the object that manages and allows to retrieve the objects that are used to quantize wavelength data.

Returns:
See above.

getPixels

public PixelBuffer getPixels()
Returns the object that allows to access the pixels raw data.

Returns:
See above.

getMetadata

public ome.model.core.Pixels getMetadata()
Returns the Pixels set the rendering engine is for.

Returns:
See above.

getPixelsType

public ome.model.enums.PixelsType getPixelsType()
Returns the pixels type.

Returns:
A pixels type enumeration object.

getCodomainChain

public CodomainChain getCodomainChain()
Returns the object that defines the sequence of spatial transformations to be applied to quantized data.

Returns:
See above.

getStats

public RenderingStats getStats()
Returns a RenderingStats object that the rendering strategy can use to track performance. A new stats object is created upon each invocation of the render method.

Returns:
The stats object.

setQuantumStrategy

public void setQuantumStrategy(int bitResolution)
Sets the bit resolution.

Parameters:
bitResolution - The value to set.

setCodomainInterval

public void setCodomainInterval(int start,
                                int end)
Sets the codomain interval i.e. a sub-interval of [0, 255].

Parameters:
start - The lower bound of the interval.
end - The upper bound of the interval.

setChannelWindow

public void setChannelWindow(int w,
                             double start,
                             double end)
Sets the pixels intensity interval for the specified channel.

Parameters:
w - The channel index.
start - The lower bound of the interval.
end - The upper bound of the interval.

setQuantizationMap

public void setQuantizationMap(int w,
                               ome.model.enums.Family family,
                               double coefficient,
                               boolean noiseReduction)
Sets the mapping strategy for the specified channel.

Parameters:
w - The channel index.
family - The mapping family.
coefficient - The coefficient identifying a curve in the family.
noiseReduction - Pass true to select the noiseReduction algorithm, false otherwise.

setRGBA

public void setRGBA(int w,
                    int red,
                    int green,
                    int blue,
                    int alpha)
Sets the color associated to the specified channel.

Parameters:
w - The channel index.
red - The red component of the color.
green - The green component of the color.
blue - The blue component of the color.
alpha - The alpha component of the color.

setActive

public void setActive(int w,
                      boolean active)
Makes a particular channel active or inactive.

Parameters:
w - the wavelength index to toggle.
active - true to set the channel active or false to set the channel inactive.

getOptimizations

public Optimizations getOptimizations()
Returns the optimizations that the renderer currently has enabled.

Returns:
See above.

close

public void close()
Closes the buffer, cleaning up file state.

Throws:
IOException - if an I/O error occurs.

getColorArray

public static int[] getColorArray(ome.model.display.ChannelBinding channel)
Returns an array whose ascending indices represent the color components Red, Green and Blue.

Parameters:
color - the color to decompose into an array.
Returns:
See above.

isPixelsTypeSigned

public boolean isPixelsTypeSigned()
Returns true if the pixels type is signed, false otherwise.

Returns:
See above.

getPixelsTypeLowerBound

public 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

public 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.


OmeroJava Api

Version: Beta-4.1.1-r5927-b91

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