C-Munipack 1.2 / Application programming interface / API reference

Functions for reading CCD frames.

cmpack_ccdfile.h

Enumerations

CmpackCcdFormatImage format identifiers.
CmpackImageTrafoImage transformation bits.

Type definitions

CmpackCcdFileCCD frame file context.

Functions

cmpack_ccd_testCheck if the file is a CCD frame.
cmpack_ccd_test_bufferCheck if the content in buffer is a beginning of a CCD frame.
cmpack_ccd_newOpen a temporary CCD frame (stored in memory only).
cmpack_ccd_openOpen a CCD frame file.
cmpack_ccd_copyMake a copy of CCD frame.
cmpack_ccd_get_formatGet file format descriptor.
cmpack_ccd_get_datetimeGet date and time of observation.
cmpack_ccd_get_exptimeGet exposure duration.
cmpack_ccd_get_ccdtempGet CCD temperature.
cmpack_ccd_get_filterGet optical filter name.
cmpack_ccd_get_objectGet object's designation.
cmpack_ccd_get_objraGet object's right ascension (R.A.
cmpack_ccd_get_objdecGet object's declination.
cmpack_ccd_get_observerGet observer's name.
cmpack_ccd_get_observatoryGet observatory name.
cmpack_ccd_get_obslonGet observer's longitude.
cmpack_ccd_get_obslatGet observer's latitude.
cmpack_ccd_get_framesGet number of frames combined together.
cmpack_ccd_get_paramParameter enumeration.
cmpack_ccd_get_strGet a string value from a file header.
cmpack_ccd_get_intGet a integer value from a file header.
cmpack_ccd_get_boolGet a logical value from a file header.
cmpack_ccd_get_doubleGet a real value from a file header.
cmpack_ccd_get_bitpixGet frame size in pixels.
cmpack_ccd_get_rangeGet image data range.
cmpack_ccd_get_sizeGet frame size in pixels.
cmpack_ccd_get_imageGet image data (signed char).
cmpack_ccd_print_infoPrint short info about specified CCD-frame.
cmpack_ccd_print_headPrint full header from ccd frame of any format.

Description

Set of function defined in this module allows user to read CCD frame files in various formats by means of single interface. Writing files is not supported, use the cfitsio library directly.

CmpackCcdFile (data type)

CCD frame file context.

Synopsis

typedef struct _CmpackCcdFile CmpackCcdFile

Description

This private structure is used to access CCD frame file

CmpackCcdFormat (enumeration)

Image format identifiers.

Synopsis

enum CmpackCcdFormat
{
     CMPACK_FORMAT_UNKNOWN = 0,
     CMPACK_FORMAT_FITS,
     CMPACK_FORMAT_SBIG,
     CMPACK_FORMAT_OES
};

Enumerators

CMPACK_FORMAT_UNKNOWNUnknown format.
CMPACK_FORMAT_FITSFITS format.
CMPACK_FORMAT_SBIGSBIG format.
CMPACK_FORMAT_OESOES Astro format.

CmpackImageTrafo (enumeration)

Image transformation bits.

Synopsis

enum CmpackImageTrafo
{
     CMPACK_FLIP_0 = 0x00,
     CMPACK_FLIP_X = 0x01,
     CMPACK_FLIP_Y = 0x02,
     CMPACK_FLIP_XY = 0x03
};

Enumerators

CMPACK_FLIP_0No flipping.
CMPACK_FLIP_XFlip horizontally.
CMPACK_FLIP_YFlip vertically.
CMPACK_FLIP_XYRotate image 180 degrees.

cmpack_ccd_test (function)

Check if the file is a CCD frame.

Synopsis

int cmpack_ccd_test (const char * filename)

Parameters

filename[in] path + file name

Return value

nonzero if the file is a CCD frame, zero otherwise

cmpack_ccd_test_buffer (function)

Check if the content in buffer is a beginning of a CCD frame.

Synopsis

int cmpack_ccd_test_buffer (const char * buffer, int buflen, int filesize)

Parameters

buffer[in] beginning of the file
buflen[in] number of bytes stored in the buffer
filesize[in] size of file in bytes

Return value

nonzero if the file is a CCD frame, zero otherwise

cmpack_ccd_new (function)

Open a temporary CCD frame (stored in memory only).

Synopsis

CmpackCcdFile * cmpack_ccd_new (void)

Description

The reference counter is set to one. The caller is responsible to call cmpack_unref() when it is no longer needed.

Return value

