4.6.3 - Basic Image Reader - JdlBasicImageReader

John W. Campbell

4.6.3.1 Introduction

This class is used to read an X-ray diffraction image in one of a number of basic formats which have one or more header records followed by the binary image data records where all records are the same length. The details of the image size, data order and pixels' format need to be specified either via the initial constructor or using a method to set the relevant parameters directly or read them from a so called 'SPDFIL' file (as used by CCP4 IPDISP program). The object may then be passed to a method which accepts, as a parameter, an object implementing the 'JdlImageReader' interface.

Class, constructors and methods:

Class Details
Accessible Fields
Constructors
Methods

4.6.3.2 Class Details

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

4.6.3.3 Accessible Fields

No fields with public, package or protected access defined.

4.6.3.4 Constructors

4.6.3.4.1 Introduction

Two constructors are available to construct a JdlBasicImageReader object either with default parameters or with a full set of parameters describing the image format. In the former case, the setFormatParameters(..) or readSpdfilParameters(..) method must be called before the object is used by an image file reading object.

Constructors:

Constructor 1
Constructor 2

4.6.3.4.2 Constructor 1

Create a JdlBasicImageReader object with a default set of image format parameters. Note: these correspond to a 1200*1200 pixel image with no header and with each pixel stored as a two byte unsigned integer which does not require any byte swapping or re-ordering.

Constructor Definition:
public JdlBasicImageReader ()
Parameters List:
none

4.6.3.4.3 Constructor 2

Create a JdlBasicImageReader object with the given set of image format parameters.

Constructor Definition:
public JdlBasicImageReader (int lhead, int lrec, int nax1_rasts, int nax2_rasts, int order, int typ, boolean check_pack, boolean swap, double ax1_pixsiz, double ax2_pixsiz, int null_pixel, int ovld_pixel)
Parameters List:
lhead
No. of header records or -(number of bytes of header info).
lrec
Length of records in bytes (for filtyp 0 only) - may give zero if record length can be calculated
nax1_rasts
Number of rasters along the first local axis
nax2_rasts
Number of rasters along the second local axis
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)
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
check_pack
If true, check to see if this is a (CCP4) packed (compressed) image and, if so process it as such, otherwise treat it as an unpacked image. If found to be packed, lrec, lhead and swap will no longer be used for reading this image file.
swap
Byte swap data =true yes, =false no.
ax1_pixsiz
Pixel size in mm along first local axis.
ax2_pixsiz
Pixel size in mm along second local axis.
null_pixel
Value of a null (unrecorded) pixel.
ovld_pixel
Value of an overload pixel (0 if not set)

4.6.3.5 Methods

4.6.3.5.1 Introduction

This section has methods to set the image file format parameters explicitly or read them form a 'SPDFIL' file.

Methods:

Set format parameters - setFormatParameters
Read SPDFIL file - readSpdfil

4.6.3.5.2 Set format parameters - setFormatParameters

This method sets the image format parameters explicitly.

Method Definition:
public void setFormatParameters (int lhead, int lrec, int nax1_rasts, int nax2_rasts, int order, int typ, boolean check_pack, boolean swap, double ax1_pixsiz, double ax2_pixsiz, int null_pixel, int ovld_pixel)
Parameters List:
lhead
No. of header records or -(number of bytes of header info).
lrec
Length of records in bytes (for filtyp 0 only) - may give zero if record length can be calculated
nax1_rasts
Number of rasters along the first local axis
nax2_rasts
Number of rasters along the second local axis
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)
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
check_pack
If true, check to see if this is a (CCP4) packed (compressed) image and, if so process it as such, otherwise treat it as an unpacked image. If found to be packed, lrec, lhead and swap will no longer be used for reading this image file.
swap
Byte swap data =true yes, =false no.
ax1_pixsiz
Pixel size in mm along first local axis.
ax2_pixsiz
Pixel size in mm along second local axis.
null_pixel
Value of a null (unrecorded) pixel.
ovld_pixel
Value of an overload pixel (0 if not set)

4.6.3.5.3 Read SPDFIL file - readSpdfil

This method reads a 'SPDFIL' file to determine and set the relevant image file format parameters prior to an image being read. Note: SPDFIL files for this method may not contain the 'mar' or 'ovf' keywords; MAR image files should be handled using the JdlMarImageReader class.

Method Definition:
public void readSpdfil (String spdfil) throws MalformedURLException, FileNotFoundException, IOException
Parameters List:
spdfil
The name of the SPDFIL file. This may either be the name of a local file or a URL.

⇑ Up 2   ⇑ Up 1   ⇑ Top of this