Lispixrawreadr
Purpose
Import Lispix Raw formatted image.
Synopsis
- imagedso = lispixrawreadr(filename)
In Solo+MIA, or from the Analysis window, this may be accessed using the menu: "File"->"Import Data"->"X-Block"->"Lispix Raw Formatted Image (RAW)", and selecting the file to import.
Description
Read in a Lispix Raw image file. The .raw data file consists of an uncompressed string of numbers all saved in the same format, for example one byte per number.
.raw and .rpl Files
It is necessary to have a second file which describes the layout of the raw data file contents. Thus, the file format consists of two files: a data file (.raw) and a raw parameter list file (.rpl). It is assumed that the two files are named the same thing with only the extension being different. The filename input to LISPIXRAWREADR can point to either the .raw or the .rpl file.
Note that this file format is different from the Physical Electronics .raw file and also different from the RAW files output by some digital cameras.
The Lispix RAW file format is described at: http://www.nist.gov/lispix/doc/image-file-formats/raw-file-format.htm Please see this for details of the .raw and .rpl file formats.
Standard LISPIX Parameters in .rpl File
A typical .rpl file contain 9 lines, where there is one tab (and possibly extra spaces) between the parameter name and parameter value. Parameter names are case-insensitive. The first line is "key <tab> value", and the following 8 lines identify parameters and their values in the form <param-name> <tab> <param-value>. For example:
key value width 849 height 846 depth 4096 offset 0 data-length 1 data-type unsigned byte-order dont-care record-by vector
This .rpl file indicates the image is 849 pixels wide and 846 pixels high, with 4096 levels in the depth dimension.
Additional Parameters
In addition to these 8 Lispix standard parameter names the LISPIXRAWREADR importer recognizes the following non-standard parameters names which may be specified to allow reading only a sub-rectangle of the image in height and width and reducing the resolution in the depth dimension. This is useful when reading large images on a system with a small amount of memory (RAM). These additional parameter names are:
- depthbinsize : number of points per bin in the depth dimension. For example, a value of 4 means the depth dimension is reduced by x4.
- width1 : lower width pixel
- width2 : upper width pixel. Read data between width1 and width2 in the width dimension.
- height1 : lower height pixel.
- height2 : upper height pixel. Read data between height1 and height2 in the height dimension.
- depthscaleorigin : Origin of axisscale for depth dimension
- depthscaleincrement : Increment for depth axisscale
- depthscaleunits : Units symbol for depth axisscale
The compression in the depth dimension is achieved by averaging bins of "depthbindsize" points.
The following lines could be added to the example .rpl file above to read a sub-rectangle of the image and to reduce the depth dimension by a factor of 20:
depthbinsize 20 width1 200 width2 600 height1 200 height2 500 depthscaleorigin 0 depthscaleincrement 0.02 depthscaleunits keV
For this example LISPIXRAWREADR loads an image dataset object where the image size is 301x401 (301 pixesl high, 401 pixels wide) and 205 layers deep (4096/20, rounded). An axis scale is specified for the depth dimension which ranges from 0 to 81.92 (=4096*0.02), with units of "keV".
Inputs
- filename = file name to read, either the .raw or .rpl file.
Outputs
- imagedso = an image DataSet object containing the image read from the input file.