HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
ImageSpec Class Reference

#include <imageio.h>

Public Types

enum  SerialFormat { SerialText, SerialXML }
 
enum  SerialVerbose { SerialBrief, SerialDetailed, SerialDetailedHuman }
 

Public Member Functions

 ImageSpec (TypeDesc format=TypeDesc::UNKNOWN) noexcept
 
 ImageSpec (string_view format) noexcept
 
 ImageSpec (int xres, int yres, int nchans, TypeDesc fmt=TypeUInt8) noexcept
 
 ImageSpec (int xres, int yres, int nchans, string_view fmt) noexcept
 
 ImageSpec (const ROI &roi, TypeDesc fmt=TypeUInt8) noexcept
 
 ImageSpec (const ROI &roi, string_view fmt) noexcept
 
void set_format (TypeDesc fmt) noexcept
 
void set_format (string_view fmt) noexcept
 
void default_channel_names () noexcept
 
size_t channel_bytes () const noexcept
 
size_t channel_bytes (int chan, bool native=false) const noexcept
 
size_t pixel_bytes (bool native=false) const noexcept
 
size_t pixel_bytes (int chbegin, int chend, bool native=false) const noexcept
 
imagesize_t scanline_bytes (bool native=false) const noexcept
 
imagesize_t tile_pixels () const noexcept
 
imagesize_t tile_bytes (bool native=false) const noexcept
 
imagesize_t image_pixels () const noexcept
 
imagesize_t image_bytes (bool native=false) const noexcept
 
bool size_t_safe () const noexcept
 
void attribute (string_view name, TypeDesc type, const void *value)
 
void attribute (string_view name, unsigned int value)
 Add an unsigned int attribute to extra_attribs. More...
 
void attribute (string_view name, int value)
 Add an int attribute to extra_attribs. More...
 
void attribute (string_view name, float value)
 Add a float attribute to extra_attribs. More...
 
void attribute (string_view name, string_view value)
 Add a string attribute to extra_attribs. More...
 
void attribute (string_view name, TypeDesc type, string_view value)
 
void erase_attribute (string_view name, TypeDesc searchtype=TypeDesc::UNKNOWN, bool casesensitive=false)
 
ParamValuefind_attribute (string_view name, TypeDesc searchtype=TypeDesc::UNKNOWN, bool casesensitive=false)
 
const ParamValuefind_attribute (string_view name, TypeDesc searchtype=TypeDesc::UNKNOWN, bool casesensitive=false) const
 
const ParamValuefind_attribute (string_view name, ParamValue &tmpparam, TypeDesc searchtype=TypeDesc::UNKNOWN, bool casesensitive=false) const
 
TypeDesc getattributetype (string_view name, bool casesensitive=false) const
 
bool getattribute (string_view name, TypeDesc type, void *value, bool casesensitive=false) const
 
int get_int_attribute (string_view name, int defaultval=0) const
 
float get_float_attribute (string_view name, float defaultval=0) const
 
string_view get_string_attribute (string_view name, string_view defaultval=string_view()) const
 
std::string serialize (SerialFormat format, SerialVerbose verbose=SerialDetailed) const
 
std::string to_xml () const
 Converts the contents of the ImageSpec as an XML string. More...
 
void from_xml (const char *xml)
 Populates the fields of the ImageSpec based on the XML passed in. More...
 
std::pair< string_view, intdecode_compression_metadata (string_view defaultcomp="", int defaultqual=-1) const
 
bool valid_tile_range (int xbegin, int xend, int ybegin, int yend, int zbegin, int zend) noexcept
 
TypeDesc channelformat (int chan) const
 
string_view channel_name (int chan) const
 
void get_channelformats (std::vector< TypeDesc > &formats) const
 
int channelindex (string_view name) const
 
ROI roi () const noexcept
 Return pixel data window for this ImageSpec expressed as a ROI. More...
 
ROI roi_full () const noexcept
 Return full/display window for this ImageSpec expressed as a ROI. More...
 
void set_roi (const ROI &r) noexcept
 
void set_roi_full (const ROI &r) noexcept
 
void copy_dimensions (const ImageSpec &other)
 
bool undefined () const noexcept
 
AttrDelegate< ImageSpecoperator[] (string_view name)
 
