Table of Contents

NAME

QccHYPRaw - routines for reading and writing raw binary files typical of hyperspectral applications

SYNOPSIS

#include "libQccPack.h"

int QccHYPRawRead2D(QccString filename, QccIMGImageComponent *image_component, int bpp, int signed_data, int endian);
int QccHYPRawWrite2D(QccString filename, const QccIMGImageComponent *image_component, int bpp, int endian);
int QccHYPRawRead3D(QccString filename, QccIMGImageCube *image_cube, int bpv, int signed_data, int format, int endian);
int QccHYPRawWrite3D(QccString filename, const QccIMGImageCube *image_cube, int bpv, int format, int endian);

DESCRIPTION

QccPack provides data structure routines for reading and writing raw binary files that are typically used and produced by hyperspectral applications. Both 2D and 3D data files with arbitrary byte order are supported. For 3D datasets, the three popular scan orders (BSQ, BIL, BIP) are supported.

FILE FORMAT

Hyperspectral applications typically use files that are stored in raw binary format without any headers. Each sample value is a binary number which is stored in the raw-format file in either 1, 2, or 4 consecutive bytes in either big-endian (most-significant byte first) or little-endian (least-significant byte first) order.

For 2D files, it is assumed that the pixels are stored in row-major order; i.e., pixels are ordered such that rows are stored one after the other. The loop order for outer to inner is: row, column.

For 3D files, samples (voxels) are stored in one of the following orders:

Band Sequential (BSQ) -
entire spectral bands are stored one after another. The loop order (outer to inner) is: band, row, col.
Band Interleaved by Line (BIL) -
entire lines from each band are stored one after another. The loop order is: row, band, col.
Band Interleaved by Pixel (BIP) -
entire pixels are stored one after another. The loop order is: row, col, band.

Note that AVIRIS data is typically BIP, while TRWIS uses BIL. QccPack's ICB format for the QccIMGImageCube(3) structure uses BSQ.

Note that, internally, QccPack refers to spectral bands as "frames" as the QccIMGImageCube(3) structure originally was deployed for video data in which the third dimension represents temporal frames. Thus, routines often refer to num_frames as the size in the third dimension.

ROUTINES

QccHYPRawRead2D() reads the 2D raw file with the indicated filename, returning it in image_component, which must be allocated beforehand. The size of image_component indicates how many values to read from the file. QccHYPRawRead3D() operates similarly, reading into the 3D image_cube.

QccHYPWrite2D() writes values from image_component to the 2D raw file given by filename. QccHYPWrite3D() operates similarly, writing from the 3D image_cube.

In all of these routines, the parameters bpp (2D files) or bpv (3D files) specify the number of bits that each pixel or voxel value contains, respectively; these values must be between 1 and 32. If bpp or bpv is <= 8, then each sample is stored as the least significant bits in a single byte; otherwise, if bpp or bpv is <= 16, then each sample is stored as the least significant bits of two consecutive bytes; otherwise, if bpp or bpv is <= 32, then each sample is stored as the least significant bits of four consecutive bytes. signed_data indicates whether the sample values are signed or not; likewise, endian, which is one of QCCHYP_RAWENDIAN_BIG or QCCHYP_RAWENDIAN_LITTLE, indicates the endianness of the binary values. For 3D reading and writing, format must be one of QCCHYP_RAWFORMAT_BSQ, QCCHYP_RAWFORMAT_BIL, or QCCHYP_RAWFORMAT_BIP to indicate the scan order of the 3D file.

RETURN VALUE

These routines return 0 on success, and 1 on failure.

SEE ALSO

QccHYPRawDist2D(3) , QccHYPRawDist3D(3) , QccPackHYP(3) , QccPack(3)

AUTHOR

Copyright (C) 1997-2021 James E. Fowler


Table of Contents



Get QccPack at SourceForge.net. Fast, secure and Free Open Source software downloads