pointer to new file context or zero on failure

cmpack_ccd_open (function)

Open a CCD frame file.

Synopsis

int cmpack_ccd_open (CmpackCcdFile ** fc, const char * filename, CmpackOpenMode flags)

Parameters

fc[out] file context
filename[in] path + file name
flags[in] open flags

Return value

zero on success, error code on failure

cmpack_ccd_copy (function)

Make a copy of CCD frame.

Synopsis

int cmpack_ccd_copy (CmpackCcdFile * fc, CmpackCcdFile * from)

Parameters

fc[in] target frame context
from[in] source frame context

Return value

zero on success, error code on failure

cmpack_ccd_get_format (function)

Get file format descriptor.

Synopsis

const char * cmpack_ccd_get_format (CmpackCcdFile * fc)

Description

The function returns pointer to the internal memory. You must not free or modify it. The string is valid as far as the context exists.

Parameters

fc[in] file context

Return value

file format descriptor or NULL on failure

cmpack_ccd_get_datetime (function)

Get date and time of observation.

Synopsis

int cmpack_ccd_get_datetime (CmpackCcdFile * fc, CmpackDateTime * dt)

Description

The function reads the date and time at the start of the observation.

Parameters

fc[in] file context
dt[out] date and time (zeros = not available)

Return value

zero on success, error code on failure

cmpack_ccd_get_exptime (function)

Get exposure duration.

Synopsis

int cmpack_ccd_get_exptime (CmpackCcdFile * fc, double * exptime)

Description

The function reads exposure duration in seconds.

Parameters

fc[in] file context
exptime[in] exposure duration

Return value

zero on success, error code on failure

cmpack_ccd_get_ccdtemp (function)

Get CCD temperature.

Synopsis

int cmpack_ccd_get_ccdtemp (CmpackCcdFile * fc, double * ccdtemp)

Description

The function reads the CCD temperature in degrees C.

Parameters

fc[in] file context
ccdtemp[in] CCD temperature

Return value

zero on success, error code on failure

cmpack_ccd_get_filter (function)

Get optical filter name.

Synopsis

const char * cmpack_ccd_get_filter (CmpackCcdFile * fc)

Description

The function returns pointer to the internal memory. You must not free or modify it. The string is valid as far as the context exists.

Parameters

fc[in] file context

Return value

filter name or NULL on failure

cmpack_ccd_get_object (function)

Get object's designation.

Synopsis

const char * cmpack_ccd_get_object (CmpackCcdFile * fc)

Description

The function returns pointer to the internal memory. You must not free or modify it. The string is valid as far as the context exists.

Parameters

fc[in] file context

Return value

pointer to string or NULL on failure

cmpack_ccd_get_objra (function)

Get object's right ascension (R.A.

Synopsis

const char * cmpack_ccd_get_objra (CmpackCcdFile * fc)

Description

)

The function returns pointer to the internal memory. You must not free or modify it. The string are valid as far as the context exists.

Parameters

fc[in] file context

Return value

pointer to string or NULL on failure

cmpack_ccd_get_objdec (function)

Get object's declination.

Synopsis

const char * cmpack_ccd_get_objdec (CmpackCcdFile * fc)

Description

The function returns pointer to the internal memory. You must not free or modify it. The string is valid as far as the context exists.

Parameters

fc[in] file context

Return value

pointer to string or NULL on failure

cmpack_ccd_get_observer (function)

Get observer's name.

Synopsis

const char * cmpack_ccd_get_observer (CmpackCcdFile * fc)

Description

The function returns pointer to the internal memory. You must not free or modify it. The string is valid as far as the context exists.

Parameters

fc[in] file context

Return value

pointer to string or NULL on failure

cmpack_ccd_get_observatory (function)

Get observatory name.

Synopsis

const char * cmpack_ccd_get_observatory (CmpackCcdFile * fc)

Description

The function returns pointer to the internal memory. You must not free or modify it. The string is valid as far as the context exists.

Parameters

fc[in] file context

Return value

pointer to string or NULL on failure

cmpack_ccd_get_obslon (function)

Get observer's longitude.

Synopsis

const char * cmpack_ccd_get_obslon (CmpackCcdFile * fc)

Description

The function returns pointer to the internal memory. You must not free or modify it. The string is valid as far as the context exists.

Parameters

fc[in] file context

Return value

pointer to string or NULL on failure

cmpack_ccd_get_obslat (function)

Get observer's latitude.

Synopsis

const char * cmpack_ccd_get_obslat (CmpackCcdFile * fc)

