4.5.2 - Diffraction Image - JdlDiffractionImage

John W. Campbell

4.5.2.1 Introduction

This class provides an object to read in, store and manipulate the data of an X-ray diffraction image (esp. Protein Crystallographic).

Class, constructor and methods:

Class Details
Accessible Fields
Constructor
Read Diffraction Image
Image Data for Display
Set Image Data
Minimum and Maximum Values
Get Image Parts
Background Image Calculation
Write Image Option
Service Methods

4.5.2.2 Class Details

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

4.5.2.3 Accessible Fields

No fields with public, package or protected access defined.

4.5.2.4 Constructor

4.5.2.4.1 Introduction

A single constructor is available.

Constructor:

Standard constructor

4.5.2.4.2 Standard constructor

Constructs an empty JdlDiffractionImage object.

Constructor Definition:
public JdlDiffractionImage()
Parameters List:
none

4.5.2.5 Read Diffraction Image

4.5.2.5.1 Introduction

This section has a single method to read an image file and store the image data internally.

Methods:

Read image file - readImage

4.5.2.5.2 Read image file - readImage

This method reads in an image from a file using an object which implements the JdlImageReader class. A security exception is returned here as an IOException and it may be worthwhile printing the message associated with an IOException as the image readers may set this message in some cases.

Method Definition:
public void readImage(JdlImageReader image_reader, String filnam, JdlProgressHandler progress) throws MalformedURLException, FileNotFoundException, IOException
Parameters List:
image_reader
An object implementing the JdlImageReader class for the required image file type.
filnam
The image file name. This may either be the name of a local file or a URL. (Note: URL input may not necessarily be allowed for all JdlImageReader implementing classes)
progress
JdlProgressHandler object to monitor file reading (may be null if not required and may not necessarily be serviced by all JdlImageReader implementing classes).

4.5.2.6 Image Data for Display

4.5.2.6.1 Introduction

This section has a single method to get an object for image input to the JdlPXImage object of the JdlView package.

Method:

Get image data object - getJdlImageData

4.5.2.6.2 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.2.7 Set Image Data

4.5.2.7.1 Introduction

This section has a method to store an image contained in an array into the JdlDiffractionImage object as an alternative to reading the image data from a file.

Method:

Set image data - setImageData

4.5.2.7.2 Set image data - setImageData

This method stores an image contained in an array into the JdlDiffractionImage object as an alternative to reading the image data from a file. Details of the image to be stored are given in a JdlImageData object. The image data is stored in the same format as input though it may be copied if required. Note that the minimum and maximum values will be determined by this method, so need not be set in the JdlImageData object. A background image may also be stored using this method.

Method Definition:
public void setImageData(JdlImageData imgd, boolean copy, int set)
Parameters List:
imgd
A JdlImageData object containing the details of the image to be set. The minimum and maximum pixel values are assumed to be set.
copy
If true a copy of the image data array is made, if false only a reference to the image data array is stored.
set
Images to be set flag:
= 0, Set both the image and background image if present.
= 1, Set the main image only.
= 2, Set the background image only.
Note that, for option 2, the background image will only be set if the numbers or rasters for the full image, the data order and the data type are the same as those for the stored image.

4.5.2.8 Minimum and Maximum Values

4.5.2.8.1 Introduction

This section has methods to find the minimum and maximum values in the stored image and to return these values and to return the maximum possible value which may be stored for the current or given type of image.

Methods:

Set minimum and maximum values - setMinMaxValues
Get minimum value - getMinimumValue
Get maximum value - getMaximumValue
Get maximum storeable value - maximumStoreableValue
Get maximum storeable value - maximumStoreableValue

4.5.2.8.2 Set minimum and maximum values - setMinMaxValues

This method finds the minimum and maximum values in the stored image.

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

4.5.2.8.3 Get minimum value - getMinimumValue

This method returns the stored minimum pixel value.

Method Definition:
public int getMinimumValue()
Parameters List:
none
Method Return:
The minimum pixel value

