The APIs in this section are used to parse a TIFF file and retrieve meta data. Meta data such as image dimensions, samples per pixel may be used to allocate output buffers on device memory.

nvtiffStreamParseFromFile()#

Parses the TIFF file and stores the meta data in nvtiffStream_t .

Signature:

nvtiffStatus_t nvtiffStreamParseFromFile(const char *fname,
        nvtiffStream_t tiff_stream)

Parameters:

Parameter

Input/Output

Memory

Description

const char *fname

Input

Host

tiff file name on disk

nvtiffStream_t tiff_stream

Input/Output

Host

tiff stream handle

Returns:

nvtiffStatus_t - An error code as specified in Decode API Return Status Codes

nvtiffStreamParse()#

Parses a tiff file which is loaded to host memory and stores the meta data in nvtiffStream_t.

Signature:

nvtiffStatus_t nvtiffStreamParse(const uint8_t *buffer,
      size_t buffer_size,
      nvtiffStream_t tiff_stream);

Parameters:

Parameter

Input/Output

Memory

Description

const uint8_t *buffer

Input

Host

Buffer containing tiff file

size_t buffer_size

Input

Host

tiff file size

nvtiffStream_t tiff_stream

Input/Output

Host

tiff stream handle

Returns:

nvtiffStatus_t - An error code as specified in Decode API Return Status Codes

nvtiffStreamPrint()#

Prints to standard output, the TIFF file meta data stored in nvtiffStream_t.

Signature:

nvtiffStatus_t nvtiffStreamPrint(nvtiffStream_t tiff_stream)

Parameters:

Parameter

Input/Output

Memory

Description

nvtiffStream_t tiff_stream

Input

Host

tiff stream handle

Returns:

nvtiffStatus_t - An error code as specified in Decode API Return Status Codes

nvtiffStreamGetNumImages()#

Retrieves the number of images stored in a TIFF file.

Signature:

nvtiffStatus_t nvtiffStreamGetNumImages(nvtiffStream_t tiff_stream,
        uint32_t *num_images)

Parameters:

Parameter

Input/Output

Memory

Description

nvtiffStream_t tiff_stream

Input

Host

tiff stream handle

uint32_t *num_images

Output

Host

Pointer to buffer containing number of images

Returns:

nvtiffStatus_t - An error code as specified in Decode API Return Status Codes

nvtiffStreamGetImageInfo()#

Retrieves the image information of a given image stored in a TIFF file. Refer to TIFF Image Information for details on what information is retrieved.

Signature:

nvtiffStatus_t nvtiffStreamGetImageInfo(nvtiffStream_t tiff_stream,
        uint32_t image_id,
        nvtiffImageInfo_t *image_info)

Parameters:

Parameter

Input/Output

Memory

Description

nvtiffStream_t tiff_stream

Input

Host

tiff stream handle

uint32_t image_id

Input

Host

Image index

nvtiffImageInfo_t *image_info

Output

Host

Pointer to nvtiffImageInfo_t

Returns:

nvtiffStatus_t - An error code as specified in Decode API Return Status Codes

nvtiffStreamGetImageGeometry()#

Retrieves image geometry related information. Geometry includes information whether the images use strips or tiles and their corresponding dimensions.

Signature:

nvtiffStatus_t nvtiffStreamGetImageGeometry(nvtiffStream_t tiff_stream,
      uint32_t image_id,
      nvtiffImageGeometry_t* geometry);

Parameters:

Parameter

Input/Output

Memory

Description

nvtiffStream_t tiff_stream

Input

Host

tiff stream handle

uint32_t image_id

Input

Host

Image index

nvtiffImageGeometry_t* geometry

Input/Output

Host

Pointer to nvtiffImageGeometry_t

Returns:

nvtiffStatus_t - An error code as specified in Decode API Return Status Codes

nvtiffStreamGetGeoKeyInfo()#

Retrieves the information about a geo key defined in GeoTIFF Keys. This information is useful in retrieving the values associated with the geo key.

Signature:

nvtiffStatus_t nvtiffStreamGetGeoKeyInfo(nvtiffStream_t tiff_stream,
        nvtiffGeoKey_t key,
        uint32_t *size,
        uint32_t *count,
        nvtiffGeoKeyDataType_t* type)

Parameters:

Parameter

Input/Output

Memory

Description

nvtiffStream_t tiff_stream

Input

Host

tiff stream handle

nvtiffGeoKey_t key

Input

Host

GeoTIFF key

uint32_t *size

Output

Host