AttrDelegate< const ImageSpecoperator[] (string_view name) const
 

Static Public Member Functions

static void auto_stride (stride_t &xstride, stride_t &ystride, stride_t &zstride, stride_t channelsize, int nchannels, int width, int height) noexcept
 
static void auto_stride (stride_t &xstride, stride_t &ystride, stride_t &zstride, TypeDesc format, int nchannels, int width, int height) noexcept
 
static void auto_stride (stride_t &xstride, TypeDesc format, int nchannels) noexcept
 
static std::string metadata_val (const ParamValue &p, bool human=false)
 

Public Attributes

ImageSpec data members

The ImageSpec contains data fields for the values that are required to describe nearly any image, and an extensible list of arbitrary attributes that can hold metadata that may be user-defined or specific to individual file formats.

Here are the hard-coded data fields:

int x
 origin (upper left corner) of pixel data More...
 
int y
 origin (upper left corner) of pixel data More...
 
int z
 origin (upper left corner) of pixel data More...
 
int width
 width of the pixel data window More...
 
int height
 height of the pixel data window More...
 
int depth
 depth of pixel data, >1 indicates a "volume" More...
 
int full_x
 origin of the full (display) window More...
 
int full_y
 origin of the full (display) window More...
 
int full_z
 origin of the full (display) window More...
 
int full_width
 width of the full (display) window More...
 
int full_height
 height of the full (display) window More...
 
int full_depth
 depth of the full (display) window More...
 
int tile_width
 tile width (0 for a non-tiled image) More...
 
int tile_height
 tile height (0 for a non-tiled image) More...
 
int tile_depth
 
int nchannels
 number of image channels, e.g., 4 for RGBA More...
 
TypeDesc format
 
std::vector< TypeDescchannelformats
 
std::vector< std::stringchannelnames
 
int alpha_channel
 
int z_channel
 
bool deep
 
ParamValueList extra_attribs
 

Detailed Description

ImageSpec describes the data format of an image – dimensions, layout, number and meanings of image channels.

The width, height, depth are the size of the data of this image, i.e., the number of pixels in each dimension. A depth greater than 1 indicates a 3D "volumetric" image. The x, y, z fields indicate the origin of the pixel data of the image. These default to (0,0,0), but setting them differently may indicate that this image is offset from the usual origin. Therefore the pixel data are defined over pixel coordinates [x ... x+width-1] horizontally, [y ... y+height-1] vertically, and [z ... z+depth-1] in depth.

The analogous full_width, full_height, full_depth and full_x, full_y, full_z fields define a "full" or "display" image window over the region [full_x ... full_x+full_width-1] horizontally, [full_y ... full_y+full_height-1] vertically, and [full_z... full_z+full_depth-1] in depth.

Having the full display window different from the pixel data window can be helpful in cases where you want to indicate that your image is a crop window of a larger image (if the pixel data window is a subset of the full display window), or that the pixels include overscan (if the pixel data is a superset of the full display window), or may simply indicate how different non-overlapping images piece together.

For tiled images, tile_width, tile_height, and tile_depth specify that the image is stored in a file organized into rectangular tiles of these dimensions. The default of 0 value for these fields indicates that the image is stored in scanline order, rather than as tiles.

Definition at line 243 of file imageio.h.

Member Enumeration Documentation

Enumerator
SerialText 
SerialXML 

Definition at line 647 of file imageio.h.

Enumerator
SerialBrief 
SerialDetailed 
SerialDetailedHuman 

Definition at line 648 of file imageio.h.

Constructor & Destructor Documentation

ImageSpec::ImageSpec ( TypeDesc  format = TypeDesc::UNKNOWN)
noexcept

Constructor: given just the data format, set all other fields to something reasonable.

ImageSpec::ImageSpec ( string_view  format)
inlinenoexcept

Constructor: given just the data format (as any type name recognized by the TypeDesc constructor), set all other fields to something reasonable.

Definition at line 320 of file imageio.h.

ImageSpec::ImageSpec ( int  xres,
int  yres,
int  nchans,
TypeDesc  fmt = TypeUInt8 
)
noexcept

Constructs an ImageSpec with the given x and y resolution, number of channels, and pixel data format.

