H5TiffIO Class Reference

General IO class for TIFF images. More...

List of all members.

Public Member Functions

 H5TiffIO (hid_t fileId)
virtual ~H5TiffIO ()
void setFileId (hid_t fileId)
herr_t importTiff (const std::string &filename, hid_t groupId, const std::string &datasetName, bool asGrayscale=true)
 imports a Tiff image into the MXADataModel
herr_t exportTiff (hid_t fileId, const std::string &filename, const std::string &img_dataset_name)
 exports a TIFF image from the MXADataModel
void extractTiffTagContents (ITiffTagExtractor *extractor)
 Extracts the contents of a tag using an instance of ITiffTagExtractor.

Protected Types

enum  tiffImageClasses {
  UnknownTiffImage = -1, BilevelTiffImage = 0, GrayscaleTiffImage, PaletteColorTiffImage,
  RGBFullColorTiffImage, FacsimileTiffImage, SeparatedTiffImage, YCbCrTiffImage
}

Protected Member Functions

int32 _determineTiffImageClass (TIFF *in)
 Determines the image class for a given tiff image.
int32 _determineTiffOutputImageClass (hid_t fileId, const string &img_dataset_name)
 Determines the value of the "Class" attribute for the image.
herr_t _importGrayscaleTiffImage (TIFF *in, hid_t groupId, const std::string &datasetName)
 Reads a grayscale tiff file and stores the image as raw 8 bit values in the given dataset inside the give group.
herr_t _importPaletteColorTiff (TIFF *in, hid_t groupId, const std::string &datasetName)
 Reads a grayscale tiff file and stores the image as raw 8 bit values in the given dataset inside the give group.
herr_t _importRGBFullColorTiff (TIFF *in, hid_t groupId, const std::string &datasetName)
 Reads a true color tiff file and stores the image as raw rgb values in the given dataset inside the give group.
herr_t _exportGrayScaleTiff (TIFF *image, uint8 *data, hsize_t width, hsize_t height, const std::string &documentName, const std::string &imageDescription)
 Writes a tiff image as a grayscale image HDF5 dataset.
herr_t _exportRGBFullColorTiff (TIFF *out, hid_t fileId, const std::string &img_dataset_name, hsize_t width, hsize_t height, hsize_t planes, hssize_t numpalettes, const std::string &interlace)
 Exports an Image data set as a true color tiff file.

Protected Attributes

hid_t _fileId
TIFF * _tiff

Private Member Functions

int32 _findColorMapIndex (int max, int32 imgR, int32 imgG, int32 imgB, unsigned char *colorMap)
void _closePaletteCreatedDataset (hid_t fileId, hid_t groupId, string datasetName, int32 num_attrs)


Detailed Description

General IO class for TIFF images.

Author:
Mike Jackson/Shawn Nicholson
Date:
March 2007
Version:
Revision
1.2


Member Enumeration Documentation

enum H5TiffIO::tiffImageClasses [protected]

Enumerator:
UnknownTiffImage 
BilevelTiffImage 
GrayscaleTiffImage 
PaletteColorTiffImage 
RGBFullColorTiffImage 
FacsimileTiffImage 
SeparatedTiffImage 
YCbCrTiffImage 


Constructor & Destructor Documentation

H5TiffIO::H5TiffIO ( hid_t  fileId  )  [explicit]

H5TiffIO::~H5TiffIO (  )  [virtual]


Member Function Documentation

void H5TiffIO::setFileId ( hid_t  fileId  )  [inline]

herr_t H5TiffIO::importTiff ( const std::string &  filename,
hid_t  groupId,
const std::string &  datasetName,
bool  asGrayscale = true 
)

imports a Tiff image into the MXADataModel

Parameters:
filename The absolute path to the Tiff file
groupId The HDF Group/FileId to store the imported data
datasetName The Name of the HDF5 dataset to store the data
asGrayscale Should the tiff be stored as a grayscale image
Returns:
Error < 0 Error

herr_t H5TiffIO::exportTiff ( hid_t  fileId,
const std::string &  filename,
const std::string &  img_dataset_name 
)