Pointer to size of each value (in bytes) stored in key

uint32_t *count

Output

Host

Pointer to number of values stored in key

nvtiffGeoKeyDataType_t *type

Output

Host

Pointer to datatype of values stored in key

Returns:

nvtiffStatus_t - An error code as specified in Decode API Return Status Codes

nvtiffStreamGetNumberOfGeoKeys()#

Retrieves the list of geokeys present in a TIFF file and their count. This information is later useful in retrieving the values associated with each geo key.

Signature:

nvtiffStatus_t nvtiffStreamGetNumberOfGeoKeys(nvtiffStream_t tiff_stream,
        nvtiffGeoKey_t* key,
        uint32_t *num_keys)

Parameters:

Parameter

Input/Output

Memory

Description

nvtiffStream_t tiff_stream

Input

Host

tiff stream handle

nvtiffGeoKey_t *key

Output

Host

Pointer to user allocated buffer for storing all geokeys in TIFF file (can be nullptr, in which case only num_keys is returned)

uint32_t *num_keys

Output

Host

Pointer to number of geokeys stored in TIFF file

Returns:

nvtiffStatus_t - An error code as specified in Decode API Return Status Codes

nvtiffStreamGetTagInfo()#

Retrieves the information about a TIFF tag defined in TIFF Tags. This information is later useful in retrieving the values associated with the TIFF tag.

Signature:

nvtiffStatus_t nvtiffStreamGetTagInfo(nvtiffStream_t tiff_stream,
        uint32_t image_id,
        nvtiffTag_t tiff_tag,
        nvtiffTagDataType_t *tag_type,
        uint32_t *size,
        uint32_t *count);

Parameters:

Parameter

Input/Output

Memory

Description

nvtiffStream_t tiff_stream

Input

Host

tiff stream handle

uint32_t image_id

Input

Host

image index

nvtiffTag_t tiff_tag

Input

Host

tiff tag

nvtiffTagDataType_t *tag_type,

Output

Host

Pointer to buffer containing the datatype of tiff_tag. See TIFF Tag Data Type for which datatypes are supported.

uint32_t *size

Output

Host

Pointer to buffer containing size of individual values in tiff_tag

uint32_t *count

Output

Host

Pointer to buffer containing number of values in tiff_tag

Returns:

nvtiffStatus_t - An error code as specified in Decode API Return Status Codes

nvtiffStreamGetTagValue()#

Retrieves the values stored in a TIFF tag.

Signature:

nvtiffStatus_t nvtiffStreamGetTagValue(nvtiffStream_t tiff_stream,
        uint32_t image_id,
        nvtiffTag_t tiff_tag,
        void *tag_value,
        uint32_t count);

Parameters:

Parameter

Input/Output

Memory

Description

nvtiffStream_t tiff_stream

Input

Host

tiff stream handle

uint32_t image_id

Input

Host

image index

nvtiffTag_t tiff_tag

Input

Host

tiff tag

void *tag_value

Output

Host

Pointer to buffer containing values associated with tiff_tag

uint32_t count

Input

Number of values to retrieve.

Returns:

nvtiffStatus_t - An error code as specified in Decode API Return Status Codes

nvtiffStreamGetTagInfoGeneric()#

Retrieves TIFF tag information such as - tag type, size per element, and count for a sub image within a tiff file. If the tag is not found for sub image, NVTIFF_STATUS_TAG_NOT_FOUND is returned.

Signature:

nvtiffStatus_t nvtiffStreamGetTagInfoGeneric(nvtiffStream_t tiff_stream,
        uint32_t image_id,
        uint16_t tiff_tag,
        nvtiffTagDataType_t *tag_type,
        uint32_t *size,
        uint32_t *count);

Parameters:

Parameter

Input/Output

Memory

Description

nvtiffStream_t tiff_stream

Input

Host

tiff stream handle

uint32_t image_id

Input

Host

image index, cannot be greater than the total no of images in a tiff file.

uint16_t tiff_tag

Input

Host

TIFF tag of interest

nvtiffTagDataType_t * tag_type,

Output

Host

Retrieves the datatype of tiff_tag. See TIFF Tag Data Type for which datatypes are supported.

uint32_t * size

Output

Host

Retrieves the size per element, When tag type is NVTIFF_TAG_TYPE_ASCII, the string is NULL terminated.

uint32_t * count

Output

Host

Retrieves the number of elements associated with the tag

Returns:

nvtiffStatus_t - An error code as specified in Decode API Return Status Codes