All other fields are set to the obvious defaults – the image is an ordinary 2D image (not a volume), the image is not offset or a crop of a bigger image, the image is scanline-oriented (not tiled), channel names are "R", "G", "B"' and "A" (up to and including 4 channels, beyond that they are named "channel *n*"), the fourth channel (if it exists) is assumed to be alpha.

ImageSpec::ImageSpec ( int  xres,
int  yres,
int  nchans,
string_view  fmt 
)
inlinenoexcept

Construct an ImageSpec with the given x and y resolution, number of channels, and pixel data format name (as any type name recognized by the TypeDesc constructor).

Definition at line 336 of file imageio.h.

ImageSpec::ImageSpec ( const ROI roi,
TypeDesc  fmt = TypeUInt8 
)
explicitnoexcept

Construct an ImageSpec whose dimensions (both data and "full") and number of channels are given by the ROI, pixel data type by fmt, and other fields are set to their default values.

ImageSpec::ImageSpec ( const ROI roi,
string_view  fmt 
)
inlineexplicitnoexcept

Construct an ImageSpec from an ROI giving dimensions, and the name of a data type that will be recognized by the TypeDesc constructor.

Definition at line 346 of file imageio.h.

Member Function Documentation

void ImageSpec::attribute ( string_view  name,
TypeDesc  type,
const void value 
)

Add a metadata attribute to extra_attribs, with the given name and data type. The value pointer specifies the address of the data to be copied.

void ImageSpec::attribute ( string_view  name,
unsigned int  value 
)
inline

Add an unsigned int attribute to extra_attribs.

Definition at line 474 of file imageio.h.

void ImageSpec::attribute ( string_view  name,
int  value 
)
inline

Add an int attribute to extra_attribs.

Definition at line 479 of file imageio.h.

void ImageSpec::attribute ( string_view  name,
float  value 
)
inline

Add a float attribute to extra_attribs.

Definition at line 484 of file imageio.h.

void ImageSpec::attribute ( string_view  name,
string_view  value 
)
inline

Add a string attribute to extra_attribs.

Definition at line 489 of file imageio.h.

void ImageSpec::attribute ( string_view  name,
TypeDesc  type,
string_view  value 
)

Parse a string containing a textual representation of a value of the given type, and add that as an attribute to extra_attribs. Example:

spec.attribute ("temperature", TypeString, "-273.15");
static void ImageSpec::auto_stride ( stride_t xstride,
stride_t ystride,
stride_t zstride,
stride_t  channelsize,
int  nchannels,
int  width,
int  height 
)
inlinestaticnoexcept

Adjust the stride values, if set to AutoStride, to be the right sizes for contiguous data with the given format, channels, width, height.

Definition at line 440 of file imageio.h.

static void ImageSpec::auto_stride ( stride_t xstride,
stride_t ystride,
stride_t zstride,
TypeDesc  format,
int  nchannels,
int  width,
int  height 
)
inlinestaticnoexcept

Adjust the stride values, if set to AutoStride, to be the right sizes for contiguous data with the given format, channels, width, height.

Definition at line 454 of file imageio.h.

static void ImageSpec::auto_stride ( stride_t xstride,
TypeDesc  format,
int  nchannels 
)
inlinestaticnoexcept

Adjust xstride, if set to AutoStride, to be the right size for contiguous data with the given format and channels.

Definition at line 463 of file imageio.h.

size_t ImageSpec::channel_bytes ( ) const
inlinenoexcept

Returns the number of bytes comprising each channel of each pixel (i.e., the size of a single value of the type described by the format field).

Definition at line 367 of file imageio.h.

size_t ImageSpec::channel_bytes ( int  chan,
bool  native = false 
) const
noexcept

Return the number of bytes needed for the single specified channel. If native is false (default), compute the size of one channel of this->format, but if native is true, compute the size of the channel in terms of the "native" data format of that channel as stored in the file.

string_view ImageSpec::channel_name ( int  chan) const
inline

Return the channel name of the given channel. This is safe even if channelnames is not filled out.

Definition at line 697 of file imageio.h.

TypeDesc ImageSpec::channelformat ( int  chan) const
inline

Return the channelformat of the given channel. This is safe even if channelformats is not filled out.

Definition at line 690 of file imageio.h.

int ImageSpec::channelindex ( string_view  name) const

Return the index of the channel with the given name, or -1 if no such channel is present in channelnames.