4.5.2.8.4 Get maximum value - getMaximumValue

This method returns the stored minimum pixel value.

Method Definition:
public int getMaximumValue()
Parameters List:
none
Method Return:
The maximum pixel value

4.5.2.8.5 Get maximum storeable value - maximumStoreableValue

This method returns the maximum storeable pixel value for the image type currently stored.

Method Definition:
public int maximumStoreableValue()
Parameters List:
none
Method Return:
The maximum storeable value

4.5.2.8.6 Get maximum storeable value - maximumStoreableValue

This method returns the maximum storeable pixel value for a requested image storage type.

Method Definition:
public static int maximumStoreableValue(int type)
Parameters List:
type
The storage type:
= 1, unsigned byte data
= 2, unsigned two-byte data = 3, signed integer data = 4, 'squashed i2' data if stored I<0 ipix = -i*8) = 5, 'squashed i2' data if stored I<0 ipix = (I+32768)*8 = 6, 'squashed i2' data if stored I<0 ipix = (I+32768)*32 = 7, 'squashed i2' data if stored I<0 ipix = -(I+1)*256 + 32768
Method Return:
The maximum storeable value (0 if unknown type)

4.5.2.9 Get Image Parts

4.5.2.9.1 Introduction

This section has methods to get a rectangle or line of data from an image. All data are returned in integer arrays. There are methods for returning the parts of the image from the internally stored image or from an external image.

Methods:

Get section - getSection
Get section - getSection
Get local axis 1 line - getAxis1Line
Get local axis 1 line - getAxis1Line
Get local axis 2 line - getAxis2Line
Get local axis 2 line - getAxis2Line
Get pixel - getPixel
Get pixel - getPixel

4.5.2.9.2 Get section - getSection

This method returns a rectangular section from the stored image in a two dimensional integer array.

Method Definition:
public int[][] getSection(int iax1_orig, int iax2_orig, int nax1, int nax2, int ioutlim, JdlError jerr)
Parameters List:
iax1_orig
The origin pixel of the required section along the first local axis.
iax2_orig
The origin pixel of the required section along the second local axis.
nax1
Size of the section in pixels along the first local axis.
nax2
Size of the section in pixels along the second local axis.
ioutlim
Value to which returned data pixels are to be set if they lie outside the image.
jerr
Error handling object. If an error was found 'jerr.err' will be returned as true, a message will be returned in 'jerr.msg1' and 'jerr.flag' will be set as follows:
Return: Error flag:
= 0, OK
= 1, Rectangle partly outside image
= 2, Rectangle totally outside image
Method Return:
A 2-D integer array containing the required image section, the firstr dimension is for local axis 1 and the second dimension is for local axis 2. (Returns null if no image present)

4.5.2.9.3 Get section - getSection

This static method returns a rectangular section from an image in a two dimensional integer array.

Method Definition:
public static int[][] getSection(JdlImageData imgd, int iax1_orig, int iax2_orig, int nax1, int nax2, int ioutlim, JdlError jerr)
Parameters List:
imgd
JdlImageData object containing details of the image.
iax1_orig
The origin pixel of the required section along the first local axis.
iax2_orig
The origin pixel of the required section along the second local axis.
nax1
Size of the section in pixels along the first local axis.
nax2
Size of the section in pixels along the second local axis.
ioutlim
Value to which returned data pixels are to be set if they lie outside the image.
jerr
Error handling object. If an error was found 'jerr.err' will be returned as true, a message will be returned in 'jerr.msg1' and 'jerr.flag' will be set as follows:
Return: Error flag:
= 0, OK
= 1, Rectangle partly outside image
= 2, Rectangle totally outside image
Method Return:
A 2-D integer array containing the required image section, the first dimension is for local axis 1 and the second dimension is for local axis 2.

4.5.2.9.4 Get local axis 1 line - getAxis1Line

This method returns a line of data from the stored image along the direction of the first local axis.