Description

The function returns pointer to the internal memory. You must not free or modify it. The string is valid as far as the context exists.

Parameters

fc[in] file context

Return value

pointer to string or NULL on failure

cmpack_ccd_get_frames (function)

Get number of frames combined together.

Synopsis

int cmpack_ccd_get_frames (CmpackCcdFile * fc, int * frames)

Description

The function reads the number of frames. If the field is not defined, it returns zero.

Parameters

fc[in] file context
frames[in] number of frames

Return value

zero on success, error code on failure

cmpack_ccd_get_param (function)

Parameter enumeration.

Synopsis

int cmpack_ccd_get_param (CmpackCcdFile * fc, int index, char ** key, char ** val, char ** com)

Description

Index of the first parameter is zero. The output parameters receive the pointers to newly allocated memory buffers. The caller is responsible to free it by calling of cmpack_free() function. You can set the value of output parameter to NULL if you do not need it.

Parameters

fc[in] file context
index[in] parameter index (starting by 0)
key[out] parameter name
val[out] parameter value
com[out] comment text

Return value

zero on success, error code on failure

cmpack_ccd_get_str (function)

Get a string value from a file header.

Synopsis

int cmpack_ccd_get_str (CmpackCcdFile * fc, const char * key, char ** val)

Description

The val parameter is set to a pointer to a newly allocated memory buffer. The caller is responsible to free it by calling of cmpack_free() function. Keys are case sensitive.

Parameters

fc[in] file context
key[in] parameter name (key)
val[out] parameter value

Return value

zero on success, error code on failure

cmpack_ccd_get_int (function)

Get a integer value from a file header.

Synopsis

int cmpack_ccd_get_int (CmpackCcdFile * fc, const char * key, int * val)

Parameters

fc[in] file context
key[in] parameter name (key)
val[out] parameter value

Return value

zero on success, error code on failure

cmpack_ccd_get_bool (function)

Get a logical value from a file header.

Synopsis

int cmpack_ccd_get_bool (CmpackCcdFile * fc, const char * key, int * val)

Parameters

fc[in] file context
key[in] parameter name (key)
val[out] parameter value

Return value

zero on success, error code on failure

cmpack_ccd_get_double (function)

Get a real value from a file header.

Synopsis

int cmpack_ccd_get_double (CmpackCcdFile * fc, const char * key, double * val)

Parameters

fc[in] file context
key[in] parameter name (key)
val[out] parameter value

Return value

zero on success, error code on failure

cmpack_ccd_get_bitpix (function)

Get frame size in pixels.

Synopsis

CmpackBitpix cmpack_ccd_get_bitpix (CmpackCcdFile * fc)

Parameters

fc[in] file context

Return value

image data type on success, zero on failure

cmpack_ccd_get_range (function)

Get image data range.

Synopsis

int cmpack_ccd_get_range (CmpackCcdFile * fc, double * minvalue, double * maxvalue)

Parameters

fc[in] file context
minvalue[in] minimum pixel value
maxvalue[in] maximum pixel value

Return value

zero on success, error code on failure

cmpack_ccd_get_size (function)

Get frame size in pixels.

Synopsis

int cmpack_ccd_get_size (CmpackCcdFile * fc, int * width, int * height)

Parameters

fc[in] file context
width[out] frame width in pixels (0 = not available)
height[out] frame height in pixels (0 = not available)

Return value

zero on success, error code on failure

cmpack_ccd_get_image (function)

Get image data (signed char).

Synopsis

int cmpack_ccd_get_image (CmpackCcdFile * fc, CmpackBitpix bitpix, int flipx, int flipy, void * buf)

Description

Image content is copied into given memory buffer.

Parameters

fc[in] file context
bitpix[in] image resolution
flipx[in] horizonal image flipping
flipy[in] vertical image flipping
buf[out] image data

Return value

zero on success, error code on failure

cmpack_ccd_print_info (function)

Print short info about specified CCD-frame.

Synopsis

int cmpack_ccd_print_info (CmpackCcdFile * file, CmpackConsole * con)

Parameters

file[in] CCD-frame file path + name
con[in] console context

Return value

zero on success or error code on failure

cmpack_ccd_print_head (function)

Print full header from ccd frame of any format.

Synopsis

int cmpack_ccd_print_head (CmpackCcdFile * file, CmpackConsole * con)

Parameters

file[in] CCD-frame file path + name
con[in] console context

Return value

zero on success or error code on failure