jpiv2
Class PivImg

java.lang.Object
  extended by jpiv2.PivImg

public class PivImg
extends java.lang.Object

A double frame pixel image representation. This class provides methods for reading, writing and processing double frame pixel images. The pixel data is always converted to float, regardless of the original data type. This is at cost of performance, but it guarantees high accuracy and decreases the danger of data overflow while keeping the code clean and transparent.


Field Summary
static int R00256
          Normalization between 0 and 256 counts grey value (bandwidth 256 counts).
static int R00512
          Normalization between 0 and 512 counts grey value (bandwidth 256 counts).
static int R01024
          Normalization between 0 and 1024 counts grey value (bandwidth 256 counts).
static int R02048
          Normalization between 0 and 2048 counts grey value (bandwidth 256 counts).
static int R04096
          Normalization between 0 and 4096 counts grey value (bandwidth 256 counts).
static int R08192
          Normalization between 0 and 8192 counts grey value (bandwidth 256 counts).
static int R16384
          Normalization between 0 and 16384 counts grey value (bandwidth 256 counts).
static int R32768
          Normalization between 0 and 32768 counts grey value (bandwidth 256 counts).
static int R65536
          Normalization between 0 and 65536 counts grey value (bandwidth 256 counts).
static int RMIN_MAX
          Normalization between minimum and maximum grey value (bandwidth 256 pixels).
 
Constructor Summary
PivImg(JPiv jpiv, java.lang.String pathname)
          Creates a new instance of PivImg.
PivImg(JPiv jpiv, java.lang.String[] filelist, java.lang.String pathname)
          Creates a new instance o PivImg by summing up a number of images.
PivImg(JPiv jpiv, java.lang.String pathnameA, java.lang.String pathnameB)
          Creates a new instance of PivImg by combining two single image files to a double frame image.
 
Method Summary
 java.awt.image.BufferedImage getAsBufferedImage()
          Get the image as a BufferedImage.
 javax.media.jai.PlanarImage getAsPlanarImageByte(int range, float zoom)
          Get the image as a PlanarImage of 8 bit greyscale resolution.
 javax.media.jai.PlanarImage getAsPlanarImageFloat()
          Get the image as a PlanarImage.
 float[][] getDataFloat(int x, int y, int w, int h, int frame)
          Returns the pixels for a specified rectangle in a float array, one greyvalue per array element.
 java.lang.String getFilename()
          Get the filename of this image.
 int getHeight()
          Get height of the image.
 float getIntensityAt(int x, int y)
          Get the greyvalue at a certain position.
 javax.media.jai.PlanarImage getSubImage(float x, float y, int dx, int dy, float xShear, float yShear, int frame)
          Get a region of the image.
 javax.media.jai.PlanarImage getSubImage(float x, float y, int dx, int dy, int frame)
          Get a region of the image (interpolated).
 javax.media.jai.PlanarImage getSubImage(int x, int y, int dx, int dy, int frame)
          Get a region of the image
 int getWidth()
          Get the widht of the image.
 void normalize(float dynRange)
          Normalize the image.
 void writePivImageToFile(java.lang.String format, java.lang.String filename)
          Export the image.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

R00256

public static final int R00256
Normalization between 0 and 256 counts grey value (bandwidth 256 counts).

See Also:
Constant Field Values

R00512

public static final int R00512
Normalization between 0 and 512 counts grey value (bandwidth 256 counts).

See Also:
Constant Field Values

R01024

public static final int R01024
Normalization between 0 and 1024 counts grey value (bandwidth 256 counts).

See Also:
Constant Field Values

R02048

public static final int R02048
Normalization between 0 and 2048 counts grey value (bandwidth 256 counts).

See Also:
Constant Field Values

R04096

public static final int R04096
Normalization between 0 and 4096 counts grey value (bandwidth 256 counts).

See Also:
Constant Field Values

R08192

public static final int R08192
Normalization between 0 and 8192 counts grey value (bandwidth 256 counts).

See Also:
Constant Field Values

R16384

public static final int R16384
Normalization between 0 and 16384 counts grey value (bandwidth 256 counts).

See Also:
Constant Field Values

R32768

public static final int R32768
Normalization between 0 and 32768 counts grey value (bandwidth 256 counts).

See Also:
Constant Field Values

R65536

public static final int R65536
Normalization between 0 and 65536 counts grey value (bandwidth 256 counts).

See Also:
Constant Field Values

RMIN_MAX

public static final int RMIN_MAX
Normalization between minimum and maximum grey value (bandwidth 256 pixels).

See Also:
Constant Field Values
Constructor Detail

PivImg

public PivImg(JPiv jpiv,
              java.lang.String pathname)
Creates a new instance of PivImg.

Parameters:
jpiv - The parent component.
pathname - The complete pathname of a pixel image.

PivImg

public PivImg(JPiv jpiv,
              java.lang.String pathnameA,
              java.lang.String pathnameB)
