JWS C Library
C language utility library
imgblock_io.c File Reference

Definitions for functions to read and write image blocks. More...

#include <jwsc/config.h>
#include <stdlib.h>
#include <stdio.h>
#include <inttypes.h>
#include <assert.h>
#include <string.h>
#include "jwsc/base/error.h"
#include "jwsc/image/image.h"
#include "jwsc/image/image_io.h"
#include "jwsc/image/jiff.h"
#include "jwsc/imgblock/imgblock.h"
#include "jwsc/imgblock/imgblock_io.h"
Include dependency graph for imgblock_io.c:

Go to the source code of this file.

Functions

read_imgblock_numbered

Reads an image block from a numbered sequence of files.

Errorread_imgblock_numbered_f (Imgblock_f **imgblk_out, const char *fname_fmt, uint32_t num_imgs)
 Reads a single precision floating point image block from a numbered sequence of files.
read_imgblock_named

Reads an image block from a named sequence of files.

Errorread_imgblock_named_f (Imgblock_f **imgblk_out, const char **fnames, uint32_t num_imgs)
 Reads a single precision floating point image block from a named sequence of files.
write_imgblock_numbered

Writes an image block to a numbered sequence of files.

Errorwrite_imgblock_numbered_f (const Imgblock_f *imgblk, const char *fname_fmt)
 Write a single precision floating point image block to a numbered sequence of files.
write_imgblock_named

Writes an image block to a named sequence of files.

Errorwrite_imgblock_named_f (const Imgblock_f *imgblk, const char **fnames)
 Write a single precision floating point image block to a named sequence of files.
write_imgblock_as_numbered_jiff

Writes an image block to a numbered sequence of JIFF files.

Errorwrite_imgblock_as_numbered_jiff_f (const Imgblock_f *imgblk, const char *fname_fmt, const JIFF_attributes *attrs)
 Write a single precision floating point image block to a numbered sequence of JIFF files.
write_imgblock_as_named_jiff

Writes an image block to a named sequence of JIFF files.

Errorwrite_imgblock_as_named_jiff_f (const Imgblock_f *imgblk, const char **fnames, const JIFF_attributes *attrs)
 Write a single precision floating point image block to a named sequence of JIFF files.

Detailed Description

Definitions for functions to read and write image blocks.

Author:
Joseph Schlecht
License:
Creative Commons BY-NC-SA 3.0

Definition in file imgblock_io.c.


Function Documentation

Error* read_imgblock_numbered_f ( Imgblock_f **  imgblk_out,
const char *  fname_fmt,
uint32_t  num_imgs 
)

Reads a single precision floating point image block from a numbered sequence of files.

An example for fname_fmt is

 image-%04d.tiff 
Parameters:
imgblk_outResult parameter. If *imgblk_out is NULL, an image block is allocated; otherwise its space is re-used.
fname_fmtFormat for the file name with one printf style integer conversion for the file number.
num_imgsNumber of images to read into the image block.
Returns:
On success, NULL is returned. On error, an Error is returned and *imgblk_out is freed and set to NULL.
Note:
Dimensions of all the files to read must be > 0.

Definition at line 90 of file imgblock_io.c.

Error* read_imgblock_named_f ( Imgblock_f **  imgblk_out,
const char **  fnames,
uint32_t  num_imgs 
)

Reads a single precision floating point image block from a named sequence of files.

Parameters:
imgblk_outResult parameter. If *imgblk_out is NULL, an image block is allocated; otherwise its space is re-used.
fnamesArray of file names to read. Must contain at least num_imgs elts.
num_imgsNumber of images to read into the image block.
Returns:
On success, NULL is returned. On error, an Error is returned and *imgblk_out is freed and set to NULL.
Note:
Dimensions of all the files to read must be > 0.

Definition at line 162 of file imgblock_io.c.

Error* write_imgblock_numbered_f ( const Imgblock_f imgblk,
const char *  fname_fmt 
)

Write a single precision floating point image block to a numbered sequence of files.

An example for fname_fmt is

 image-%04d.tiff 
Parameters:
imgblkImage block to write.
fname_fmtFormat for the file name with one printf style integer conversion for the file number.
Returns:
On success, NULL is returned. On error, an Error is returned.

Definition at line 227 of file imgblock_io.c.

Error* write_imgblock_named_f ( const Imgblock_f imgblk,
const char **  fnames 
)

Write a single precision floating point image block to a named sequence of files.

Parameters:
imgblkImage block to write.
fnamesFile names to write the images in the block to.
Returns:
On success, NULL is returned. On error, an Error is returned.

Definition at line 279 of file imgblock_io.c.

Error* write_imgblock_as_numbered_jiff_f ( const Imgblock_f imgblk,
const char *  fname_fmt,
const JIFF_attributes attrs 
)

Write a single precision floating point image block to a numbered sequence of JIFF files.

An example for fname_fmt is

 image-%04d.jiff 
Parameters:
imgblkImage block to write.
fname_fmtFormat for the file name with one printf style integer conversion for the file number.
attrsJIFF file attributes.
Returns:
On success, NULL is returned. On error, an Error is returned.

Definition at line 333 of file imgblock_io.c.

Error* write_imgblock_as_named_jiff_f ( const Imgblock_f imgblk,
const char **  fnames,
const JIFF_attributes attrs 
)

Write a single precision floating point image block to a named sequence of JIFF files.

Parameters:
imgblkImage block to write.
fnamesFile names to write the images in the block to.
attrsJIFF file attributes.
Returns:
On success, NULL is returned. On error, an Error is returned.

Definition at line 387 of file imgblock_io.c.