exports a TIFF image from the MXADataModel

Parameters:
fileId - the hdf fileID
filename - the output file to write the tiff to
img_dataset_name - the image dataset in the XMData file

void H5TiffIO::extractTiffTagContents ( ITiffTagExtractor extractor  ) 

Extracts the contents of a tag using an instance of ITiffTagExtractor.

Parameters:
extractor An Instance of an ITiffTagExtractor class

int H5TiffIO::_determineTiffImageClass ( TIFF *  in  )  [protected]

Determines the image class for a given tiff image.

Parameters:
in The Tiff Image
Returns:
element from tiffImageClasses enum

int H5TiffIO::_determineTiffOutputImageClass ( hid_t  fileId,
const string &  img_dataset_name 
) [protected]

Determines the value of the "Class" attribute for the image.

Parameters:
fileId The HDF5 file id
img_dataset_name The path to the dataset
Returns:
One of the enumerated types from tiffImageClasses.

herr_t H5TiffIO::_importGrayscaleTiffImage ( TIFF *  in,
hid_t  groupId,
const std::string &  datasetName 
) [protected]

Reads a grayscale tiff file and stores the image as raw 8 bit values in the given dataset inside the give group.

Parameters:
in The Tiff Image
groupId The HDF location identifier of the group into which to store the image data
datasetName The name to store the data under in the HDF5 file.
Returns:
Error < 0 Error

herr_t H5TiffIO::_importPaletteColorTiff ( TIFF *  in,
hid_t  groupId,
const std::string &  datasetName 
) [protected]

Reads a grayscale tiff file and stores the image as raw 8 bit values in the given dataset inside the give group.

Parameters:
in The Tiff Image
groupId The HDF location identifier of the group into which to store the image data
datasetName The name to store the data under in the HDF5 file.
Returns:
Error < 0 Error

herr_t H5TiffIO::_importRGBFullColorTiff ( TIFF *  in,
hid_t  groupId,
const std::string &  datasetName 
) [protected]

Reads a true color tiff file and stores the image as raw rgb values in the given dataset inside the give group.

Parameters:
in The Tiff Image
groupId The HDF location identifier of the group into which to store the image data
datasetName The name to store the data under in the HDF5 file.
Returns:
Error < 0 Error

herr_t H5TiffIO::_exportGrayScaleTiff ( TIFF *  image,
uint8 *  data,
hsize_t  width,
hsize_t  height,
const std::string &  documentName,
const std::string &  imageDescription 
) [protected]

Writes a tiff image as a grayscale image HDF5 dataset.

Parameters:
image The TIFF image pointer
data The tiff data to be written
width The width of the image
height The height of the image
documentName The name of the file
imageDescription A short description to be added to the file
Returns:
Standard HDF5 error condition

herr_t H5TiffIO::_exportRGBFullColorTiff ( TIFF *  out,
hid_t  fileId,
const std::string &  img_dataset_name,
hsize_t  width,
hsize_t  height,
hsize_t  planes,
hssize_t  numpalettes,
const std::string &  interlace 
) [protected]

Exports an Image data set as a true color tiff file.

Parameters:
out The Tiff file to write the data into
fileId The HDF5 file_id value
img_dataset_name The Name of the data set
width The width of the image
height The heigth of the image
planes The number of planes in the image
numpalettes The number of palettes from the image
interlace The interlace mode of the image
Returns:
Negative value on error

int32 H5TiffIO::_findColorMapIndex ( int  max,
int32  imgR,
int32  imgG,
int32  imgB,
unsigned char *  colorMap 
) [private]

void H5TiffIO::_closePaletteCreatedDataset ( hid_t  fileId,
hid_t  groupId,
string  datasetName,
int32  num_attrs 
) [private]


Member Data Documentation

hid_t H5TiffIO::_fileId [protected]

TIFF* H5TiffIO::_tiff [protected]


The documentation for this class was generated from the following files:
Generated on Tue Nov 17 18:43:12 2009 for MXADataModel by  doxygen 1.5.2