# ReadPicData

### Synopsis

> Reads a Bio-Rad PIC file and outputs the dimensions and data array.

>       group ReadPicData {
>         string filename;

>         file FILE {
>           name => <-.filename;
>         };

>         ReadPicDims ReadPicDims {
>           filename=> <-.filename;
>         };

>         int dims[3] => ReadPicDims.dims;
>         byte data[prod(dims)] => cache(file_obj(.FILE,76,1,,1));
>       };

### Description

> The ReadPicData module reads a Bio-Rad PIC file and outputs the dimensions of the data and an array containing the image data. These outputs can then be combined using a `uniform_scalar_field` module to create field data that can then be visualized using any of the standard modules. The dimensions are output as an array of integers and the data is output as an array of bytes. The module will only handle 8-bit images. 16-bit and 24-bit images are not handled correctly. Any notes appended to PIC files are also ignored.

> Bio-Rad PIC files contain 3D confocal microscope images, i.e. 3D scalar uniform fields. However 3D confocal microscope images are usually anisotropic i.e. the x-y scale is different from the z scale. In this case the `scale` module can be used to alter the scaling of the resultant field data. For more information please see the NOTE file.

### Input

> &filename

> The name of the file that should be read from. This parameter is of type string. The ReadPicData module does not check to ensure that the supplied file is a valid Bio-Rad PIC file. If the file is not valid then errors could occur.

### Low-Level Module

> ReadPicDims

> An internal module, written in C, that reads the image dimensions from the input file. The read dimensions are then used to determine the amount of image data that should be read from the input file and to generate the uniform field. The dimensions are 16 bit long values. These values are read into a variable of type short. If the length of the short type on your system is not 16 bits long then the module may need alteration. The `ReadPicDims` module also performs the necessary byte swapping so that the module can be used on both big and little endian systems.

### Outputs

> dims[3]

> This array contains the dimensions of the Bio-Rad PIC image. The array is of type int. The dimensions can be used directly by field mapping modules to help generate AVS field data. The dimensions are read by the `ReadPicDims` module and are cast from the original short values to the int values that AVS/Express uses.

> data[]

> This array contains the data read from the Bio-Rad PIC file. The array is of type byte. The length of the array is calculated from the dimensions read by the `ReadPicDims` module. The data is actually read by the standard file I/O modules present in AVS/Express.

### Utility Macros

> The low-level ReadPicData module is used in the User Macro readBRPic. This module be used directly in applications. The readBRPic macro also uses the ReadBRPicUI UI macro. The ReadPicData module uses the ReadPicDims module.

### Example

> An example application ReadBRPicEg is provided that reads a Bio-Rad PIC file and produces a maximum intensity projection. A sample Bio-Rad PIC file flea3.pic is provided with the distribution of this module.

### Files

> iac_proj/rd_brpic/rdbrmods.v contains the ReadPicData and ReadPicDims module V definitions.

### Other Notes

> The low-level ReadBRPicMods library containing the module ReadPicDims does not specify a process. By default the express process will be used.

### Authors

>     Chris Pudney

>     Biomedical Confocal Microscopy Research Centre
>     Department of Pharmacology
>     The University of Western Australia
>     Nedlands, W.A. 6907
>     AUSTRALIA

>     E-mail: cpudney@alphapharm.pharm.uwa.edu.au
>     Phone, Fax: (+61 8) 9346 4571, (+618) 9346 3469

### Modifications

>     Andrew Dodd
>     Joanna Leng

### Contact

>     International AVS Centre
>     Manchester Visualization Centre
>     Manchester Computing
>     University of Manchester
>     Oxford Road
>     Manchester
>     United Kingdom
>     M13 9PL

### See Also

> readBRPic, ReadPicDims, ReadBRPicEg, read_BioRad_PIC (AVS5 IAC module)