public class Image64 extends ImageBase implements Image, java.lang.Cloneable
Modifier and Type | Field and Description |
---|---|
protected double[][] |
data |
Constructor and Description |
---|
Image64(java.awt.image.BufferedImage bim)
Use the BufferedImage to set the width, height and number of bands
(channels) in this Image.
|
Image64(int width,
int height,
int nBands)
Creates image without setting any pixels.
|
Image64(int width,
int height,
int nBands,
boolean fillWithZeroes)
Creates image with pixels optionally set to zero.
|
Modifier and Type | Method and Description |
---|---|
void |
add(java.awt.image.BufferedImage bim)
Add pixel values from bim into the image data array.
|
void |
add(double offset)
Offset all pixel values by the given amount.
|
void |
add(Image other)
Add pixel values from another Image into the data array.
|
int[] |
addPixel(int x,
int y,
int[] px)
More efficient than the sequence getPixel, add for each band, setPixel.
|
void |
addProportion(Image other,
double fractionThis,
double fractionOther)
Add proportion of pixel values from the other Image to a proportion of
the current data array.
|
void |
addTranslated(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 |
addTranslated(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 |
addTranslated(Image im,
double dx,
double dy)
Add pixel values from bim into the image data array, offset by
vector (dx, dy).
|
void |
applyCurveDouble(java.util.List<java.awt.Point> points)
Apply a look-up curve to this Image64.
|
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.
|
ByteMask |
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.
|
void |
blurGaussian(int nx,
int ny,
javax.swing.ProgressMonitor monitor)
Do Gaussian blurring of this image with 1D profiles of width nx
(horizontal) and ny (vertical).
|
protected void |
checkCompatibility(java.lang.String opName,
java.awt.image.BufferedImage bim) |
protected void |
checkCompatibility(java.lang.String opName,
Image otherImage) |
Image |
clone()
Returns a new Image64 object with the same data, or null if there is
not enough memory for it.
|
Image16 |
convertToImage16() |
Image32 |
convertToImage32()
Scale linearly to create an Image32 having only positive levels.
|
Image64 |
convertToImage64()
Simply returns this (not a clone).
|
Image8 |
convertToImage8() |
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 |
convolve(double[] horz,
double[] vert,
javax.swing.ProgressMonitor monitor)
Convolve the given image with the given 1D arrays (horizontal and
vertical - may be different).
|
void |
convolve(Kernel kernel,
javax.swing.ProgressMonitor monitor)
Perform a 2D linear convolution with the given kernel.
|
void |
correctBackground(double scale,
int cellFactor)
Level the background of the image by dividing the image into n x n cells
and using the modal values of the histogram in every cell.
|
ComplexImage64 |
createTransformedGaussian(double fullWidthAtHalfMaximum)
Create a Fourier transform of a monochrome Gaussian profile of given FWHM,
at the size of the current image, ready for use in (de-)convolution.
|
ComplexImage64 |
createTransformedKernel(Kernel kernel)
Create a Fourier transform of a net.grelf.image.Kernel,
at the size of the current image, ready for use in (de-)convolution.
|
void |
crop(java.awt.Point pt1,
java.awt.Point pt2)
Crop the image by a rectangle defined by the diagonally opposite points.
|
void |
deconvolve(Kernel kernel,
int nPasses,
double weight,
javax.swing.ProgressMonitor monitor)
Deconvolve this image with the given kernel, using van Cittert's method.
|
void |
dispose()
Release all resources.
|
void |
divide(int n)
Divide all pixel values (in all bands) in the image by n.
|
void |
divideByFlatField(Image flat)
Divide by a flat field image.
|
void |
drawRim(int width,
java.awt.Color colour)
Draw a rim around the image, of the given width and colour
|
ComplexImage64 |
fft()
Fast Fourier Transform; creates a pair of 64-bit images, real [0] and
imaginary [1] parts from a single real input image (this).
|
ComplexImage64 |
fft(Image64 other)
Fast Fourier Transform; creates a pair of 64-bit images, real [0] and
imaginary [1] parts.
|
ComplexImage64 |
fftInverse(Image64 other)
Inverse Fast Fourier Transform; creates a pair of 64-bit images,
real [0] and imaginary [1] parts.
|
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.
|
int |
getBytesPerChannel()
Always returns 8 for this kind of image.
|
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) |
java.lang.String |
getImageTypeAsString()
For displaying image information, get its java.awt.image.BufferedImage
type constant name.
|
int |
getMaxLevel()
Get highest level that can occur in each channel.
|
int |
getNBands()
Get the number of bands (channels) in the image.
|
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.
|
RangeInt |
getRangeByRescanning()
Get overall range of values across all channels, as a pair of int
values, and also set it in the data of this image - NB: MAY OVERFLOW.
|
RangeDouble |
getRangeByRescanningDouble()
Get overall range of values across all channels, as a pair of double
values, and also set it in the data of this image.
|
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_mm,
double detectorWidth_mm,
double detectorHeight_mm)
Project from sphere to plane.
|
Image |
inverseGnomonicProjection(int focalLength_mm,
double detectorWidth_mm,
double detectorHeight_mm)
Project from plane to sphere.
|
void |
invert()
Invert the colour at every pixel in the image.
|
boolean |
isRaw()
Whether the image data are still in RAW format, as from a DSLR camera.
|
void |
keepOnlyDifferingPixels(Image other,
int threshold)
Keep only pixels in this image which differ by more than the threshold
amount (in at least one band) from pixels at the same position in the
other 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 image by factor f.
|
void |
multiply(Image other)
Multiply pixel values of current image by those of another.
|
void |
multiply(Image other,
double f1,
double f2)
Multiply fraction f1 of this image by f2 of the other.
|
void |
multiplyWeighted(double f)
Multiply all pixel values (in all bands) in the image by factor
f * (g - gMin) / (gMax - gMin)
|
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 splitIntensity ().
|
void |
replaceBrighterPixels(Image source)
Assuming the source image has the same dimensions, replace in the present
image any pixels which are brighter in the source (in all channels).
|
void |
rotate(Angle angle)
Rotate the image anticlockwise by the given angle about its centre.
|
void |
save(java.lang.String filePath)
Save on disc: 64-bit images can only be saved as FITS, so saveAsFITS()
is called directly.
|
void |
save(java.lang.String filePath,
RangeDouble range)
Save on disc: 64-bit images can only be saved as FITS, so saveAsFITS()
is called directly.
|
void |
save(java.lang.String filePath,
RangeInt range)
Save on disc: 64-bit images can only be saved as FITS, so saveAsFITS()
is called directly.
|
void |
saveAsFITS(java.lang.String filePath)
Saves as a 64-bit double floating point FITS file with BZERO = 0.0
and BSCALE = 1.0.
|
void |
scale(double factor,
boolean interpolating)
Scale the image in x and y by the given factor
|
void |
scale(double factor,
boolean interpolating,
java.awt.Point centre)
Scale the image in x and y by the given factor, keeping the centre fixed.
|
java.awt.image.BufferedImage |
scaleDownForDisplay(int factor)
Create a BufferedImage compatible with the display and scale the
current Image down into it by an integer factor (maximum speed).
|
void |
set(java.awt.image.BufferedImage bim)
Set pixel values from bim into the image data array.
|
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 |
setRange(RangeInt range) |
protected void |
setRangeDouble(RangeDouble range) |
void |
showInfo()
Display information about the current image in a dialogue.
|
Image[] |
splitChannels()
Convert image to any array of monochrome images.
|
Image[] |
splitIntensity()
Create a monochrome image in which each pixel has the value I = sum of
the band levels of the current image plus a colour image in which the
pixel in each band has the value maxLevel * bandLevel / I.
|
void |
subtract(Image other)
Subtract pixel values of other image from this image data array.
|
void |
subtractToZero(Image other)
Subtract pixel values of other image from this image data array, clipping
negative results to zero.
|
void |
swapQuadrants()
Rearrange the 4 quadrants of the image - useful for viewing Fourier
Transform results (in which case the image width and height are powers
of 2).
|
ByteMask |
threshold(Threshold thresh)
Threshold the image to detect pixels in the range(s) specified by the
given threshold.
|
java.lang.String |
toFoldedString(java.lang.String lineEnd)
Return complete metadata in a form suitable for display.
|
java.lang.String |
toString()
Get a simple description : width x height x channels
|
void |
translate(double dx,
double dy)
Displace the image content by the given offset vector, interpolating
between pixels.
|
void |
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.
|
applyCurve, compareTo, createImage, createImage, getCalibration, getEv, getFilePath, getGraphicsConfiguration, getMetadata, pixelBrighter, pixelBrighter, pixelsDiffer, pixelsDiffer, plotResponseCurve, recombine, rotate, rotate180, rotate270, rotate90, sameBitsAndBands, sameSizeBitsAndBands, saturate, setCalibration, setEv, setFilePath, setMetadata, showInfo
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
applyCurve, getCalibration, getEv, getFilePath, getMetadata, plotResponseCurve, rotate, rotate180, rotate270, rotate90, saturate, setCalibration, setEv, setFilePath, setMetadata
public Image64(int width, int height, int nBands)
public Image64(int width, int height, int nBands, boolean fillWithZeroes)
public Image64(java.awt.image.BufferedImage bim) throws IncompatibleImageException
IncompatibleImageException
public int getBitsPerChannel()
getBitsPerChannel
in interface Image
getBitsPerChannel
in class ImageBase
public int getBytesPerChannel()
getBytesPerChannel
in interface Image
public int getWidth()
public int getHeight()
public java.lang.String getImageTypeAsString()
getImageTypeAsString
in interface Image
public int getMaxLevel()
Image
getMaxLevel
in interface Image
public int getNBands()
public RangeInt getRange()
public RangeDouble getRangeDouble()
getRangeDouble
in interface Image
protected void setRangeDouble(RangeDouble range)
protected void checkCompatibility(java.lang.String opName, java.awt.image.BufferedImage bim) throws IncompatibleImageException
IncompatibleImageException
protected void checkCompatibility(java.lang.String opName, Image otherImage) throws IncompatibleImageException
IncompatibleImageException
public void add(double offset)
public int[] addPixel(int x, int y, int[] px)
public void addProportion(Image other, double fractionThis, double fractionOther) throws IncompatibleImageException
addProportion
in interface Image
IncompatibleImageException
public void add(Image other) throws IncompatibleImageException
add
in interface Image
IncompatibleImageException
public void add(java.awt.image.BufferedImage bim) throws IncompatibleImageException
add
in interface Image
IncompatibleImageException
public void addTranslated(java.awt.image.BufferedImage bim, int dx, int dy) throws IncompatibleImageException
addTranslated
in interface Image
IncompatibleImageException
public void addTranslated(java.awt.image.BufferedImage bim, double dx, double dy) throws IncompatibleImageException
addTranslated
in interface Image
IncompatibleImageException
public void addTranslated(Image im, double dx, double dy) throws IncompatibleImageException
IncompatibleImageException
public void applyCurveDouble(java.util.List<java.awt.Point> points)
public void autoCrop()
public void autoStretch(boolean allChannelsSame)
autoStretch
in interface Image
public void autoStretch(boolean allChannelsSame, java.awt.Point topLeft, java.awt.Point bottomRight)
autoStretch
in interface Image
public ByteMask autoThreshold()
autoThreshold
in interface Image
public void averageVertically()
averageVertically
in interface Image
public void averageVertically(int yMin, int yMax)
averageVertically
in interface Image
public void blurGaussian(int nx, int ny, javax.swing.ProgressMonitor monitor)
blurGaussian
in interface Image
public Image clone()
public Image8 convertToImage8()
convertToImage8
in interface Image
public Image16 convertToImage16()
convertToImage16
in interface Image
public Image32 convertToImage32()
convertToImage32
in interface Image
public Image64 convertToImage64()
convertToImage64
in interface Image
public void convertToMonochrome()
convertToMonochrome
in interface Image
public void convertToMonochrome(double... f)
convertToMonochrome
in interface Image
public void convolve(Kernel kernel, javax.swing.ProgressMonitor monitor)
public void convolve(double[] horz, double[] vert, javax.swing.ProgressMonitor monitor)
public void correctBackground(double scale, int cellFactor)
correctBackground
in interface Image
public ComplexImage64 createTransformedGaussian(double fullWidthAtHalfMaximum)
public ComplexImage64 createTransformedKernel(Kernel kernel)
public void crop(java.awt.Point pt1, java.awt.Point pt2)
public void deconvolve(Kernel kernel, int nPasses, double weight, javax.swing.ProgressMonitor monitor)
deconvolve
in interface Image
public void dispose()
Image
public void divide(int n)
public void divideByFlatField(Image flat)
divideByFlatField
in interface Image
public void drawRim(int width, java.awt.Color colour)
public ComplexImage64 fft() throws IncompatibleImageException
IncompatibleImageException
public ComplexImage64 fft(Image64 other) throws IncompatibleImageException
IncompatibleImageException
public ComplexImage64 fftInverse(Image64 other) throws IncompatibleImageException
IncompatibleImageException
public void fit(int width, int height)
public void flipHorizontal()
flipHorizontal
in interface Image
public void flipVertical()
flipVertical
in interface Image
public RangeInt[] getChannelRanges()
getChannelRanges
in interface Image
public RangeDouble[] getChannelRangesDouble()
getChannelRangesDouble
in interface Image
public RangeInt getRangeByRescanning()
getRangeByRescanning
in interface Image
public RangeDouble getRangeByRescanningDouble()
getRangeByRescanningDouble
in interface Image
public int[] getPixel(int x, int y)
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_mm, double detectorWidth_mm, double detectorHeight_mm)
gnomonicProjection
in interface Image
public Image inverseGnomonicProjection(int focalLength_mm, double detectorWidth_mm, double detectorHeight_mm)
inverseGnomonicProjection
in interface Image
public void invert()
public boolean isRaw()
Image
public void keepOnlyDifferingPixels(Image other, int threshold)
keepOnlyDifferingPixels
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 Image
public void multiply(double f)
public void multiplyWeighted(double f)
public void multiply(Image other)
Image
public void multiply(Image other, double f1, double f2)
public void nearestExtremeFilter(int halfWidth, javax.swing.ProgressMonitor monitor)
nearestExtremeFilter
in interface Image
public 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 Image
public void replaceBrighterPixels(Image source)
replaceBrighterPixels
in interface Image
public void rotate(Angle angle)
public void save(java.lang.String filePath)
public void save(java.lang.String filePath, RangeInt range)
public void save(java.lang.String filePath, RangeDouble range)
public void saveAsFITS(java.lang.String filePath)
saveAsFITS
in interface Image
public void scale(double factor, boolean interpolating)
public void scale(double factor, boolean interpolating, java.awt.Point centre)
public java.awt.image.BufferedImage scaleDownForDisplay(int factor)
scaleDownForDisplay
in interface Image
public final void set(java.awt.image.BufferedImage bim) throws IncompatibleImageException
set
in interface Image
IncompatibleImageException
public void setPixel(int x, int y, int[] px)
public void setPixel(int x, int y, int band, int px)
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 Image
public void showInfo()
public Image[] splitChannels()
splitChannels
in interface Image
public Image[] splitIntensity()
splitIntensity
in interface Image
public void subtract(Image other) throws IncompatibleImageException
subtract
in interface Image
IncompatibleImageException
public void subtractToZero(Image other) throws IncompatibleImageException
subtractToZero
in interface Image
IncompatibleImageException
public void swapQuadrants()
swapQuadrants
in interface Image
swapQuadrants
in class ImageBase
public ByteMask threshold(Threshold thresh)
public java.lang.String toString()
public java.lang.String toFoldedString(java.lang.String lineEnd)
Image
toFoldedString
in interface Image
public void translate(int dx, int dy)
public void translate(double dx, double dy)
public void varianceFilter(int halfWidth, javax.swing.ProgressMonitor monitor)
varianceFilter
in interface Image