nvtiffStreamGetTagValueGeneric()#

Retrieves the values stored in a TIFF tag for sub image. If the tag is not found for sub image, NVTIFF_STATUS_TAG_NOT_FOUND is returned.

Signature:

nvtiffStatus_t nvtiffStreamGetTagValueGeneric(nvtiffStream_t tiff_stream,
        uint32_t image_id,
        uint16_t tiff_tag,
        void *tag_value,
        uint32_t count);

Parameters:

Parameter

Input/Output

Memory

Description

nvtiffStream_t tiff_stream

Input

Host

tiff stream handle

uint32_t image_id

Input

Host

image index, cannot be greater than the total no of images in a tiff file.

uint16_t tiff_tag

Input

Host

tiff tag

void * tag_value

Output

Host

Output buffer used to retrieve the tag value

uint32_t count

Input

Number of elements to retrieve.

Returns:

nvtiffStatus_t - An error code as specified in Decode API Return Status Codes

nvtiffStreamGetGeoKey()#

Retrieves the values associated with a given geo key stored in a TIFF file.

Signature:

nvtiffStatus_t nvtiffStreamGetGeoKey(nvtiffStream_t tiff_stream,
        nvtiffGeoKey_t key,
        void *val,
        uint32_t count);

Parameters:

Parameter

Input/Output

Memory

Description

nvtiffStream_t tiff_stream

Input

Host

tiff stream handle

nvtiffGeoKey_t key

Input

Host

geo key for which information is retrieved

void *val

Output

Host

Pointer to user allocated buffer for storing values associated with key

uint32_t count

Input

Host

Number of values copied (for geo key of type NVTIFF_GEOKEY_TYPE_ASCII, this is ignored. For geo key of type NVTIFF_GEOKEY_TYPE_SHORT, count=1 is implied)

Returns:

nvtiffStatus_t - An error code as specified in Decode API Return Status Codes

nvtiffStreamGetGeoKeyASCII()#

Retrieves the values associated with geo key having ASCII values.

Signature:

nvtiffStatus_t NVTIFFAPI nvtiffStreamGetGeoKeyASCII(nvtiffStream_t tiff_stream,
        nvtiffGeoKey_t key,
        char* szStr,
        uint32_t szStrMaxLen)

Parameters:

Parameter

Input/Output

Memory

Description

nvtiffStream_t tiff_stream

Input

Host

tiff stream handle

nvtiffGeoKey_t key

Input

Host

geo key for which information is retrieved

char *szStr

Output

Host

Pointer to user allocated buffer containing key values

uint32_t szStrMaxLen

Input

Host

Size of the user allocated buffer szStr

Returns:

nvtiffStatus_t - An error code as specified in Decode API Return Status Codes

nvtiffStreamGetGeoKeySHORT()#

Retrieves the values associated with geo key having SHORT values.

Signature:

nvtiffStatus_t NVTIFFAPI nvtiffStreamGetGeoKeySHORT(nvtiffStream_t tiff_stream,
        nvtiffGeoKey_t key,
        unsigned short *val,
        uint32_t index,
        uint32_t count)

Parameters:

Parameter

Input/Output

Memory

Description

nvtiffStream_t tiff_stream

Input

Host

tiff stream handle

nvtiffGeoKey_t key

Input

Host

geo key for which information is retrieved

unsigned short *val

Output

Host

Pointer to user allocated buffer containing key values

uint32_t count

Input

Host

Number of values which are required to be copied to val

uint32_t index

Input

Host

Index of the starting value to be copied to val

Returns:

nvtiffStatus_t - An error code as specified in Decode API Return Status Codes

nvtiffStreamGetGeoKeyDOUBLE()#

Retrieves the values associated with geo key having DOUBLE values.

Signature:

nvtiffStatus_t NVTIFFAPI nvtiffStreamGetGeoKeyDOUBLE(nvtiffStream_t tiff_stream,
        nvtiffGeoKey_t key,
        double *val,
        uint32_t index,
        uint32_t count)

Parameters:

Parameter

Input/Output

Memory

Description

nvtiffStream_t tiff_stream

Input

Host

tiff stream handle

nvtiffGeoKey_t key

Input

Host

geo key for which information is retrieved

double *val

Output

Host

Pointer to user allocated buffer containing key values

uint32_t count

Input

Host

Number of values which are required to be copied to val

uint32_t index

Input

Host

Index of the starting value to be copied to val

Returns:

nvtiffStatus_t - An error code as specified in Decode API Return Status Codes