File: cmpack_flat.h

package info (click to toggle)
c-munipack 2.1.38-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 55,888 kB
  • sloc: ansic: 200,762; cpp: 106,123; lex: 9,035; yacc: 4,916; sh: 4,074; fortran: 2,613; xml: 2,105; python: 1,182; makefile: 546; perl: 104
file content (179 lines) | stat: -rw-r--r-- 6,719 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
/**
	\file
	\brief Functions for the flat-frame correction

	Set of functions defined in this module allows user to 
	apply flat-frame correction to CCD frames.
	
	\author David Motl <dmotl@volny.cz>
	
	\par Copying
	This program is free software; you can redistribute it and/or
	modify it under the terms of the GNU General Public License
	as published by the Free Software Foundation, version 2.
	
	$Id: cmpack_flat.h,v 1.1 2015/07/06 08:33:22 dmotl Exp $
*/

#ifndef _CMPACK_FLAT_H_INCLUDED
#define _CMPACK_FLAT_H_INCLUDED

#include "cmpack_common.h"
#include "cmpack_console.h"
#include "cmpack_ccdfile.h"

/********************   Private data structures   ********************************/

/**
	\brief Flat-frame correction context
	\details This private data structure holds the parameter for flat-frame
	correction as well as the flat frame itself.
*/
typedef struct _CmpackFlatCorr CmpackFlatCorr;

/********************   Public functions   *************************************/

#ifdef __cplusplus
extern "C" {
#endif

/**
	\brief Make new flat-frame correction context
	\details The function allocated memory with flat correction context
	and returns a new reference to it. The reference counter is set to one. 
	The caller is responsible to call cmpack_bias_destroy() when it is no 
	longer needed.
	\return pointer to a new reference
*/
	CMPACK_EXPORT(CmpackFlatCorr*, cmpack_flat_init, (void));

/**
	\brief Make a new reference to the flat-frame correction context
	\details The function makes a new reference to the context and returns a 
	pointer to it. The reference counter is incremented by one. The caller 
	is responsible to call cmpack_bias_destroy() when the reference is 
	no longer needed.
	\return pointer to a new reference
*/
	CMPACK_EXPORT(CmpackFlatCorr*, cmpack_flat_reference, (CmpackFlatCorr* ctx));

/**
	\brief Release a reference to the flat-frame correction context
	\details The function releases a reference to a flat-frame correction
	context. The reference counter is decreased by one and when it was the 
	last reference to the context, the context is freed and all memory 
	allocated in the context is reclaimed.
*/
	CMPACK_EXPORT(void, cmpack_flat_destroy, (CmpackFlatCorr* ctx));

/**
	\brief Attach console to the context
	\details The function connects a flat-frame correction context with
	a console context. The console is designed to print the information
	during the data processing. The functions makes its own reference
	to the console. Only one console can be attached to a single context, 
	if another console is attached to the single context, the original 
	one is released. Set console to NULL to release a reference to the 
	console that is currently attached to the context.
	\param[in] ctx			flat correction context
	\param[in] con			console context
*/
	CMPACK_EXPORT(void, cmpack_flat_set_console, (CmpackFlatCorr* ctx, CmpackConsole* con));

/**
	\brief Set image border size
	\details If you set the border to nonzero size, the conversion function
	will set the pixels which belongs to the border area to zero. You can use
	this feature to clear an unusable part of a frame.
	\param[in] ctx			flat correction context
	\param[in] border		border size in pixels
*/
	CMPACK_EXPORT(void, cmpack_flat_set_border, (CmpackFlatCorr* ctx, const CmpackBorder* border));

/**
	\brief Get image border size
	\param[in] ctx			flat correction context
	\param[in] border		border size in pixels
*/
	CMPACK_EXPORT(void, cmpack_flat_get_border, (CmpackFlatCorr* ctx, CmpackBorder* border));

/**
	\brief Set pixel value thresholds
	\details The function sets the value of two thresholds that determine 
	valid pixel values. Pixels of value <= minvalue are treated as bad pixels, 
	pixels of value >= maxvalue are treated as overexposed pixels.
	\param[in] ctx			dark correction context
	\param[in] minvalue		bad pixel threshold
	\param[in] maxvalue		overexposed pixel threshold
*/
	CMPACK_EXPORT(void, cmpack_flat_set_thresholds, (CmpackFlatCorr* ctx, double minvalue, double maxvalue));

/**
	\brief Set threshold for "invalid" pixel value
	\details The function sets the value of threshold that determines 
	valid pixel values. Pixels of value <= minvalue are treated as bad pixels.
	\param[in] ctx			flat correction context
	\param[in] minvalue		bad pixel threshold
*/
	CMPACK_EXPORT(void, cmpack_flat_set_minvalue, (CmpackFlatCorr* ctx, double minvalue));

/**
	\brief Get threshold for "invalid" pixel values
	\param[in] ctx			flat correction context
	\return pixel value
*/
	CMPACK_EXPORT(double, cmpack_flat_get_minvalue, (CmpackFlatCorr* ctx));

/**
	\brief Set threshold for "overexposed" pixels
	\details The function sets the value of threshold that determines 
	valid pixel values. Pixels of value >= maxvalue are treated as overexposed pixels.
	\param[in] ctx			flat correction context
	\param[in] maxvalue		overexposed pixel threshold
*/
	CMPACK_EXPORT(void, cmpack_flat_set_maxvalue, (CmpackFlatCorr* ctx, double maxvalue));

/**
	\brief Get threshold for "overexposed" pixels
	\param[in] ctx			flat correction context
	\return pixel value
*/
	CMPACK_EXPORT(double, cmpack_flat_get_maxvalue, (CmpackFlatCorr* ctx));

/**
	\brief Set correction frame
	\details The function reads image data from the given CCD frame. The 
	internal copy of the image data is made, no reference to the frame is 
	held, so you can free it when this function has returned.
	\param[in] ctx			flat correction context
	\param[in] flatfile		flat frame context
	\return zero on success or error code on failure
*/
	CMPACK_EXPORT(int, cmpack_flat_rflat, (CmpackFlatCorr* ctx, CmpackCcdFile* flatfile));

/**
	\brief Execute flat-frame correction 
	\details The function reads image data from the file context, performs
	the bias correction and stores the output to the same context.
	\param[in] ctx			flat correction context
	\param[in,out] file		frame context
	\return zero on success or error code on failure
*/
	CMPACK_EXPORT(int, cmpack_flat, (CmpackFlatCorr* ctx, CmpackCcdFile* file));

/**
	\brief Execute flat-frame correction 
	\details The function reads image data from the infile context, performs
	the bias correction and stores the output image to the outfile context.
	\param[in] ctx			flat correction context
	\param[in] infile		input frame context
	\param[in] outfile		output frame context
	\return zero on success or error code on failure
*/
	CMPACK_EXPORT(int, cmpack_flat_ex, (CmpackFlatCorr* ctx, CmpackCcdFile* infile, CmpackCcdFile* outfile));

#ifdef __cplusplus
}
#endif

#endif