4.5.4 - Image Collector - JdlImageCollector

John W. Campbell

4.5.4.1 Introduction

This class provides an object to add together (and average) or 'overlay' a set of X-ray diffraction images. It is compatible with the JdlDiffractionImage class and has an option to write out an image file in the same format that the JdlDiffractionImage class uses. It is assumed that, when adding images, the summed intensities can be held within a signed (4 byte) integer variable.

Class, constructors and methods:

Class Details
Accessible Fields
Constructor
Gather images
Write image

4.5.4.2 Class Details

Package:
Jdl.JdlPX;
Class name:
JdlImageCollector
Class definition:
public class JdlImageCollector
Extends:
Object
Implements:
none
Actions:
none

4.5.4.3 Accessible Fields

No fields with public, package or protected access defined.

4.5.4.4 Constructor

4.5.4.4.1 Introduction

A single constructor creates an empty JdlImageCollector object.

Constructor:

Constructor

4.5.4.4.2 Constructor

Sets up an empty JdlImageCollector object.

Constructor Definition:
public JdlImageCollector()
Parameters List:
none

4.5.4.5 Gather images

4.5.4.5.1 Introduction

This section has methods to clear the image data, add images or overlay images. Added images may be averaged.

Methods:

Clear images - clearImages
Add image - addImage
Add image - addImage
Overlay image - overlayImage
Overlay image - overlayImage
Average images - averageImages
Get image data object - getJdlImageData

4.5.4.5.2 Clear images - clearImages

This method clears the object for re-use.

Method Definition:
public void clearImages()
Parameters List:
none

4.5.4.5.3 Add image - addImage

This method adds an image from a JdlDiffractionImage object.

Method Definition:
public boolean addImage(JdlDiffractionImage img, JdlError jerr)
Parameters List:
img
The JdlDiffractionImage object with the image.
jerr
An error return object. If an error was found, jerr.err will be set to true, an error message will be returned in jerr.msg1 and the flag jerr.flag will be set as follows:
= 1, Dimensions of new image incompatible with stored image. (size, data order)
= 2, Integer limit exceeded. Values accumnulated are too large to enable another image to be added.
Method Return:
Error flag, true if error, false if OK.

4.5.4.5.4 Add image - addImage

This method adds an image as indicated by a JdlImageData object.

Method Definition:
public boolean addImage(JdlImageData imgd, JdlError jerr)
Parameters List:
imgd
The JdlImageData object with the image details.
jerr
An error return object. If an error was found, jerr.err will be set to true, an error message will be returned in jerr.msg1 and the flag jerr.flag will be set as follows:
= 1, Dimensions of new image incompatible with stored image. (size, data order)
= 2, Integer limit exceeded. Values accumnulated are too large to enable another image to be added.
Method Return:
Error flag, true if error, false if OK.

4.5.4.5.5 Overlay image - overlayImage

This method overlays an image from a JdlDiffractionImage object. This means that, for each pixel, the currently stored value is replaced by the maximum of the currently stored value and the new image value. If no image is currently present, the image will become the initial stored image.

Method Definition:
public boolean overlayImage(JdlDiffractionImage img, JdlError jerr)
Parameters List:
img
The JdlDiffractionImage object with the image.
jerr
An error return object. If an error was found, jerr.err will be set to true, an error message will be returned in jerr.msg1 and the flag jerr.flag will be set as follows:
= 1, Dimensions of new image incompatible with stored image. (size, data order)
Method Return:
Error flag, true if error, false if OK.

4.5.4.5.6 Overlay image - overlayImage

This method overlays an image as indicated by a JdlImageData object. This means that, for each pixel, the currently stored value is replaced by the maximum of the currently stored value and the new image value. If no image is currently present, the image will become the initial stored image.

Method Definition:
public boolean overlayImage(JdlImageData imgd, JdlError jerr)
Parameters List:
imgd
The JdlImageData object with the image details.
jerr
An error return object. If an error was found, jerr.err will be set to true, an error message will be returned in jerr.msg1 and the flag jerr.flag will be set as follows:
= 1, Dimensions of new image incompatible with stored image. (size, data order)
Method Return:
Error flag, true if error, false if OK.

4.5.4.5.7 Average images - averageImages

This method averages the currently stored images (the pixel values are divided (integer division) by the number of images added by the addImage(..) methods.

Method Definition:
public void averageImages()
Parameters List:
none

4.5.4.5.8 Get image data object - getJdlImageData

Return a JdlImageData object based on the currently stored image data. This is used as as input for the JdlPXImage image display object of the JdlView package. Note that the stored image data array is not copied.

Method Definition:
public JdlImageData getJdlImageData()
Parameters List:
none
Method Return:
The JdlImageData object.

4.5.4.6 Write image

4.5.4.6.1 Introduction

This section has methods to write the stored image to a file in the special 'wi' format used by the JdlDiffractionImage object.

Methods:

Write image - writeImageFile
Write image - writeImageFile

4.5.4.6.2 Write image - writeImageFile

Write the image to a named file.

Method Definition:
public int writeImageFile (String filnam, JdlProgressHandler progress) throws MalformedURLException, FileNotFoundException, IOException
Parameters List:
filnam
The file name.
progress
JdlProgressHandler object to monitor file writing (may be null if not required).
Method Return:
Error flag: = -1, No stored image
= 0, OK
> 0, Error writing the record indicated by this number

4.5.4.6.3 Write image - writeImageFile

Write the image to a data output stream. THe output stream will be closed

Method Definition:
public int writeImageFile (DataOutputStream dout, JdlProgressHandler progress) throws IOException
Parameters List:
dout
The data output stream (preferably buffered).
progress
JdlProgressHandler object to monitor file writing (may be null if not required).
Method Return:
Error flag: = -1, No stored image
= 0, OK
> 0, Error writing the record indicated by this number

⇑ Up 2   ⇑ Up 1   ⇑ Top of this