Method Definition:
public int[] getAxis1Line(int iax1_orig, int iax2_orig, int nax1, int ioutlim, JdlError jerr)
Parameters List:
iax1_orig
The origin pixel of the required line along the first local axis.
iax2_orig
The origin pixel of the required line along the second local axis.
nax1
Size of the line to be returned in pixels along the first local axis.
ioutlim
Value to which returned data pixels are to be set if they lie outside the image.
jerr
Error handling object. If an error was found 'jerr.err' will be returned as true, a message will be returned in 'jerr.msg1' and 'jerr.flag' will be set as follows:
Return: Error flag:
= 0, OK
= 1, Line partly outside image
= 2, Line totally outside image
Method Return:
An int[] array containing the required nax1 pixels. Returns null if no image present.

4.5.2.9.5 Get local axis 1 line - getAxis1Line

This static method returns a line of data from an image along the direction of the first local axis.

Method Definition:
public static int[] getAxis1Line(JdlImageData imgd, int iax1_orig, int iax2_orig, int nax1, int ioutlim, JdlError jerr)
Parameters List:
imgd
JdlImageData object containing details of the image.
iax1_orig
The origin pixel of the required line along the first local axis.
iax2_orig
The origin pixel of the required line along the second local axis.
nax1
Size of the line to be returned in pixels along the first local axis.
ioutlim
Value to which returned data pixels are to be set if they lie outside the image.
jerr
Error handling object. If an error was found 'jerr.err' will be returned as true, a message will be returned in 'jerr.msg1' and 'jerr.flag' will be set as follows:
Return: Error flag:
= 0, OK
= 1, Line partly outside image
= 2, Line totally outside image
Method Return:
An int[] array containing the required nax1 pixels.

4.5.2.9.6 Get local axis 2 line - getAxis2Line

This method returns a line of data from the stored image along the direction of the second local axis.

Method Definition:
public int[] getAxis2Line(int iax1_orig, int iax2_orig, int nax2, int ioutlim, JdlError jerr)
Parameters List:
iax1_orig
The origin pixel of the required line along the first local axis.
iax2_orig
The origin pixel of the required line along the second local axis.
nax2
Size of the line to be returned in pixels along the second local axis.
ioutlim
Value to which returned data pixels are to be set if they lie outside the image.
jerr
Error handling object. If an error was found 'jerr.err' will be returned as true, a message will be returned in 'jerr.msg1' and 'jerr.flag' will be set as follows:
Return: Error flag:
= 0, OK
= 1, Line partly outside image
= 2, Line totally outside image
Method Return:
An int[] array containing the required nax2 pixels. Returns null if no image present.

4.5.2.9.7 Get local axis 2 line - getAxis2Line

This static method returns a line of data from an image along the direction of the second local axis.

Method Definition:
public static int[] getAxis2Line(JdlImageData imgd, int iax1_orig, int iax2_orig, int nax2, int ioutlim, JdlError jerr)
Parameters List:
imgd
JdlImageData object containing details of the image.
iax1_orig
The origin pixel of the required line along the first local axis.
iax2_orig
The origin pixel of the required line along the second local axis.
nax2
Size of the line to be returned in pixels along the second local axis.
ioutlim
Value to which returned data pixels are to be set if they lie outside the image.
jerr
Error handling object. If an error was found 'jerr.err' will be returned as true, a message will be returned in 'jerr.msg1' and 'jerr.flag' will be set as follows:
Return: Error flag:
= 0, OK
= 1, Line partly outside image
= 2, Line totally outside image
Method Return:
An int[] array containing the required nax2 pixels.

4.5.2.9.8 Get pixel - getPixel

This method returns a pixel from the stored image.

Method Definition:
public int getPixel (int iax1_pix, int iax2_pix, int ioutlim, JdlError jerr)
Parameters List:
iax1_pix
The pixel position along the first local axis.
iax2_pix
The pixel position along the second local axis.
ioutlim
Value to which returned data pixel is to be set if it lie outsides the image.
jerr
Error handling object. If an error was found 'jerr.err' will be returned as true, a message will be returned in 'jerr.msg1' and 'jerr.flag' will be set as follows:
Return: Error flag:
= 0, OK
= 1, Pixel outside image
Method Return:
The pixel. -1 if no image present.

