public class ImageTools
extends java.lang.Object
Constructor and Description |
---|
ImageTools() |
Modifier and Type | Method and Description |
---|---|
static java.awt.Point |
backTransformCoordinate(ImageEvent<?> image,
java.awt.Point transCoords)
Inverse operation to transformCoordinate().
|
static java.awt.image.BufferedImage |
cloneImage(java.awt.image.BufferedImage bufferedImage)
Clones a buffered image.
|
static int[][] |
getHistogram(java.awt.image.BufferedImage bufferedImage,
int numBins)
Generates a histogram for the given image.
|
static int[][] |
getHistogram(ImageEvent<?> imageEvent,
int numBins)
Generates a histogram for the given image.
|
static long |
getMaximalPixelValue(java.awt.image.BufferedImage bufferedImage)
Returns the maximal intensity a pixel in the image can have.
|
static java.awt.image.BufferedImage |
getMicroscopeImage(ImageEvent<?> imageEvent)
Creates an image from microscope supplied data.
|
static java.awt.image.BufferedImage |
getMicroscopeImage(ImageEvent<?> imageEvent,
java.awt.image.BufferedImage bufferedImage)
Creates an image from microscope supplied data, and saves it in the provided image.
|
static long |
getPixelValue(java.awt.image.BufferedImage bufferedImage,
int x,
int y)
Returns the intensity of the pixel at the (zero based) x and y position in original coordinates.
|
static long |
getPixelValue(ImageEvent<?> image,
int x,
int y)
Returns the intensity of the pixel at the (zero based) x and y position in original coordinates.
|
static java.awt.image.BufferedImage |
getScaledImage(java.awt.image.BufferedImage bufferedImage,
float lowerCutoff,
float upperCutoff,
java.awt.image.BufferedImage returnVal)
Returns a scaled version of the image.
|
static java.awt.image.BufferedImage |
getScaledMicroscopeImage(ImageEvent<?> imageEvent)
Creates an image from microscope supplied data.
|
static java.awt.image.BufferedImage |
getScaledMicroscopeImage(ImageEvent<?> imageEvent,
float lowerCutoff,
float upperCutoff)
Creates an image from microscope supplied data.
|
static java.awt.image.BufferedImage |
getScaledMicroscopeImage(ImageEvent<?> imageEvent,
float lowerCutoff,
float upperCutoff,
java.awt.image.BufferedImage bufferedImage)
Creates an image from microscope supplied data, and saves it in the provided image.
|
static ImageEvent<?> |
toYouScopeImage(java.awt.image.BufferedImage image)
Converts a BufferedImage to YouScope's internal raw + meta data format.
|
static java.awt.Point |
transformCoordinate(ImageEvent<?> image,
java.awt.Point orgCoords)
Translates the (zero based) coordinates in the not transposed and not switched coordinate system (as the image is obtained from the
camera) to the new coordinate system, in which the image axes are eventually transposed and/or switched.
|
public static ImageEvent<?> toYouScopeImage(java.awt.image.BufferedImage image) throws ImageConvertException
image
- The image which should be converted.ImageConvertException
public static java.awt.image.BufferedImage getMicroscopeImage(ImageEvent<?> imageEvent, java.awt.image.BufferedImage bufferedImage) throws ImageConvertException
imageEvent
- The raw image data and metadata supplied by the microscope.bufferedImage
- The image in which the data should be saved in, or null to create a new image.ImageConvertException
public static java.awt.image.BufferedImage getMicroscopeImage(ImageEvent<?> imageEvent) throws ImageConvertException
imageEvent
- The raw image data and metadata supplied by the microscope.ImageConvertException
public static java.awt.image.BufferedImage getScaledMicroscopeImage(ImageEvent<?> imageEvent, float lowerCutoff, float upperCutoff) throws ImageConvertException
imageEvent
- The raw image data and metadata supplied by the microscope.lowerCutoff
- The lower cutoff for pixel grayness.upperCutoff
- The upper cutoff for pixel grayness.ImageConvertException
public static java.awt.image.BufferedImage cloneImage(java.awt.image.BufferedImage bufferedImage)
bufferedImage
- The image to clone.public static java.awt.image.BufferedImage getScaledImage(java.awt.image.BufferedImage bufferedImage, float lowerCutoff, float upperCutoff, java.awt.image.BufferedImage returnVal)
bufferedImage
- The buffered image to transform.lowerCutoff
- Lower cutoff (0<=lowerCutoffupperCutoff
- Upper cutoff (0<=lowerCutoffreturnVal
- Image to save the result in, or null to create new image. Note: the function might save the resulting image in this variable, or might not, depending on if returnVal is suited.public static long getPixelValue(ImageEvent<?> image, int x, int y)
image
- The image from which the pixel intensity should be extracted.x
- The x position of the pixel (0<=xy
- The y position of the pixel (0<=ypublic static java.awt.Point transformCoordinate(ImageEvent<?> image, java.awt.Point orgCoords)
image
- The image in which the coordinates are given.orgCoords
- The original coordinates.public static java.awt.Point backTransformCoordinate(ImageEvent<?> image, java.awt.Point transCoords)
image
- The image in which the coordinates are given.transCoords
- The transformed coordinatespublic static java.awt.image.BufferedImage getScaledMicroscopeImage(ImageEvent<?> imageEvent, float lowerCutoff, float upperCutoff, java.awt.image.BufferedImage bufferedImage) throws ImageConvertException
imageEvent
- The raw image data and metadata supplied by the microscope.lowerCutoff
- The lower cutoff for pixel grayness.upperCutoff
- The upper cutoff for pixel grayness.bufferedImage
- The image in which the data should be saved in, or null to create a new image.ImageConvertException
public static long getPixelValue(java.awt.image.BufferedImage bufferedImage, int x, int y)
bufferedImage
- The image from which the pixel intensity should be extracted.x
- The x position of the pixel (0<=xy
- The y position of the pixel (0<=ypublic static long getMaximalPixelValue(java.awt.image.BufferedImage bufferedImage)
bufferedImage
- The image from which the maximal pixel intensity should be returned.public static int[][] getHistogram(java.awt.image.BufferedImage bufferedImage, int numBins) throws ImageConvertException
bufferedImage
- The buffered image, either stored as byte or short gray image, or int RGB/BGR image.numBins
- The number of bins the histogram should have.ImageConvertException
public static int[][] getHistogram(ImageEvent<?> imageEvent, int numBins) throws ImageConvertException
imageEvent
- The raw image data and metadata supplied by the microscope.numBins
- The number of bins the histogram should have.ImageConvertException
public static java.awt.image.BufferedImage getScaledMicroscopeImage(ImageEvent<?> imageEvent) throws ImageConvertException
imageEvent
- The raw image data and metadata supplied by the microscope.ImageConvertException