void ImageSpec::copy_dimensions ( const ImageSpec other)
inline

Copy from other the image dimensions (x, y, z, width, height, depth, full*, nchannels, format) and data types. It does not copy arbitrary named metadata or channel names (thus, for an ImageSpec with lots of metadata, it is much less expensive than copying the whole thing with operator=()).

Definition at line 756 of file imageio.h.

std::pair<string_view, int> ImageSpec::decode_compression_metadata ( string_view  defaultcomp = "",
int  defaultqual = -1 
) const

Hunt for the "Compression" and "CompressionQuality" settings in the spec and turn them into the compression name and quality. This handles compression name/qual combos of the form "name:quality".

void ImageSpec::default_channel_names ( )
noexcept

Sets the channelnames to reasonable defaults for the number of channels. Specifically, channel names are set to "R", "G", "B," and "A" (up to and including 4 channels, beyond that they are named "channel*n*".

void ImageSpec::erase_attribute ( string_view  name,
TypeDesc  searchtype = TypeDesc::UNKNOWN,
bool  casesensitive = false 
)

Searches extra_attribs for any attributes matching name (as a regular expression), removing them entirely from extra_attribs. If searchtype is anything other than TypeDesc::UNKNOWN, matches will be restricted only to attributes with the given type. The name comparison will be case-sensitive if casesensitive is true, otherwise in a case-insensitive manner.

ParamValue* ImageSpec::find_attribute ( string_view  name,
TypeDesc  searchtype = TypeDesc::UNKNOWN,
bool  casesensitive = false 
)

Searches extra_attribs for an attribute matching name, returning a pointer to the attribute record, or NULL if there was no match. If searchtype is anything other than TypeDesc::UNKNOWN, matches will be restricted only to attributes with the given type. The name comparison will be exact if casesensitive is true, otherwise in a case-insensitive manner if caseinsensitive is false.

const ParamValue* ImageSpec::find_attribute ( string_view  name,
TypeDesc  searchtype = TypeDesc::UNKNOWN,
bool  casesensitive = false 
) const
const ParamValue* ImageSpec::find_attribute ( string_view  name,
ParamValue tmpparam,
TypeDesc  searchtype = TypeDesc::UNKNOWN,
bool  casesensitive = false 
) const

Search for the named attribute and return the pointer to its ParamValue record, or NULL if not found. This variety of find_attribute(} can retrieve items such as "width", which are data members of the ImageSpec, but not in extra_attribs. The tmpparam is a storage area owned by the caller, which is used as temporary buffer in cases where the information does not correspond to an actual extra_attribs (in this case, the return value will be &tmpparam). The extra names it understands are:

  • "x" "y" "z" "width" "height" "depth" "full_x" "full_y" "full_z" "full_width" "full_height" "full_depth"

    Returns the ImageSpec fields of those names (despite the fact that they are technically not arbitrary named attributes in extra_attribs). All are of type int.

  • "datawindow"

    Without a type, or if requested explicitly as an int[4], returns the OpenEXR-like pixel data min and max coordinates, as a 4-element integer array: { x, y, x+width-1, y+height-1 }. If instead you specifically request as an int[6], it will return the volumetric data window, { x, y, z, x+width-1, y+height-1, z+depth-1 }.

  • "displaywindow"

    Without a type, or if requested explicitly as an int[4], returns the OpenEXR-like pixel display min and max coordinates, as a 4-element integer array: { full_x, full_y, full_x+full_width-1, full_y+full_height-1 }. If instead you specifically request as an int[6], it will return the volumetric display window, { full_x, full_y, full_z, full_x+full_width-1, full_y+full_height-1, full_z+full_depth-1 }.

EXAMPLES

ImageSpec spec;           // has the info
Imath::Box2i dw;          // we want the displaywindow here
ParamValue tmp;           // so we can retrieve pseudo-values
TypeDesc int4("int[4]");  // Equivalent: TypeDesc int4(TypeDesc::INT,4);
const ParamValue* p = spec.find_attribute ("displaywindow", int4);
if (p)
    dw = Imath::Box2i(p->get<int>(0), p->get<int>(1),
                      p->get<int>(2), p->get<int>(3));

p = spec.find_attribute("temperature", TypeFloat);
if (p)
    float temperature = p->get<float>();
void ImageSpec::from_xml ( const char *  xml)

Populates the fields of the ImageSpec based on the XML passed in.

void ImageSpec::get_channelformats ( std::vector< TypeDesc > &  formats) const
inline

Fill in an array of channel formats describing all channels in the image. (Note that this differs slightly from the member data channelformats, which is empty if there are not separate per-channel formats.)

Definition at line 706 of file imageio.h.

float ImageSpec::get_float_attribute ( string_view  name,
float  defaultval = 0 
) const

Retrieve the named metadata attribute and return its value as a float. Any integer or floating point type will convert to float in the obvious way (like a C cast), and so will string metadata if its contents consist of of the text representation of one floating point value. If no such metadata exists, or are of a type that cannot be converted, the defaultval will be returned.

int ImageSpec::get_int_attribute ( string_view  name,
int  defaultval = 0 
) const

Retrieve the named metadata attribute and return its value as an int. Any integer type will convert to int by truncation or expansion, string data will parsed into an int if its contents consist of of the text representation of one integer. Floating point data will not succeed in converting to an int. If no such metadata exists, or are of a type that cannot be converted, the defaultval will be returned.

string_view ImageSpec::get_string_attribute ( string_view  name,
string_view  defaultval = string_view() 
) const

Retrieve any metadata attribute, converted to a string. If no such metadata exists, the defaultval will be returned.

bool ImageSpec::getattribute ( string_view  name,
TypeDesc  type,
void value,
bool  casesensitive = false 
) const

If the ImageSpec contains the named attribute and its type matches type, copy the attribute value into the memory pointed to by val (it is up to the caller to ensure there is enough space) and return true. If no such attribute is found, or if it doesn't match the type, return false and do not modify val.

EXAMPLES:

ImageSpec spec;
...
// Retrieving an integer attribute:
int orientation = 0;
spec.getattribute ("orientation", TypeInt, &orientation);

// Retrieving a string attribute with a char*:
const char* compression = nullptr;
spec.getattribute ("compression", TypeString, &compression);

// Alternately, retrieving a string with a ustring:
ustring compression;
spec.getattribute ("compression", TypeString, &compression);

Note that when passing a string, you need to pass a pointer to the char*, not a pointer to the first character. Also, the char* will end up pointing to characters owned by the ImageSpec; the caller does not need to ever free the memory that contains the characters.

This was added in version 2.1.

TypeDesc ImageSpec::getattributetype ( string_view  name,
bool  casesensitive = false 
) const

If the named attribute can be found in the ImageSpec, return its data type. If no such attribute exists, return TypeUnknown.

This was added in version 2.1.

imagesize_t ImageSpec::image_bytes ( bool  native = false) const
noexcept

Returns the number of bytes comprising an entire image of these dimensions, i.e., pixel_bytes(native) * width * height * depth This will return std::numeric_limits<image size_t>max() in the event of an overflow where it's not representable in an imagesize_t. If native is false (default), assume all channels are in this->format, but if native is true, compute the size of a pixel in the "native" data format of the file (these may differ in the case of per-channel formats).

imagesize_t ImageSpec::image_pixels ( ) const
noexcept

Return the number of pixels for an entire image. This will return std::numeric_limits<imagesize_t>max() in the event of an overflow where it's not representable in an imagesize_t.

static std::string ImageSpec::metadata_val ( const ParamValue p,
bool  human = false 
)
static

For a given parameter p, format the value nicely as a string. If human is true, use especially human-readable explanations (units, or decoding of values) for certain known metadata.

AttrDelegate<ImageSpec> ImageSpec::operator[] ( string_view  name)
inline

Array indexing by string will create an AttrDelegate that enables a convenient shorthand for adding and retrieving values from the spec:

  1. Assigning to the delegate adds a metadata attribute:

    ImageSpec spec;
    spec["foo"] = 42;                   // int
    spec["pi"] = float(M_PI);           // float
    spec["oiio:ColorSpace"] = "sRGB";   // string
    spec["cameratoworld"] = Imath::Matrix44(...);  // matrix
    

    Be very careful, the attribute's type will be implied by the C++ type of what you assign.

  2. String data may be retrieved directly, and for other types, the delegate supports a get<T>() that retrieves an item of type T:
     std::string colorspace = spec["oiio:ColorSpace"];
     int dither = spec["oiio:dither"].get<int>();
    

This was added in version 2.1.

Definition at line 809 of file imageio.h.

AttrDelegate<const ImageSpec> ImageSpec::operator[] ( string_view  name) const
inline

Definition at line 813 of file imageio.h.

size_t ImageSpec::pixel_bytes ( bool  native = false) const
noexcept

Return the number of bytes for each pixel (counting all channels). If native is false (default), assume all channels are in this->format, but if native is true, compute the size of a pixel in the "native" data format of the file (these may differ in the case of per-channel formats).

size_t ImageSpec::pixel_bytes ( int  chbegin,
int  chend,
bool  native = false 
) const
noexcept

Return the number of bytes for just the subset of channels in each pixel described by [chbegin,chend). If native is false (default), assume all channels are in this->format, but if native is true, compute the size of a pixel in the "native" data format of the file (these may differ in the case of per-channel formats).

ROI ImageSpec::roi ( ) const
inlinenoexcept

Return pixel data window for this ImageSpec expressed as a ROI.

Definition at line 717 of file imageio.h.

ROI ImageSpec::roi_full ( ) const
inlinenoexcept

Return full/display window for this ImageSpec expressed as a ROI.

Definition at line 722 of file imageio.h.

imagesize_t ImageSpec::scanline_bytes ( bool  native = false) const
noexcept

Returns the number of bytes comprising each scanline, i.e., pixel_bytes(native) * width This will return std::numeric_limits<imagesize_t>max() in the event of an overflow where it's not representable in an imagesize_t.

std::string ImageSpec::serialize ( SerialFormat  format,
SerialVerbose  verbose = SerialDetailed 
) const

Returns, as a string, a serialized version of the ImageSpec. The format may be either ImageSpec::SerialText or ImageSpec::SerialXML. The verbose argument may be one of: ImageSpec::SerialBrief (just resolution and other vital statistics, one line for SerialText, ImageSpec::SerialDetailed (contains all metadata in original form), or ImageSpec::SerialDetailedHuman (contains all metadata, in many cases with human-readable explanation).

void ImageSpec::set_format ( TypeDesc  fmt)
noexcept

Set the data format, and clear any per-channel format information in channelformats.

void ImageSpec::set_format ( string_view  fmt)
inlinenoexcept

Set the data format, and clear any per-channel format information in channelformats. The fmt may be a string such as "uint8", or any other type name recognized by the TypeDesc constructor.

Definition at line 356 of file imageio.h.

void ImageSpec::set_roi ( const ROI r)
inlinenoexcept

Set pixel data window parameters (x, y, z, width, height, depth) for this ImageSpec from an ROI. Does NOT change the channels of the spec, regardless of r.

Definition at line 730 of file imageio.h.

void ImageSpec::set_roi_full ( const ROI r)
inlinenoexcept

Set full/display window parameters (full_x, full_y, full_z, full_width, full_height, full_depth) for this ImageSpec from an ROI. Does NOT change the channels of the spec, regardless of r.

Definition at line 742 of file imageio.h.

bool ImageSpec::size_t_safe ( ) const
inlinenoexcept

Verify that on this platform, a size_t is big enough to hold the number of bytes (and pixels) in a scanline, a tile, and the whole image. If this returns false, the image is much too big to allocate and read all at once, so client apps beware and check these routines for overflows!

Definition at line 431 of file imageio.h.

imagesize_t ImageSpec::tile_bytes ( bool  native = false) const
noexcept

Returns the number of bytes comprising an image tile, i.e., pixel_bytes(native) * tile_width * tile_height * tile_depth If native is false (default), assume all channels are in this->format, but if native is true, compute the size of a pixel in the "native" data format of the file (these may differ in the case of per-channel formats).

imagesize_t ImageSpec::tile_pixels ( ) const
noexcept

Return the number of pixels comprising a tile (or 0 if it is not a tiled image). This will return std::numeric_limits<imagesize_t>max() in the event of an overflow where it's not representable in an imagesize_t.

std::string ImageSpec::to_xml ( ) const

Converts the contents of the ImageSpec as an XML string.

bool ImageSpec::undefined ( ) const
inlinenoexcept

Returns true for a newly initialized (undefined) ImageSpec. (Designated by no channels and undefined data type – true of the uninitialized state of an ImageSpec, and presumably not for any ImageSpec that is useful or purposefully made.)

Definition at line 784 of file imageio.h.

bool ImageSpec::valid_tile_range ( int  xbegin,
int  xend,
int  ybegin,
int  yend,
int  zbegin,
int  zend 
)
inlinenoexcept

Helper function to verify that the given pixel range exactly covers a set of tiles. Also returns false if the spec indicates that the image isn't tiled at all.

Definition at line 677 of file imageio.h.

Member Data Documentation

int ImageSpec::alpha_channel

The index of the channel that represents alpha (pixel coverage and/or transparency). It defaults to -1 if no alpha channel is present, or if it is not known which channel represents alpha.

Definition at line 291 of file imageio.h.

std::vector<TypeDesc> ImageSpec::channelformats

Optional per-channel data formats. If all channels of the image have the same data format, that will be described by format and channelformats will be empty (zero length). If there are different data formats for each channel, they will be described in the channelformats vector, and the format field will indicate a single default data format for applications that don't wish to support per-channel formats (usually this will be the format of the channel that has the most precision).

Definition at line 278 of file imageio.h.

std::vector<std::string> ImageSpec::channelnames

The names of each channel, in order. Typically this will be "R", "G", "B", "A" (alpha), "Z" (depth), or other arbitrary names.

Definition at line 288 of file imageio.h.

bool ImageSpec::deep

True if the image contains deep data. If true, this indicates that the image describes contains "deep" data consisting of multiple samples per pixel. If false, it's an ordinary image with one data value (per channel) per pixel.

Definition at line 300 of file imageio.h.

int ImageSpec::depth

depth of pixel data, >1 indicates a "volume"

Definition at line 260 of file imageio.h.

ParamValueList ImageSpec::extra_attribs

A list of arbitrarily-named and arbitrarily-typed additional attributes of the image, for any metadata not described by the hard-coded fields described above. This list may be manipulated with the attribute() and find_attribute() methods.

Definition at line 305 of file imageio.h.

TypeDesc ImageSpec::format

Data format of the channels. Describes the native format of the pixel data values themselves, as a TypeDesc. Typical values would be TypeDesc::UINT8 for 8-bit unsigned values, TypeDesc::FLOAT for 32-bit floating-point values, etc.

Definition at line 273 of file imageio.h.

int ImageSpec::full_depth

depth of the full (display) window

Definition at line 266 of file imageio.h.

int ImageSpec::full_height

height of the full (display) window

Definition at line 265 of file imageio.h.

int ImageSpec::full_width

width of the full (display) window

Definition at line 264 of file imageio.h.

int ImageSpec::full_x

origin of the full (display) window

Definition at line 261 of file imageio.h.

int ImageSpec::full_y

origin of the full (display) window

Definition at line 262 of file imageio.h.

int ImageSpec::full_z

origin of the full (display) window

Definition at line 263 of file imageio.h.

int ImageSpec::height

height of the pixel data window

Definition at line 259 of file imageio.h.

int ImageSpec::nchannels

number of image channels, e.g., 4 for RGBA

Definition at line 271 of file imageio.h.

int ImageSpec::tile_depth

tile depth (0 for a non-tiled image, 1 for a non-volume image)

Definition at line 269 of file imageio.h.

int ImageSpec::tile_height

tile height (0 for a non-tiled image)

Definition at line 268 of file imageio.h.

int ImageSpec::tile_width

tile width (0 for a non-tiled image)

Definition at line 267 of file imageio.h.

int ImageSpec::width

width of the pixel data window

Definition at line 258 of file imageio.h.

int ImageSpec::x

origin (upper left corner) of pixel data

Definition at line 255 of file imageio.h.

int ImageSpec::y

origin (upper left corner) of pixel data

Definition at line 256 of file imageio.h.

int ImageSpec::z

origin (upper left corner) of pixel data

Definition at line 257 of file imageio.h.

int ImageSpec::z_channel

The index of the channel that represents z or depth (from the camera). It defaults to -1 if no depth channel is present, or if it is not know which channel represents depth.

Definition at line 296 of file imageio.h.


The documentation for this class was generated from the following file: