public class ImageProcessor extends Object
Modifier and Type | Field and Description |
---|---|
protected boolean |
_reverseY |
static int |
DEFAULT_X_PERIOD
The default number of X pixels to skip for histograms and statistics
|
static int |
DEFAULT_Y_PERIOD
The default number of Y pixels to skip for histograms and statistics
|
Constructor and Description |
---|
ImageProcessor()
Default constructor.
|
ImageProcessor(javax.media.jai.PlanarImage sourceImage,
Rectangle2D.Double region)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
addChangeListener(ChangeListener l)
register to receive change events from this object whenever the
image or cut levels are changed.
|
void |
autoSetCutLevels(double percent,
Rectangle2D.Double region)
Set the cut levels so that the given percent of pixels
in the given region of the image are within the low
and high cut values.
|
void |
autoSetCutLevels(Rectangle2D.Double region)
Set the image cut levels automatically using median filtering on the given
area of the image.
|
protected void |
calculateImageStatistics(Rectangle2D.Double region)
Examine the given region of the source image to determine the min
and max pixel values as well as the default cut levels (using median filter).
|
void |
copySettings(ImageProcessor ip)
Copy the settings from the given ImageProcessor to this one.
|
protected void |
fireChange(ImageChangeEvent changeEvent)
Notify any listeners of a change in the image or cut levels.
|
double |
getAngle()
Return the rotation angle.
|
double |
getBlank()
Return the value used for bad or blank pixels (taken from "BLANK" image property).
|
javax.media.jai.LookupTableJAI |
getColorLookupTable()
Return the current lookup table used to add color to a grayscale image.
|
String |
getColorLookupTableName()
Return the name of the current color lookup table
|
javax.media.jai.PlanarImage |
getDisplayImage()
Returns the current display image.
|
boolean |
getFlipX()
Return the value of the flipX flag.
|
boolean |
getFlipY()
Return the value of the flipY flag.
|
double |
getHighCut()
Get the high cutoff level
|
javax.media.jai.Histogram |
getHistogram(int size,
javax.media.jai.ROI roi)
Return a histogram for the image with the given size (number of bins)
and region of interest and default settings for the other arguments.
|
String |
getIntensityLookupTableName()
Return the name of the current intensity lookup table
|
javax.media.jai.Interpolation |
getInterpolation()
Return the type of interpolation to use (for rotating).
|
double |
getLowCut()
Get the low cutoff level
|
double |
getMaxValue()
Return the max pixel value in the region specified in the last call
to calculateImageStatistics.
|
double |
getMinValue()
Return the min pixel value in the region specified in the last call
to calculateImageStatistics.
|
String |
getName()
Return the name of this object
|
javax.media.jai.PlanarImage |
getRescaledSourceImage()
Returns the current source image, after applying BZERO and BSCALE, if needed.
|
boolean |
getReverseY()
Return the value of the reverseY flag.
|
int |
getScaleAlgorithm()
Return the current image scaling algorithm (one of the constants defined in the
ImageLookup class (default: ImageLookup.LINEAR_SCALE).
|
javax.media.jai.LookupTableJAI |
getScaleLookupTable()
Return the lookup table used to scale the image to byte range
|
javax.media.jai.PlanarImage |
getSourceImage()
Returns the current source image.
|
boolean |
isInvertedYAxis()
Return true if the Y axis of the image was inverted while reading.
|
protected boolean |
isUpdatePending()
Return true if something was changed and a call to update() is needed.
|
boolean |
isUserSetCutLevels()
Return true if the user has set the cut levels and they were not automatically set.
|
void |
removeChangeListener(ChangeListener l)
Stop receiving change events from this object.
|
protected javax.media.jai.PlanarImage |
rescaleImage(javax.media.jai.PlanarImage im)
Rescale the given image, if needed, using the given factor and offset and return the result.
|
void |
resetColormap()
Reset the colormap to the default.
|
protected javax.media.jai.PlanarImage |
rotate(javax.media.jai.PlanarImage im)
Rotate the image about the center by the specified angle (in radians).
|
void |
rotateColormap(int amount)
Rotate the colormap by the given amount.
|
void |
saveColormap()
Save the current colormap state for the next shift, rotate or scale operation.
|
void |
scaleColormap(int amount)
Scale the colormap by the given amount.
|
void |
setAngle(double angle)
Set the rotation angle.
|
protected void |
setBlank(double blank)
Set the value to be used for bad or blank pixels.
|
void |
setColorLookupTable(String name)
Create a color RGB lookup table that can be added to the image processing chain,
so that we can manipulate the image colors.
|
void |
setCutLevels(double lowCut,
double highCut)
Set the image cutoff levels.
|
void |
setCutLevels(double lowCut,
double highCut,
boolean userSetCutLevels)
Set the image cutoff levels.
|
void |
setDefaultColormap()
Reset the colormap to the default.
|
void |
setFlipX(boolean flipX)
Set the value of the flipX flag.
|
void |
setFlipY(boolean flipY)
Set the value of the flipY flag.
|
void |
setHighCut(double highCut)
Set the high cutoff level
|
void |
setIntensityLookupTable(String name)
Create an intensity lookup table that can be added to the image processing chain
to rearrange the order of the colors in the colormap.
|
void |
setInterpolation(javax.media.jai.Interpolation i)
Set the type of interpolation to use (for rotating).
|
void |
setInvertedYAxis(boolean invertedYAxis)
Set to true if the Y axis of the image was inverted while reading.
|
void |
setLowCut(double lowCut)
Set the low cutoff level
|
void |
setName(String name)
Set the name to use for this object (for testing and debugging).
|
protected void |
setRegionOfInterest(Rectangle2D.Double region)
Set the current region of interest in the image (normally the
currently visible area).
|
void |
setReverseY(boolean reverseY)
Set the value of the reverseY flag.
|
void |
setScaleAlgorithm(int scaleAlgorithm)
Set the algorithm to use to scale the image to byte range.
|
void |
setSourceImage(javax.media.jai.PlanarImage sourceImage,
ImageProcessor imageProcessor)
Set the source image and copy all of the image processing settings from the
given ImageProcessor object.
|
void |
setSourceImage(javax.media.jai.PlanarImage sourceImage,
Rectangle2D.Double region)
Set the source image and the region of interest and perform any requested
image processing to make the display image.
|
protected javax.media.jai.PlanarImage |
setTrans(javax.media.jai.PlanarImage im)
Perform a transpose operation on the given image using the current
rotate, flipX and flipY settings and return the resulting image.
|
protected void |
setUpdatePending(boolean b)
Set to true if something was changed and a call to update() is needed.
|
void |
setUserSetCutLevels(boolean b)
Set to true if the user has set the cut levels and they were not automatically set.
|
void |
shiftColormap(int amount)
Shift the colormap by the given amount.
|
void |
toggleFlipX()
Toggle the flipping of the X axis
|
void |
toggleFlipY()
Toggle the flipping of the Y axis
|
void |
update()
Process the source image, adding a lookup table and setting appropriate
cut levels where needed to improve visibility.
|
public static final int DEFAULT_X_PERIOD
public static final int DEFAULT_Y_PERIOD
protected boolean _reverseY
public ImageProcessor()
public ImageProcessor(javax.media.jai.PlanarImage sourceImage, Rectangle2D.Double region)
sourceImage
- The source image to process.region
- the region of interest in the image (usually the visible area)
in the coordinates of the source image (values will be clipped).public javax.media.jai.PlanarImage getSourceImage()
public javax.media.jai.PlanarImage getRescaledSourceImage()
public void setSourceImage(javax.media.jai.PlanarImage sourceImage, ImageProcessor imageProcessor)
public void setSourceImage(javax.media.jai.PlanarImage sourceImage, Rectangle2D.Double region)
region
- the region of interest in the image (usually the visible area)
in the coordinates of the source image.public javax.media.jai.PlanarImage getDisplayImage()
public void update()
protected javax.media.jai.PlanarImage rescaleImage(javax.media.jai.PlanarImage im)
protected javax.media.jai.PlanarImage setTrans(javax.media.jai.PlanarImage im)
protected javax.media.jai.PlanarImage rotate(javax.media.jai.PlanarImage im)
protected void setRegionOfInterest(Rectangle2D.Double region)
region
- the region of interest in the imageprotected void calculateImageStatistics(Rectangle2D.Double region)
region
- the region of interest in the imagepublic void copySettings(ImageProcessor ip)
public void setCutLevels(double lowCut, double highCut)
lowCut
- the low cut valuelowCut
- the high cut valuepublic void setCutLevels(double lowCut, double highCut, boolean userSetCutLevels)
lowCut
- the low cut valuelowCut
- the high cut valueuserSetCutLevels
- set to true if the cut levels were set by the user
(meaning they should not be changed automatically)public void setLowCut(double lowCut)
public void setHighCut(double highCut)
public double getLowCut()
public double getHighCut()
public void autoSetCutLevels(Rectangle2D.Double region)
region
- the region of interest in the imagepublic void autoSetCutLevels(double percent, Rectangle2D.Double region)
percent
- value between 0. and 100. indicating percent
of image pixels within the cut levels.region
- the region of interest in the imagepublic boolean isUserSetCutLevels()
public void setUserSetCutLevels(boolean b)
public void addChangeListener(ChangeListener l)
public void removeChangeListener(ChangeListener l)
protected void fireChange(ImageChangeEvent changeEvent)
public double getMinValue()
public double getMaxValue()
public double getBlank()
protected void setBlank(double blank)
public double getAngle()
public void setAngle(double angle)
public javax.media.jai.Interpolation getInterpolation()
public void setInterpolation(javax.media.jai.Interpolation i)
public void toggleFlipX()
public void setFlipX(boolean flipX)
public boolean getFlipX()
public void toggleFlipY()
public void setFlipY(boolean flipY)
public boolean getFlipY()
public void setReverseY(boolean reverseY)
public boolean getReverseY()
public void setInvertedYAxis(boolean invertedYAxis)
This means that the image doesn't need to be flipped before displaying, but the image coordinate system still needs to be inverted in the Y axis.
public boolean isInvertedYAxis()
public javax.media.jai.Histogram getHistogram(int size, javax.media.jai.ROI roi)
public void setName(String name)
public String getName()
public javax.media.jai.LookupTableJAI getScaleLookupTable()
public void setScaleAlgorithm(int scaleAlgorithm)
scaleAlgorithm
- one of the public constants defined in the ImageLookup class
(default: ImageLookup.LINEAR_SCALE).public int getScaleAlgorithm()
public void setColorLookupTable(String name)
name
- the name of the colormap table to use. This is currently
One of: "Background", "Blue", "Heat", "Isophot", "Light", "Pastel",
"Ramp", "Real", "Smooth", "Staircase", "Standard".
User defined maps will be implemented in a later release.public javax.media.jai.LookupTableJAI getColorLookupTable()
public String getColorLookupTableName()
public String getIntensityLookupTableName()
public void setIntensityLookupTable(String name)
name
- the name of the intensity lookup table to use. This is currently
One of: "Equal", "Exponential", "Gamma", "Jigsaw", "Lasritt", "Logarithmic",
"Negative", "Negative Log", "Ramp", "Staircase".
User defined intensity lookup tables will be implemented in a later release.public void rotateColormap(int amount)
public void shiftColormap(int amount)
public void scaleColormap(int amount)
public void saveColormap()
public void resetColormap()
public void setDefaultColormap()
protected void setUpdatePending(boolean b)
protected boolean isUpdatePending()
Copyright © 2023 Central Laboratory of the Research Councils. All Rights Reserved.