Creates a new instance of PivImg by combining two single image files to a double frame image.

Parameters:
jpiv - The parent component.
pathnameA - The complete pathname of the upper pixel image.
pathnameB - The complete pathname of the lower pixel image.

PivImg

public PivImg(JPiv jpiv,
              java.lang.String[] filelist,
              java.lang.String pathname)
Creates a new instance o PivImg by summing up a number of images.

Parameters:
jpiv - The parent component.
filelist - A list of pixel image pathnames.
pathname - Destination path for the new image.
Method Detail

getFilename

public java.lang.String getFilename()
Get the filename of this image.

Returns:
The name of this file, not the path.

getAsBufferedImage

public java.awt.image.BufferedImage getAsBufferedImage()
Get the image as a BufferedImage.

Returns:
A BufferedImage.

getAsPlanarImageFloat

public javax.media.jai.PlanarImage getAsPlanarImageFloat()
Get the image as a PlanarImage.

Returns:
A PlanarImage.

getAsPlanarImageByte

public javax.media.jai.PlanarImage getAsPlanarImageByte(int range,
                                                        float zoom)
Get the image as a PlanarImage of 8 bit greyscale resolution.

Parameters:
zoom - The magnification factor of the image.
range - The image is normalized on this greyscale band. Possible values are defined by the following constants:
R00256 = 8 bit
R00512 = 9 bit
R01024 = 10 bit
R02048 = 11 bit
R04096 = 12 bit
R08192 = 13 bit
R16384 = 14 bit
R32768 = 15 bit
R65536 = 16 bit
RMIN_MAX = normalize between minimum and maximum;
Returns:
The normalized 8 bit PlanarImage.

getIntensityAt

public float getIntensityAt(int x,
                            int y)
Get the greyvalue at a certain position.

Parameters:
x - The x coordinate (zero top left).
y - The y coordinate (zero top left).
Returns:
The greyvalue.

normalize

public void normalize(float dynRange)
Normalize the image.

Parameters:
dynRange - The maximum value of the normalized image.

getWidth

public int getWidth()
Get the widht of the image.

Returns:
The width of the image in pixel.

getHeight

public int getHeight()
Get height of the image.

Returns:
The height of the image in pixel. If the image consists of two frames, this is the height of a frame times two.

getDataFloat

public float[][] getDataFloat(int x,
                              int y,
                              int w,
                              int h,
                              int frame)
Returns the pixels for a specified rectangle in a float array, one greyvalue per array element.

Parameters:
x - The x-coordinate of the upper-left pixel location.
y - The y-coordinate of the upper-left pixel location.
w - Width of the pixel rectangle.
h - Height of the pixel rectangle.
frame - Specifies the first or second frame in case of a double frame image.
Returns:
The greyvalues for the specified rectangle of pixels (float[height][width]).

getSubImage

public javax.media.jai.PlanarImage getSubImage(int x,
                                               int y,
                                               int dx,
                                               int dy,
                                               int frame)
                                        throws java.lang.IllegalArgumentException
Get a region of the image

Parameters:
x - Horizontal origin of the sub-image.
y - Vertical origin of the sub-image.
dx - Width of the sub-image.
dy - Height of the sub-image.
frame - First frame (0) or second frame (1).
Returns:
The sub-image.
Throws:
java.lang.IllegalArgumentException - if the region specified is outside the image.

getSubImage

public javax.media.jai.PlanarImage getSubImage(float x,
                                               float y,
                                               int dx,
                                               int dy,
                                               int frame)
                                        throws java.lang.IllegalArgumentException
Get a region of the image (interpolated).

Parameters:
x - Horizontal origin of the sub-image.
y - Vertical origin of the sub-image.
dx - Width of the sub-image.
dy - Height of the sub-image.
frame - First frame (0) or second frame (1).
Returns:
The sub-image.
Throws:
java.lang.IllegalArgumentException - if the region specified is outside the image.

getSubImage

public javax.media.jai.PlanarImage getSubImage(float x,
                                               float y,
                                               int dx,
                                               int dy,
                                               float xShear,
                                               float yShear,
                                               int frame)
                                        throws java.lang.IllegalArgumentException
Get a region of the image.

Parameters:
x - Horizontal origin of the sub-image.
y - Vertical origin of the sub-image.
dx - Width of the sub-image.
dy - Height of the sub-image.
frame - First frame (0) or second frame (1).
xShear - Horizontal shear value (which is basically the tangens of the shear-angle).
yShear - Vertical shear value.
Returns:
The sub-image.
Throws:
java.lang.IllegalArgumentException - if the region specified is outside the image.

writePivImageToFile

public void writePivImageToFile(java.lang.String format,
                                java.lang.String filename)
Export the image.

Parameters:
format - One of the supported format strings like 'png', 'jpg', 'tif' etc.
filename - Complete destination path.