4.5.2.9.9 Get pixel - getPixel

This static method returns a pixel from an image.

Method Definition:
public static int getPixel (JdlImageData imgd, int iax1_pix, int iax2_pix, int ioutlim, JdlError jerr)
Parameters List:
imgd
JdlImageData object containing details of the image.
iax1_pix
The pixel position along the first local axis.
iax2_pix
The pixel position along the second local axis.
ioutlim
Value to which returned data pixel is to be set if it lie outsides the image.
jerr
Error handling object. If an error was found 'jerr.err' will be returned as true, a message will be returned in 'jerr.msg1' and 'jerr.flag' will be set as follows:
Return: Error flag:
= 0, OK
= 1, Pixel outside image
Method Return:
The pixel

4.5.2.10 Background Image Calculation

4.5.2.10.1 Introduction

This section contains methods to calculate a background image from an single crystal X-ray diffraction image. One method calculates the background image from the stored image; the other method is a static method enabling the calculation of a background image from image data stored in an array (byte, short or int). This methods assume an image with spots over a fairly slowly changing background. The procedure calculates the background at a pixel by taking the average of the lowest pixel values in a box surrounding the pixel such that the number of such values is a requested percentage of the total number of pixels in the box. To optimise the calculation, the box is walked through the image moving a pixel at a time starting at the top left. It then repeats the process of left from to right, then one pixel down, then from right to left, and then one pixel down etc. until the image has been covered. (In this description the slow moving image index is visualised as being from top to bottom and the fast one from left to right). The methods will cope with a maximum background level up to around 65000.

Methods:

Calculate background image - backgroundImage
Calculate background image - calculateBackgroundImage

4.5.2.10.2 Calculate background image - backgroundImage

This method calculates a background image from the stored image if one is present.

