File: cpl_mask.h

package info (click to toggle)
cpl 7.1.3-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 14,808 kB
  • sloc: ansic: 132,627; javascript: 6,382; sh: 4,232; makefile: 637
file content (122 lines) | stat: -rw-r--r-- 5,540 bytes parent folder | download
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
/*
 * This file is part of the ESO Common Pipeline Library
 * Copyright (C) 2001-2017 European Southern Observatory
 *
 * 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; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 */

#ifndef CPL_MASK_H
#define CPL_MASK_H

/*-----------------------------------------------------------------------------
                                   New types
 -----------------------------------------------------------------------------*/

typedef struct _cpl_mask_ cpl_mask;

/*-----------------------------------------------------------------------------
                                   Includes
 -----------------------------------------------------------------------------*/

#include "cpl_image.h"
#include "cpl_matrix.h"
#include "cpl_filter.h"
#include "cpl_propertylist.h"

CPL_BEGIN_DECLS

/*-----------------------------------------------------------------------------
                    cpl_binary type definition
 -----------------------------------------------------------------------------*/

typedef unsigned char   cpl_binary;

/*-----------------------------------------------------------------------------
                                   Define
 -----------------------------------------------------------------------------*/

#define CPL_BINARY_1        (cpl_binary)1
#define CPL_BINARY_0        (cpl_binary)0

/*-----------------------------------------------------------------------------
                            Function prototypes
 -----------------------------------------------------------------------------*/

/* IO operations */
cpl_mask * cpl_mask_new(cpl_size, cpl_size) CPL_ATTR_ALLOC;
cpl_mask * cpl_mask_wrap(cpl_size, cpl_size, cpl_binary *) CPL_ATTR_ALLOC;
cpl_mask * cpl_mask_duplicate(const cpl_mask *) CPL_ATTR_ALLOC;
void cpl_mask_delete(cpl_mask *);
void * cpl_mask_unwrap(cpl_mask *);
cpl_error_code cpl_mask_dump_window(const cpl_mask *, cpl_size, cpl_size,
                                    cpl_size, cpl_size, FILE *);

cpl_mask * cpl_mask_load(const char *, cpl_size, cpl_size) CPL_ATTR_ALLOC;
cpl_mask * cpl_mask_load_window(const char *, cpl_size, cpl_size, cpl_size,
                                cpl_size, cpl_size, cpl_size) CPL_ATTR_ALLOC;
cpl_error_code cpl_mask_save(const cpl_mask *, const char *,
                             const cpl_propertylist *, unsigned);

/* Accessor functions */
cpl_binary * cpl_mask_get_data(cpl_mask *);
const cpl_binary * cpl_mask_get_data_const(const cpl_mask *);
cpl_binary cpl_mask_get(const cpl_mask *, cpl_size, cpl_size);
cpl_error_code cpl_mask_set(cpl_mask *, cpl_size, cpl_size, cpl_binary);
cpl_size cpl_mask_get_size_x(const cpl_mask *);
cpl_size cpl_mask_get_size_y(const cpl_mask *);

/* Basic operations */
cpl_boolean cpl_mask_is_empty(const cpl_mask *);
cpl_boolean cpl_mask_is_empty_window(const cpl_mask *, cpl_size, cpl_size,
                                     cpl_size, cpl_size);
cpl_size cpl_mask_count(const cpl_mask *);
cpl_size cpl_mask_count_window(const cpl_mask *, cpl_size, cpl_size,
                               cpl_size, cpl_size);
cpl_error_code cpl_mask_and(cpl_mask *, const cpl_mask *);
cpl_error_code cpl_mask_or(cpl_mask *, const cpl_mask *);
cpl_error_code cpl_mask_xor(cpl_mask *, const cpl_mask *);
cpl_error_code cpl_mask_not(cpl_mask *);
cpl_mask * cpl_mask_collapse_create(const cpl_mask *, int) CPL_ATTR_ALLOC;
cpl_mask * cpl_mask_extract(const cpl_mask *, cpl_size, cpl_size,
                            cpl_size, cpl_size) CPL_ATTR_ALLOC;
cpl_error_code cpl_mask_turn(cpl_mask *, int);
cpl_error_code cpl_mask_shift(cpl_mask *, cpl_size, cpl_size);
cpl_error_code cpl_mask_copy(cpl_mask *, const cpl_mask *, cpl_size, cpl_size);
cpl_error_code cpl_mask_flip(cpl_mask *, int);
cpl_error_code cpl_mask_move(cpl_mask *, cpl_size, const cpl_size *);
cpl_mask * cpl_mask_extract_subsample(const cpl_mask *,
                                      cpl_size, cpl_size) CPL_ATTR_ALLOC;

/* Morphological operations */
cpl_error_code cpl_mask_filter(cpl_mask *, const cpl_mask *, const cpl_mask *,
                               cpl_filter_mode, cpl_border_mode);
cpl_error_code cpl_mask_closing(cpl_mask *,
                                const cpl_matrix *) CPL_ATTR_DEPRECATED;
cpl_error_code cpl_mask_opening(cpl_mask *,
                                const cpl_matrix *) CPL_ATTR_DEPRECATED;
cpl_error_code cpl_mask_erosion(cpl_mask *,
                                const cpl_matrix *) CPL_ATTR_DEPRECATED;
cpl_error_code cpl_mask_dilation(cpl_mask *,
                                 const cpl_matrix *) CPL_ATTR_DEPRECATED;

/* Zones selection */
cpl_error_code cpl_mask_threshold_image(cpl_mask *, const cpl_image *,
                                        double, double, cpl_binary);
cpl_mask * cpl_mask_threshold_image_create(const cpl_image *,
                                           double, double) CPL_ATTR_ALLOC;

CPL_END_DECLS

#endif