public class Renderer extends Object
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.
RenderingDef
,
QuantumManager
,
CodomainChain
,
RenderingStrategy
Modifier and Type | Field and Description |
---|---|
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 and Description |
---|
Renderer(QuantumFactory quantumFactory,
List<RenderingModel> renderingModels,
Pixels pixelsObj,
RenderingDef renderingDefObj,
PixelBuffer bufferObj)
Creates a new instance to render the specified pixels set and get this
new instance ready for rendering.
|
Modifier and Type | Method and Description |
---|---|
void |
close()
Closes the buffer, cleaning up file state.
|
ChannelBinding[] |
getChannelBindings()
Returns an array containing the channel bindings.
|
List<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(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 . |
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.
|
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.
|
RenderingDef |
getRenderingDef()
Returns the settings that define the transformation context.
|
List<List<Integer>> |
getResolutionDescriptions()
Returns the image's size information per resolution level.
|
int |
getResolutionLevel()
Retrieves the active resolution level.
|
int |
getResolutionLevels()
Retrieves the number of resolution levels that the backing
pixels pyramid contains.
|
RenderingStats |
getStats()
Returns a
RenderingStats object that the rendering strategy can
use to track performance. |
Dimension |
getTileSize()
Retrieves the tile size for the pixel store.
|
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. |
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(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,
Family family,
double coefficient,
boolean noiseReduction)
Sets the mapping strategy for the specified channel.
|
void |
setQuantumStrategy(int bitResolution)
Sets the bit resolution.
|
void |
setResolutionLevel(int resolutionLevel)
Sets the active resolution level.
|
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. |
public static final int MAX_CHANNELS
public static final String MODEL_GREYSCALE
public static final String MODEL_RGB
public static final String MODEL_HSB
public static final String PHOTOMETRIC_MONOCHROME
public Renderer(QuantumFactory quantumFactory, List<RenderingModel> renderingModels, Pixels pixelsObj, RenderingDef renderingDefObj, PixelBuffer bufferObj)
quantumFactory
- a populated quantum factory.renderingModels
- an enumerated list of all rendering models.pixelsObj
- Pixels object.renderingDefObj
- Rendering definition object.bufferObj
- PixelBuffer object.NullPointerException
- If null
parameters are passed.public void setModel(RenderingModel model)
RenderingStrategy
, which is selected depending on that model. So
setting the model also results in changing the rendering strategy.model
- Identifies the color space model.public void setDefaultZ(int z)
z
- The stack index.setDefaultT(int)
public void setDefaultT(int t)
t
- The timepoint index.setDefaultZ(int)
public void setOverlays(Map<byte[],Integer> overlays)
overlays
- Overlay to color map.public Map<byte[],Integer> getOverlays()
public void updateQuantumManager()
QuantumManager
and configures it according to the
current quantum definition.public RGBBuffer render(PlaneDef pd) throws IOException, QuantizationException
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.pd
- Selects a plane orthogonal to one of the X, Y,
or Z axes.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
.public int[] renderAsPackedInt(PlaneDef pd, PixelBuffer newBuffer) throws IOException, QuantizationException
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.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.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
.public int getImageSize(PlaneDef pd)
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.pd
- Selects a plane orthogonal to one of the X, Y,
or Z axes.NullPointerException
- If pd
is null
.public String getPlaneDimsAsString(PlaneDef pd)
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.pd
- Selects a plane orthogonal to one of the X, Y,
or Z axes.NullPointerException
- If pd
is null
.public ChannelBinding[] getChannelBindings()
public List<ChannelBinding> getChannelBindingsAsList()
public RenderingDef getRenderingDef()
public omeis.providers.re.QuantumManager getQuantumManager()
public PixelBuffer getPixels()
public Pixels getMetadata()
Pixels
set the rendering engine is for.public PixelsType getPixelsType()
public CodomainChain getCodomainChain()
public RenderingStats getStats()
RenderingStats
object that the rendering strategy can
use to track performance. A new stats object is created upon each
invocation of the render
method.public void setQuantumStrategy(int bitResolution)
bitResolution
- The value to set.public void setCodomainInterval(int start, int end)
start
- The lower bound of the interval.end
- The upper bound of the interval.public void setChannelWindow(int w, double start, double end)
w
- The channel index.start
- The lower bound of the interval.end
- The upper bound of the interval.public void setQuantizationMap(int w, Family family, double coefficient, boolean noiseReduction)
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.public void setRGBA(int w, int red, int green, int blue, int alpha)
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.public void setActive(int w, boolean active)
w
- the wavelength index to toggle.active
- true
to set the channel active or
false
to set the channel inactive.public Optimizations getOptimizations()
public void close()
IOException
- if an I/O error occurs.public static int[] getColorArray(ChannelBinding channel)
channel
- the color to decompose into an array.public boolean isPixelsTypeSigned()
true
if the pixels type is signed,
false
otherwise.public double getPixelsTypeLowerBound(int w)
w
- The channel index.public double getPixelsTypeUpperBound(int w)
w
- The channel index.public void setResolutionLevel(int resolutionLevel)
resolutionLevel
- The resolution level to be used by the renderer.public int getResolutionLevel()
public int getResolutionLevels()
public List<List<Integer>> getResolutionDescriptions()
public Dimension getTileSize()
null
if the pixel
buffer is not tiled.
Version: 5.2.0-ice35-b12
Copyright © 2015 The University of Dundee & Open Microscopy Environment. All Rights Reserved.