Method Definition:
public boolean backgroundImage(int nbcmp, int npbox, int percent, JdlProgressHandler progress, JdlError errh)
Parameters List:
nbcmp
Compress (sample) nbcmp pixels into 1 pixel in each direction for background image.
npbox
Size, in pixels, of box (after compression of the image) for each background calculation (box is npbox*npbox) - preferably an odd number.
percent
Percentage of pixels within a box to treat as background. If -percent is given, then pixel values of zero will be omitted from the calculation.
progress
JdlProgressHandler object to monitor the progress of the background image calculation. (may be null if not required).
errh
Error handling object. If an error was found 'errh.err' will be returned as true, messages will be returned in 'errh.msg1' (and 'errh.msg2' and 'errh.flag' will be set as follows:
= -1, No image present
= 1, Background too high (>65000) for the image
= 2, Requested box too big for the image
Method Return:
True if OK, false if error (see errh for details).

4.5.2.10.3 Calculate background image - calculateBackgroundImage

This method calculates a background image from an image passed to the method in a byte, short or int array.

Method Definition:
public static int calculateBackgroundImage (Object img, int type, int ns_rasts, int nf_rasts, int bgcmp, int npbox, int percent, int null_pixel, Object img_bg, JdlProgressHandler progress)
Parameters List:
img
The array containing the image data.
type
Data type (Image and backgound image):
= 1, unsigned byte data (typ must also be 1)
= 2, unsigned two-byte data (i2)
= 3, signed integer data (i4)
= 4, 'squashed i2' data; if stored I<0 ipix = -i*8
= 5, 'squashed i2' data; if stored I<0 ipix = (I+32768)*8
= 6, 'squashed i2' data; if stored I<0 ipix = (I+32768)*32
= 7, 'squashed i2' data; if stored I<0 ipix = -(I+1)*256 + 32768
= 0, Picture (RGB) image - black background will be returned
ns_rasts
Number of slow moving rasters in the image.
nf_rasts
Number of fast moving rasters in the image.
bgcmp
Compress (sample) nbcmp pixels into 1 pixel in each direction for background image.
npbox
Size, in pixels, of box (after compression of the image) for each background calculation (box is npbox*npbox) - preferably an odd number.
percent
Percentage of pixels within a box to treat as background. If -percent is given, then pixel values of zero will be omitted from the calculation.
null_pixel
Value of a null (unrecorded) pixel.
img_bg
Array in which to return the background image in same data format as the input image. The size of the background image will be ns_rasts/bgcmp * nf_rasts/bgcmp (integer divisions).
progress
JdlProgressHandler object to monitor the progress of the background image calculation. (may be null if not required).
errh
Error handling object. If an error was found 'errh.err' will be returned as true, messages will be returned in 'errh.msg1' (and 'errh.msg2' and 'errh.flag' will be set as follows:
= -1, No image present
= 1, Background too high (>65000) for the image
= 2, Requested box too big for the image
Method Return:
True if OK, false if error (see errh for details).

4.5.2.11 Write Image Option

4.5.2.11.1 Introduction

This section contains methods to write an image file in a format used for this class, the JdlCollectImages class and the PXImage program.

Method:

Write image - writeImageFile
Write image - writeImageFile
Write image - writeImageFile

4.5.2.11.2 Write image - writeImageFile

This method writes a file with the currently stored image in 'wi' format.

Method Definition:
public int writeImageFile (String filnam, JdlProgressHandler progress) throws MalformedURLException, FileNotFoundException, IOException
Parameters List:
filnam
The required 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.2.11.3 Write image - writeImageFile

This method writes a file with with image data passed to the method. The image file is written in in 'wi' format.

Method Definition:
public static int writeImageFile (String filnam, JdlImageData imgd, JdlProgressHandler progress) throws MalformedURLException, FileNotFoundException, IOException
Parameters List:
filnam
The required file name.
imgd
A JdlImageData object with details of the image to be written and a reference to the array containing the pixels data.
progress
JdlProgressHandler object to monitor file writing (may be null if not required).
Method Return:
Error flag: = 0, OK
> 0, Error writing the record indicated by this number

4.5.2.11.4 Write image - writeImageFile

This class method writes a file with image data passed to the method. The image file is written in in 'wi' format.

Method Definition:
public static int writeImageFile (DataOutputStream dout, JdlImageData imgd, JdlProgressHandler progress) throws IOException
Parameters List:
dout
An output DataOutputStream (preferably buffered) to which the file is to be written.
imgd
A JdlImageData object with details of the image to be written and a reference to the array containing the pixels data.
progress
JdlProgressHandler object to monitor file writing (may be null if not required).
Method Return:
Error flag: = 0, OK
> 0, Error writing the record indicated by this number

4.5.2.12 Service Methods

4.5.2.12.1 Introduction

This section has some static methods which may be useful for a programmer who needs to create new image reading classes. They are used in some of the current classes provided.

Methods:

Read image data - readImageData
Unsquash pixel intensity - unsquash
Squash pixel intensity - squash
Get PF intensity - imgByteLog
Unpack image - unpackImage
Unpack CBF image - unpackSigned32bitCBF

4.5.2.12.2 Read image data - readImageData

This method can be used for reading image data for certain categories of image file or re-ordering image data from an image already stored in an array. It is used in the coding of some of standard JdlImageReader supporting classes currently available and may be of use in coding other similar classes. It is thus a specialist method, not intended for general use.

Method Definition:
public static void readImageData (boolean read_file, Object fil_img, Object img_array, int out_typ, int typ, int order, boolean swap, int nax1_rasts, int nax2_rasts, int recl, JdlProgressHandler progress, int[] outvals) throws IOException
Parameters List:
read_file
Read file or image data flag:
= true, Read from file
= false, Read from image array
filimg
Either a FileInputStream (if reading from a file) or an array of type byte[], short[] or int[] containing the image data as indicated by the 'typ' parameter (byte[] if typ=1, int[] if typ=3 or short[] for other values of 'typ').
img_array
Array dimensioned to [nax1_rasts*nax2_rasts] of type byte[], short[] or int[] depending on the value of the 'out_typ' parameter (byte[] if out_typ=1, int[] if out_typ=3 or short[] for other values of 'out_typ').
out_typ
Format required for internally stored image data:
= 1, unsigned byte data (typ must also be 1)
= 2, unsigned two-byte data (i2)
= 3, signed integer data (i4)
= 4, 'squashed i2' data; if stored I<0 ipix = -i*8
= 5, 'squashed i2' data; if stored I<0 ipix = (I+32768)*8
= 6, 'squashed i2' data; if stored I<0 ipix = (I+32768)*32
= 7, 'squashed i2' data; if stored I<0 ipix = -(I+1)*256 + 32768
typ
Format of input image pixels data (for filtyp==0 - otherwise ignored):
= 1, unsigned byte data
= 2, unsigned two-byte data (i2)
= 3, signed integer data (i4)
= 4, 'squashed i2' data; if stored I<0 ipix = -i*8
= 5, 'squashed i2' data; if stored I<0 ipix = (I+32768)*8
= 6, 'squashed i2' data; if stored I<0 ipix = (I+32768)*32
= 7, 'squashed i2' data if stored I<0 ipix = -(I+1)*256 + 32768
= 8, Photon factory byte data on a log scale
order
Order of the data in the input image with respect to two local axes ax1, ax2 e.g. (xf, yf) as a number from 1 to 8.
   1   +ax1 slow   +ax2 fast    (+xf, +yf)
   2   +ax1 slow   -ax2 fast    (+xf, -yf)
   3   -ax1 slow   +ax2 fast    (-xf, +yf)
   4   -ax1 slow   -ax2 fast    (-xf, -yf)
   5   +ax2 slow   +ax1 fast    (+yf, +xf)
   6   +ax2 slow   -ax1 fast    (+yf, -xf)
   7   -ax2 slow   +ax1 fast    (-yf, +xf)
   8   -ax2 slow   -ax1 fast    (-yf, -xf)
Note that if a value of 1 is input, the data will not be re-ordered. This may be used either if the data is already in that order or if it is to be read without changing the order. For values greater than 1, the data will be re-ordered to match the order specified by order=1.
swap
Byte swap data =true yes, =false no. For reading from a file if 'typ>1'.
nax1_rasts
Number of rasters along the first local axis (for filtyp 0,1,2).
nax2_rasts
Number of rasters along the second local axis (for filtyp 0,1,2).
recl
Length of records in bytes (for filtyp 0 only) - may give zero if record length can be calculated internally from the numbers of rasters parameters and data type assuming no padding.
progress
JdlProgressHandler object to monitor file reading (may be null if not required).
outvals
Three integer array. On return from the method, outvals[0] will hold the minimum pixel value, outvals[1] will hold the maximum pixel value and outvals[2] will have the value of 1 if values which overflowed the format were found (these are reset to the maximum storeable value) or 0 otherwise.

4.5.2.12.3 Unsquash pixel intensity - unsquash

This method unsquashes a pixel intensity packed into a short (signed) integer.

Method Definition:
public static int unsquash (int unsq, short ipx)
Parameters List:
unsq
The type of squashed data to be unpacked:
= 1, Get intensity value from unsigned 'i2' pixel
= 2, Get intensity value from 'squashed i2' pixel; I<0 ipx = -i*8
= 3, Get intensity value from 'squashed i2' pixel; I<0 ipx = (I+32768)*8
= 4, Get intensity value from 'squashed i2' pixel I<0 ipx = (I+32768)*32
= 5, Get intensity value from 'squashed i2' pixel I<0 ipx = -(I+1)*256 + 32768
ipx
The short integer containing the packed integer value.
Method Return:
The unpacked pixel intensity.

4.5.2.12.4 Squash pixel intensity - squash

This method squashes (packs) a pixel intensity into a short (signed) integer.

Method Definition:
public static short squash (int sqsh, int ipx, JdlBoolean ovfl)
Parameters List:
sqsh
The type of packing:
= 1, Set intensity value in unsigned 'i2' pixel
= 2, Set intensity value in 'squashed i2' pixel; I<0 sqshpix = -i*8
= 3, Set intensity value in 'squashed i2' pixel; I<0 sqshpix = (I+32768)*8
= 4, Set intensity value in 'squashed i2' pixel I<0 sqshpix = (I+32768)*32
= 5, Set intensity value in 'squashed i2' pixel I<0 sqshpix = -(I+1)*256 + 32768
ipx
The integer containing the integer (intensity) value to be packed.
ovfl
Overflow flag. The value in this JdlBoolean object will be returned as true if the intensity given exceeds the range available in the packed form; in this case the returned squashed intensity will correspond to the maximum possible value for the packing type. If the intensity is within the allowed range, the value in the 'ovfl' object with be returned as false (i.e. no overflow).
Method Return:
The packed pixel intensity in a short signed integer.

4.5.2.12.5 Get PF intensity - imgByteLog

This method gets the intensity value from Photon Factory log byte data. (Transcribed from 1993 'C' code of Jan Pieter Abrahams)

Method Definition:
public static int imgByteLog (byte ipx)
Parameters List:
ipx
The byte containing the intensity in log byte form.
Method Return:
The unpacked intensity value.

4.5.2.12.6 Unpack image - unpackImage

This method unpacks a compressed image as used by CCP4. (Derived from 1993 'C' code of Jan Pieter Abrahams)

Method Definition:
public static int unpackImage (BufferedInputStream bis, int[] img) throws IOException
Parameters List:
bis
Buffered input stream for reading image data.
img
Array into which uncompressed image is to be returned.
Method Return:
Packed image version number (1 or 2); 0 if the string 'ccp4 packed image' is not found in the header.

4.5.2.12.7 Unpack CBF image - unpackSigned32bitCBF

This method unpacks compressed image data from a CBF image binary data section stored as CBF_PACKED with "signed 32-bit integer" elements.

Method Definition:
public static void unpackSigned32bitCBF(BufferedInputStream bis, int nslow, int nfast, int order, JdlProgressHandler progress, int ovld_val, int[] outvals, int nsamp, int[] img) throws IOException
Parameters List:
bis
Buffered input stream for reading image data.
nslow
The number of rasters in the slow moving index of the packed image.
nfast
The number of rasters in the fast moving index of the packed image.
order
Order of the data in the packed input image with respect to two local axes ax1, ax2 e.g. (xf, yf) as a number from 1 to 8.
   1   +ax1 slow   +ax2 fast    (+xf, +yf)
   2   +ax1 slow   -ax2 fast    (+xf, -yf)
   3   -ax1 slow   +ax2 fast    (-xf, +yf)
   4   -ax1 slow   -ax2 fast    (-xf, -yf)
   5   +ax2 slow   +ax1 fast    (+yf, +xf)
   6   +ax2 slow   -ax1 fast    (+yf, -xf)
   7   -ax2 slow   +ax1 fast    (-yf, +xf)
   8   -ax2 slow   -ax1 fast    (-yf, -xf)
Note that if a value of 1 is input, the data will not be re-ordered. This may be used either if the data is already in that order or if it is to be read without changing the order. For values greater than 1, the data will be re-ordered to match the order specified by order=1.
progress
JdlProgressHandler object to monitor file reading and unpacking (may be null if not required).
ovld_val
The overload intensity limit.
outvals
Three integer array. On return from the method, outvals[0] will hold the minimum pixel value, outvals[1] will hold the maximum pixel value and outvals[2] will have the value of 1 if values greater than or equal to the overload value were found or 0 otherwise. *@param nsamp A sampled image will be returned if nsamp>1 is given; the size of the returned image will be (nslow/nsamp)*(nfast/nsamp) rasters. (Set to 1 for return of full image)
img
Array into which unpacked image is to be returned.

⇑ Up 2   ⇑ Up 1   ⇑ Top of this