|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectnet.grelf.grip.ImageBase
net.grelf.grip.ImageDouble
public class ImageDouble
This is used as an alternative to BufferedImage for holding 64-bits-per-channel (floating point)
images. It needs a lot of memory of course: width x height x (12 + 8n) bytes for n-channel images.
Its behaviour differs from BufferedImages in that the maximum level available is not automatically increased
to 2 to the power 32. A 16-bit BufferedImage would always be considered to have a maximum level of 65535
but the maximum level of an Accumulator is the maximum level actually reached in the data (across all
channels). The range of values held must be updated by every operation that modifies the data, so it is then
available as getRangeDouble () without rescanning the image. A rescan can always be done, by
getOverallRangeDouble () or getChannelRangesDouble (), but that can be time consuming.
Whereas a BufferedImage would be processed by static methods in class ImProcess, ImageDoubles have all such
methods as instance methods.
The data can be saved on disc and reloaded in FITS format.
| Field Summary | |
|---|---|
protected double[][] |
data
|
| Constructor Summary | |
|---|---|
ImageDouble(java.awt.image.BufferedImage bim)
Use the BufferedImage to set the width, height and number of bands (channels) in this Image. |
|
ImageDouble(int width,
int height,
int nBands)
Creates image without setting any pixels. |
|
ImageDouble(int width,
int height,
int nBands,
boolean fillWithZeroes)
Creates image with pixels optionally set to zero. |
|
| Method Summary | |
|---|---|
void |
add(java.awt.image.BufferedImage bim)
Add pixel values from bim into the image data array. |
void |
add(java.awt.image.BufferedImage bim,
double dx,
double dy)
Add pixel values from bim into the image data array, offset by vector (dx, dy). |
void |
add(java.awt.image.BufferedImage bim,
int dx,
int dy)
Add pixel values from bim into the image data array, offset by vector (dx, dy). |
void |
add(double offset)
Offset all pixel values by the given amount. |
void |
add(Image other)
Add pixel values from the other Image into the current data array. |
void |
add(ImageDouble other)
Add pixel values from another Image into the data array. |
void |
add(ImageDouble other,
double f1,
double f2)
Add pixel values from another Image into the data array, taking fraction f1 of the values in the current Image and f2 of those in the other. |
void |
applyCurve(RangeInt currentRange,
java.util.List<java.awt.Point> points,
java.awt.image.BufferedImage bim)
Apply a look-up curve to transform Image pixels into BufferedImage pixels. |
void |
applyCurveDouble(java.util.List<java.awt.Point> points)
Apply a look-up curve to this ImageDouble. |
void |
applyCurveDouble(RangeDouble currentRange,
java.util.List<java.awt.Point> points,
java.awt.image.BufferedImage bim)
Apply a look-up curve to transform Image pixels into BufferedImage pixels. |
void |
applyCurveDouble(RangeDouble currentRange,
java.util.List<java.awt.Point> points,
ImageInt dstAccum)
Apply a look-up curve to transform ImageDouble pixels into ImageInt pixels. |
void |
autoCrop()
Automatically remove any rectangular margin of black (0, 0, 0) pixels from the image, thereby cropping it. |
void |
autoStretch(boolean allChannelsSame)
Stretch the contrast in the image so the full range of levels is used. |
void |
autoStretch(boolean allChannelsSame,
java.awt.Point topLeft,
java.awt.Point bottomRight)
Stretch the contrast in the image so the full range of levels is used. |
byte[][] |
autoThreshold()
Threshold automatically. |
void |
averageVertically()
Replace every pixel of every vertical line in the image by the average of the levels along the line. |
void |
averageVertically(int yMin,
int yMax)
Replace every pixel of every vertical line in the image by the average of the levels along the line, within two y coordinate limits. |
protected void |
checkCompatibility(java.awt.image.BufferedImage bim)
|
Image |
clone()
|
ImageInt |
convertToImageInt(boolean interactively)
Interact via ImCurveDialogue or scale linearly to create an ImageInt. |
void |
convertToMonochrome()
Reduce the number of bands from 3 to 1, converting RGB to monochrome, using 0.325 x red + 0.5 * green + 0.175 * blue. |
void |
convertToMonochrome(double... f)
Reduce the number of bands to 1, combining channels, using sum_i (f[i]/I x px[i]), where I = sum_i (f[i]). |
void |
crop(java.awt.Point pt1,
java.awt.Point pt2)
Crop the accumulator by a rectangle defined by the diagonally opposite points. |
void |
divide(int n)
Divide all pixel values (in all bands) in the accumulator by n. |
void |
drawImage(java.awt.image.BufferedImage bim)
Convert the accumulator data into a BufferedImage, by drawing them into the image displayed in an ImFrame. |
void |
fit(int width,
int height)
Scale the image so it fits into the given width and height (in pixels), without changing its proportions. |
void |
flipHorizontal()
Flip the image horizontally. |
void |
flipVertical()
Flip the image vertically. |
int |
getBitsPerChannel()
Get the number of bits per channel; currently always returns 64. |
RangeInt[] |
getChannelRanges()
Find the range of values in each channel, as pairs of int values - NB: MAY OVERFLOW. |
RangeDouble[] |
getChannelRangesDouble()
Find the range of values in each channel, as pairs of double values. |
int |
getHeight()
Get the height, in pixels, of the image. |
double[] |
getHorizontalSamplesDouble(int x0,
int y,
int band,
int n)
|
Metadata |
getMetadata()
Get metadata associated with the image. |
int |
getNBands()
Get the number of bands (channels) in the image. |
RangeInt |
getOverallRange()
Get overall range of values across all channels, as a pair of int values - NB: MAY OVERFLOW. |
RangeDouble |
getOverallRangeDouble()
Get overall range of values across all channels, as a pair of double values |
int[] |
getPixel(int x,
int y)
Get array of int pixel values for all bands at the given integer (x, y) position. |
double[] |
getPixelDouble(int x,
int y)
Get array of double pixel values for all bands at the given integer (x, y) position. |
double[] |
getPixelDoubleInterpolated(double x,
double y)
Get array of double pixel values for all bands at the given fractional (x, y) position. |
int[] |
getPixelInterpolated(double x,
double y)
Get array of int pixel values for all bands at the given fractional (x, y) position. |
RangeInt |
getRange()
Get the minimum and maximum values occurring, across all channels. |
RangeDouble |
getRangeDouble()
Get the minimum and maximum values occurring, across all channels. |
double[] |
getVerticalSamplesDouble(int x,
int y0,
int band,
int n)
|
int |
getWidth()
Get the width, in pixels, of the image. |
Image |
gnomonicProjection(int focalLength)
Project from sphere to plane. |
Image |
inverseGnomonicProjection(int focalLength)
Project from plane to sphere. |
void |
invert()
Invert the colour at every pixel in the image. |
void |
meanFilter(int halfWidth,
javax.swing.ProgressMonitor monitor)
Replace every pixel in the image by the mean value of its n x n neighbourhood, where n = 2.halfWidth + 1. |
void |
medianFilter(int halfWidth,
javax.swing.ProgressMonitor monitor)
Replace every pixel in the image by the median value of its n x n neighbourhood, where n = 2.halfWidth + 1. |
void |
multiply(double f)
Multiply all pixel values (in all bands) in the accumulator by factor f, truncating the result if pixels contain integer values. |
void |
multiply(ImageDouble other)
|
void |
multiply(ImageDouble other,
double f1,
double f2)
Multiply fraction f1 of this accumulator by f2 of the other. |
void |
nearestExtremeFilter(int halfWidth,
javax.swing.ProgressMonitor monitor)
Replace every pixel in the image by the nearest of the max and min of its n x n neighbourhood, where n = 2.halfWidth + 1. |
void |
neutraliseBackground()
Equate the histogram modes of all channels by stretching from the overall maximum value. |
void |
rankFilter(int halfWidth,
javax.swing.ProgressMonitor monitor)
Replace every pixel in the image by its rank in its n x n neighbourhood, where n = 2.halfWidth + 1. |
void |
reapplyColour(Image intensityAcc,
Image colourAcc)
For combining a monochrome intensity image with a multi-band colour information image, the 2 images having been created by ImProcess.splitIntensity (). |
Image |
rotate(double angleDegs)
Rotate the image anticlockwise by the given angle (in degrees). |
void |
save(java.lang.String filePath)
Save on disc: slower version, has to work out the range of values occurring in the accumulator. |
void |
save(java.lang.String filePath,
RangeDouble range)
Save on disc: faster version if the range of values occurring in the accumulator is already known. |
void |
save(java.lang.String filePath,
RangeInt range)
Save on disc: faster version if the range of values occurring in the accumulator is already known. |
void |
saveAsFITS(java.lang.String filePath)
|
Image |
scale(double factor,
boolean interpolating)
Scale the image in x and y by the given factor |
void |
scale(RangeDouble[] currentChannelRanges,
java.awt.image.BufferedImage bim)
Deprecated. |
void |
scale(RangeDouble[] currentChannelRanges,
RangeDouble[] targetChannelRanges)
Deprecated. |
void |
scale(RangeInt[] currentChannelRanges,
java.awt.image.BufferedImage bim)
Deprecated. |
void |
scale(RangeInt[] currentChannelRanges,
RangeInt[] targetChannelRanges)
Deprecated. |
void |
set(java.awt.image.BufferedImage bim)
Set pixel values from bim into the accumulator array. |
void |
setMetadata(Metadata theData)
Associate metadata with the image. |
void |
setPixel(int x,
int y,
int[] px)
Does nothing if (x, y) is outside the image. |
void |
setPixel(int x,
int y,
int band,
int px)
Set value into a single band of a pixel without changing the other bands. |
void |
setPixelDouble(int x,
int y,
double[] px)
Does nothing if (x, y) is outside the image. |
void |
setPixelDouble(int x,
int y,
int band,
double px)
Set value into a single band of a pixel without changing the other bands. |
protected void |
setRangeDouble(RangeDouble range)
|
Image[] |
splitChannels()
Convert image to any array of monochrome images. |
void |
subtract(java.awt.image.BufferedImage bim)
Subtract pixel values of bim from the accumulator array. |
void |
subtract(ImageDouble other)
Subtract other from this, pixel by pixel, the result being about the half-way brightness level so that both negative and positive results can be seen. |
void |
subtractToZero(ImageDouble other)
Subtract other from this, pixel by pixel, negative results being cut off at zero. |
byte[][] |
threshold(Threshold thresh)
Threshold the image to detect pixels in the range(s) specified by the given threshold. |
java.lang.String |
toString()
Get a simple description : width x height x channels |
Image |
translate(int dx,
int dy)
Displace the image content by the given offset vector. |
void |
varianceFilter(int halfWidth,
javax.swing.ProgressMonitor monitor)
Replace every pixel in the image by the variance of its n x n neighbourhood, where n = 2.halfWidth + 1. |
| Methods inherited from class net.grelf.grip.ImageBase |
|---|
padTo, padTo, rJustified20 |
| Methods inherited from class java.lang.Object |
|---|
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
protected double[][] data
| Constructor Detail |
|---|
public ImageDouble(int width,
int height,
int nBands)
public ImageDouble(int width,
int height,
int nBands,
boolean fillWithZeroes)
public ImageDouble(java.awt.image.BufferedImage bim)
throws IncompatibleImageException
IncompatibleImageException| Method Detail |
|---|
public int getWidth()
getWidth in interface Imagepublic int getHeight()
getHeight in interface Imagepublic int getNBands()
getNBands in interface Imagepublic int getBitsPerChannel()
getBitsPerChannel in interface Imagepublic Metadata getMetadata()
getMetadata in interface Imagepublic void setMetadata(Metadata theData)
setMetadata in interface Imagepublic RangeInt getRange()
getRange in interface Imagepublic RangeDouble getRangeDouble()
getRangeDouble in interface Imageprotected void setRangeDouble(RangeDouble range)
protected void checkCompatibility(java.awt.image.BufferedImage bim)
throws IncompatibleImageException
IncompatibleImageExceptionpublic void add(double offset)
public void add(Image other)
throws IncompatibleImageException
Image
add in interface ImageIncompatibleImageException
public void add(ImageDouble other)
throws IncompatibleImageException
IncompatibleImageException
public void add(ImageDouble other,
double f1,
double f2)
throws IncompatibleImageException
IncompatibleImageException
public void add(java.awt.image.BufferedImage bim)
throws IncompatibleImageException
add in interface ImageIncompatibleImageException
public void add(java.awt.image.BufferedImage bim,
int dx,
int dy)
throws IncompatibleImageException
add in interface ImageIncompatibleImageException
public void add(java.awt.image.BufferedImage bim,
double dx,
double dy)
throws IncompatibleImageException
add in interface ImageIncompatibleImageException
public void applyCurve(RangeInt currentRange,
java.util.List<java.awt.Point> points,
java.awt.image.BufferedImage bim)
throws IncompatibleImageException
applyCurve in interface ImageIncompatibleImageException
public void applyCurveDouble(RangeDouble currentRange,
java.util.List<java.awt.Point> points,
java.awt.image.BufferedImage bim)
throws IncompatibleImageException
IncompatibleImageException
public void applyCurveDouble(RangeDouble currentRange,
java.util.List<java.awt.Point> points,
ImageInt dstAccum)
throws IncompatibleImageException
IncompatibleImageExceptionpublic void applyCurveDouble(java.util.List<java.awt.Point> points)
public void autoCrop()
autoCrop in interface Imagepublic void autoStretch(boolean allChannelsSame)
autoStretch in interface Image
public void autoStretch(boolean allChannelsSame,
java.awt.Point topLeft,
java.awt.Point bottomRight)
autoStretch in interface Imagepublic byte[][] autoThreshold()
autoThreshold in interface Imagepublic void averageVertically()
averageVertically in interface Image
public void averageVertically(int yMin,
int yMax)
averageVertically in interface Imagepublic Image clone()
clone in interface Imageclone in class java.lang.Objectpublic ImageInt convertToImageInt(boolean interactively)
public void convertToMonochrome()
convertToMonochrome in interface Imagepublic void convertToMonochrome(double... f)
convertToMonochrome in interface Image
public void crop(java.awt.Point pt1,
java.awt.Point pt2)
crop in interface Imagepublic void divide(int n)
divide in interface Imagepublic void drawImage(java.awt.image.BufferedImage bim)
drawImage in interface Image
public void fit(int width,
int height)
fit in interface Imagepublic void flipHorizontal()
flipHorizontal in interface Imagepublic void flipVertical()
flipVertical in interface Imagepublic RangeInt[] getChannelRanges()
getChannelRanges in interface Imagepublic RangeDouble[] getChannelRangesDouble()
getChannelRangesDouble in interface Imagepublic RangeInt getOverallRange()
getOverallRange in interface Imagepublic RangeDouble getOverallRangeDouble()
getOverallRangeDouble in interface Image
public int[] getPixel(int x,
int y)
getPixel in interface Image
public double[] getPixelDouble(int x,
int y)
getPixelDouble in interface Image
public int[] getPixelInterpolated(double x,
double y)
getPixelInterpolated in interface Image
public double[] getPixelDoubleInterpolated(double x,
double y)
getPixelDoubleInterpolated in interface Image
public double[] getHorizontalSamplesDouble(int x0,
int y,
int band,
int n)
public double[] getVerticalSamplesDouble(int x,
int y0,
int band,
int n)
public Image gnomonicProjection(int focalLength)
gnomonicProjection in interface Imagepublic Image inverseGnomonicProjection(int focalLength)
inverseGnomonicProjection in interface Imagepublic void invert()
invert in interface Image
public void meanFilter(int halfWidth,
javax.swing.ProgressMonitor monitor)
meanFilter in interface Image
public void medianFilter(int halfWidth,
javax.swing.ProgressMonitor monitor)
medianFilter in interface Imagepublic void multiply(double f)
multiply in interface Imagepublic void multiply(ImageDouble other)
public void multiply(ImageDouble other,
double f1,
double f2)
public void nearestExtremeFilter(int halfWidth,
javax.swing.ProgressMonitor monitor)
nearestExtremeFilter in interface Imagepublic void neutraliseBackground()
Image
neutraliseBackground in interface Image
public void rankFilter(int halfWidth,
javax.swing.ProgressMonitor monitor)
rankFilter in interface Image
public void reapplyColour(Image intensityAcc,
Image colourAcc)
reapplyColour in interface Imagepublic Image rotate(double angleDegs)
rotate in interface Imagepublic void save(java.lang.String filePath)
save in interface Image
public void save(java.lang.String filePath,
RangeInt range)
save in interface Image
public void save(java.lang.String filePath,
RangeDouble range)
save in interface Imagepublic void saveAsFITS(java.lang.String filePath)
saveAsFITS in interface Image
public Image scale(double factor,
boolean interpolating)
scale in interface Image
@Deprecated
public void scale(RangeInt[] currentChannelRanges,
RangeInt[] targetChannelRanges)
scale in interface Image
@Deprecated
public void scale(RangeInt[] currentChannelRanges,
java.awt.image.BufferedImage bim)
throws IncompatibleImageException
scale in interface ImageIncompatibleImageException
@Deprecated
public void scale(RangeDouble[] currentChannelRanges,
RangeDouble[] targetChannelRanges)
scale in interface Image
@Deprecated
public void scale(RangeDouble[] currentChannelRanges,
java.awt.image.BufferedImage bim)
throws IncompatibleImageException
scale in interface ImageIncompatibleImageException
public final void set(java.awt.image.BufferedImage bim)
throws IncompatibleImageException
set in interface ImageIncompatibleImageException
public void setPixel(int x,
int y,
int[] px)
setPixel in interface Image
public void setPixel(int x,
int y,
int band,
int px)
setPixel in interface Image
public void setPixelDouble(int x,
int y,
double[] px)
setPixelDouble in interface Image
public void setPixelDouble(int x,
int y,
int band,
double px)
setPixelDouble in interface Imagepublic Image[] splitChannels()
splitChannels in interface Imagepublic void subtract(ImageDouble other)
public void subtract(java.awt.image.BufferedImage bim)
throws IncompatibleImageException
subtract in interface ImageIncompatibleImageExceptionpublic void subtractToZero(ImageDouble other)
public byte[][] threshold(Threshold thresh)
threshold in interface Imagepublic java.lang.String toString()
toString in interface ImagetoString in class java.lang.Object
public Image translate(int dx,
int dy)
translate in interface Image
public void varianceFilter(int halfWidth,
javax.swing.ProgressMonitor monitor)
varianceFilter in interface Image
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||