GRASS GIS 8 Programmer's Manual  8.5.0dev(2024)-d6dec75dd4
defs/imagery.h
Go to the documentation of this file.
1 #ifndef GRASS_IMAGEDEFS_H
2 #define GRASS_IMAGEDEFS_H
3 
4 /* alloc.c */
5 void *I_malloc(size_t);
6 void *I_realloc(void *, size_t);
7 int I_free(void *);
8 double **I_alloc_double2(int, int);
9 int *I_alloc_int(int);
10 int **I_alloc_int2(int, int);
11 int I_free_int2(int **);
12 int I_free_double2(double **);
13 double ***I_alloc_double3(int, int, int);
14 int I_free_double3(double ***);
15 
16 /* eol.c */
17 int I_get_to_eol(char *, int, FILE *);
18 
19 /* find.c */
20 int I_find_group(const char *);
21 int I_find_group2(const char *, const char *);
22 int I_find_group_file(const char *, const char *);
23 int I_find_group_file2(const char *, const char *, const char *);
24 int I_find_subgroup(const char *, const char *);
25 int I_find_subgroup2(const char *, const char *, const char *);
26 int I_find_subgroup_file(const char *, const char *, const char *);
27 int I_find_subgroup_file2(const char *, const char *, const char *,
28  const char *);
29 const char *I_find_signature(I_SIGFILE_TYPE, char *, const char *);
30 const char *I_find_signature2(I_SIGFILE_TYPE, const char *, const char *);
31 
32 /* fopen.c */
33 FILE *I_fopen_group_file_new(const char *, const char *);
34 FILE *I_fopen_group_file_append(const char *, const char *);
35 FILE *I_fopen_group_file_old(const char *, const char *);
36 FILE *I_fopen_group_file_old2(const char *, const char *, const char *);
37 FILE *I_fopen_subgroup_file_new(const char *, const char *, const char *);
38 FILE *I_fopen_subgroup_file_append(const char *, const char *, const char *);
39 FILE *I_fopen_subgroup_file_old(const char *, const char *, const char *);
40 FILE *I_fopen_subgroup_file_old2(const char *, const char *, const char *,
41  const char *);
42 
43 /* georef.c */
44 int I_compute_georef_equations(struct Control_Points *, double *, double *,
45  double *, double *, int);
46 int I_georef(double, double, double *, double *, double *, double *, int);
47 
48 /* georef_tps.c */
49 int I_compute_georef_equations_tps(struct Control_Points *, double **,
50  double **, double **, double **);
51 int I_georef_tps(double, double, double *, double *, double *, double *,
52  struct Control_Points *, int);
53 
54 /* group.c */
55 int I_get_group(char *);
56 int I_put_group(const char *);
57 int I_get_subgroup(const char *, char *);
58 int I_put_subgroup(const char *, const char *);
59 int I_get_group_ref(const char *, struct Ref *);
60 int I_get_group_ref2(const char *, const char *, struct Ref *);
61 int I_get_subgroup_ref(const char *, const char *, struct Ref *);
62 int I_get_subgroup_ref2(const char *, const char *, const char *, struct Ref *);
63 int I_init_ref_color_nums(struct Ref *);
64 int I_put_group_ref(const char *, const struct Ref *);
65 int I_put_subgroup_ref(const char *, const char *, const struct Ref *);
66 int I_add_file_to_group_ref(const char *, const char *, struct Ref *);
67 int I_transfer_group_ref_file(const struct Ref *, int, struct Ref *);
68 int I_init_group_ref(struct Ref *);
69 int I_free_group_ref(struct Ref *);
70 
71 /* iclass.c */
72 struct Map_info;
73 int I_iclass_analysis(IClass_statistics *, struct Ref *, struct Map_info *,
74  const char *, const char *, const char *);
75 int I_iclass_init_group(const char *, const char *, struct Ref *);
76 void I_iclass_create_raster(IClass_statistics *, struct Ref *, const char *);
77 
78 /* iclass_statistics.c */
81 void I_iclass_statistics_get_name(IClass_statistics *, const char **);
93 int I_iclass_statistics_get_histo(IClass_statistics *, int, int, int *);
94 int I_iclass_statistics_get_product(IClass_statistics *, int, int, float *);
95 void I_iclass_init_statistics(IClass_statistics *, int, const char *,
96  const char *, float);
98 
99 /* iclass_signatures.c */
100 int I_iclass_init_signatures(struct Signature *, struct Ref *);
102 int I_iclass_write_signatures(struct Signature *, const char *);
103 
104 /* list_gp.c */
105 int I_list_group(const char *, const struct Ref *, FILE *);
106 int I_list_group_simple(const struct Ref *, FILE *);
107 void I__list_group_name_fit(char *, const char *, const char *);
108 
109 /* list_subgp.c */
110 char **I_list_subgroups(const char *, int *);
111 char **I_list_subgroups2(const char *, const char *, int *);
112 int I_list_subgroup(const char *, const char *, const struct Ref *, FILE *);
113 int I_list_subgroup_simple(const struct Ref *, FILE *);
114 
115 /* loc_info.c */
116 char *I_location_info(const char *);
117 
118 /* points.c */
119 int I_new_control_point(struct Control_Points *, double, double, double, double,
120  int);
121 int I_get_control_points(const char *, struct Control_Points *);
122 int I_put_control_points(const char *, const struct Control_Points *);
123 
124 /* ref.c */
125 FILE *I_fopen_group_ref_new(const char *);
126 FILE *I_fopen_group_ref_old(const char *);
127 FILE *I_fopen_group_ref_old2(const char *, const char *);
128 FILE *I_fopen_subgroup_ref_new(const char *, const char *);
129 FILE *I_fopen_subgroup_ref_old(const char *, const char *);
130 FILE *I_fopen_subgroup_ref_old2(const char *, const char *, const char *);
131 
132 /* iscatt_structs.c */
133 void I_sc_init_cats(struct scCats *, int, int);
134 void I_sc_free_cats(struct scCats *);
135 int I_sc_add_cat(struct scCats *);
136 int I_sc_insert_scatt_data(struct scCats *, struct scdScattData *, int, int);
137 
138 void I_scd_init_scatt_data(struct scdScattData *, int, int, void *);
139 
140 /* iscatt_core.c */
141 int I_compute_scatts(struct Cell_head *, struct scCats *, const char **,
142  const char **, int, struct scCats *, const char **);
143 
144 int I_create_cat_rast(struct Cell_head *, const char *);
145 int I_insert_patch_to_cat_rast(const char *, struct Cell_head *, const char *);
146 
147 int I_id_scatt_to_bands(const int, const int, int *, int *);
148 int I_bands_to_id_scatt(const int, const int, const int, int *);
149 
150 int I_merge_arrays(unsigned char *, unsigned char *, unsigned, unsigned,
151  double);
152 int I_apply_colormap(unsigned char *, unsigned char *, unsigned,
153  unsigned char *, unsigned char *);
154 int I_rasterize(double *, int, unsigned char, struct Cell_head *,
155  unsigned char *);
156 
157 /* manage_signatures.c */
160 int I_signatures_remove(I_SIGFILE_TYPE, const char *);
161 int I_signatures_copy(I_SIGFILE_TYPE, const char *, const char *, const char *);
162 int I_signatures_rename(I_SIGFILE_TYPE, const char *, const char *);
163 int I_signatures_list_by_type(I_SIGFILE_TYPE, const char *, char ***);
164 void I_free_signatures_list(int, char ***);
165 
166 /* sig.c */
167 int I_init_signatures(struct Signature *, int);
168 int I_new_signature(struct Signature *);
169 int I_free_signatures(struct Signature *);
170 int I_read_one_signature(FILE *, struct Signature *);
171 int I_read_signatures(FILE *, struct Signature *);
172 int I_write_signatures(FILE *, struct Signature *);
174  const struct Ref *);
175 
176 /* sigfile.c */
177 FILE *I_fopen_signature_file_new(const char *);
178 FILE *I_fopen_signature_file_old(const char *);
179 
180 /* sigset.c */
181 int I_SigSetNClasses(struct SigSet *);
182 struct ClassData *I_AllocClassData(struct SigSet *, struct ClassSig *, int);
183 int I_InitSigSet(struct SigSet *, int);
184 struct ClassSig *I_NewClassSig(struct SigSet *);
185 struct SubSig *I_NewSubSig(struct SigSet *, struct ClassSig *);
186 int I_ReadSigSet(FILE *, struct SigSet *) WARN_UNUSED_RESULT;
187 int I_SetSigTitle(struct SigSet *, const char *);
188 const char *I_GetSigTitle(const struct SigSet *);
189 int I_SetClassTitle(struct ClassSig *, const char *);
190 const char *I_GetClassTitle(const struct ClassSig *);
191 int I_WriteSigSet(FILE *, const struct SigSet *);
192 char **I_SortSigSetBySemanticLabel(struct SigSet *, const struct Ref *);
193 
194 /* sigsetfile.c */
195 FILE *I_fopen_sigset_file_new(const char *);
196 FILE *I_fopen_sigset_file_old(const char *);
197 
198 /* target.c */
199 int I_get_target(const char *, char *, char *);
200 int I_put_target(const char *, const char *, const char *);
201 
202 /* title.c */
203 int I_get_group_title(const char *, char *, int);
204 int I_put_group_title(const char *, const char *);
205 
206 /* var.c */
207 double I_variance(double, double, int);
208 double I_stddev(double, double, int);
209 
210 #endif
FILE * I_fopen_subgroup_ref_old2(const char *, const char *, const char *)
Definition: ref.c:62
int I_find_group_file2(const char *, const char *, const char *)
Searches for a group file in the specified mapset.
Definition: imagery/find.c:69
char ** I_SortSigSetBySemanticLabel(struct SigSet *, const struct Ref *)
Reorder struct SigSet to match imagery group member order.
Definition: sigset.c:474
int I_get_subgroup_ref2(const char *, const char *, const char *, struct Ref *)
read subgroup REF file
Definition: group.c:168
int I_sc_insert_scatt_data(struct scCats *, struct scdScattData *, int, int)
Insert scatter plot data . Inserted scatt_data struct must have same type as cats struct (SC_SCATT_DA...
int I_init_group_ref(struct Ref *)
initialize Ref structure
Definition: group.c:466
int I_SetClassTitle(struct ClassSig *, const char *)
Definition: sigset.c:375
int I_list_subgroup(const char *, const char *, const struct Ref *, FILE *)
Prints maps in a subgroup (fancy version)
Definition: list_subgp.c:81
FILE * I_fopen_group_file_new(const char *, const char *)
Definition: fopen.c:69
void I_make_signatures_dir(I_SIGFILE_TYPE)
Make signature dir.
void I_iclass_free_statistics(IClass_statistics *)
Free space allocated for statistics attributes.
int I_apply_colormap(unsigned char *, unsigned char *, unsigned, unsigned char *, unsigned char *)
Apply colromap to the raster.
Definition: iscatt_core.c:891
struct ClassData * I_AllocClassData(struct SigSet *, struct ClassSig *, int)
Definition: sigset.c:43
int I_get_control_points(const char *, struct Control_Points *)
read group control points
Definition: points.c:113
int I_put_group_ref(const char *, const struct Ref *)
write group REF file
Definition: group.c:310
int I_georef_tps(double, double, double *, double *, double *, double *, struct Control_Points *, int)
Definition: georef_tps.c:63
struct SubSig * I_NewSubSig(struct SigSet *, struct ClassSig *)
Definition: sigset.c:96
FILE * I_fopen_sigset_file_new(const char *)
Create new sigset file.
Definition: sigsetfile.c:28
int I_iclass_analysis(IClass_statistics *, struct Ref *, struct Map_info *, const char *, const char *, const char *)
Calculates statistical values for one class and multiple bands based on training areas.
Definition: iclass.c:50
int I_put_group_title(const char *, const char *)
Definition: title.c:20
char ** I_list_subgroups2(const char *, const char *, int *)
Get list of subgroups which a group contatins.
Definition: list_subgp.c:67
int I_iclass_statistics_get_range_max(IClass_statistics *, int, int *)
Get maximum cell value based on mean and standard deviation for band.
int I_compute_georef_equations_tps(struct Control_Points *, double **, double **, double **, double **)
Definition: georef_tps.c:108
void I_get_signatures_dir(char *, I_SIGFILE_TYPE)
Get signature directory.
int I_get_group_title(const char *, char *, int)
Definition: title.c:4
int I_free_double2(double **)
Definition: imagery/alloc.c:93
int I_signatures_remove(I_SIGFILE_TYPE, const char *)
Remove a signature file.
int I_find_subgroup2(const char *, const char *, const char *)
Searches for a subgroup in specified mapset or any mapset if mapset is not set.
Definition: imagery/find.c:110
int I_find_group_file(const char *, const char *)
Searches for a group file in the current mapset.
Definition: imagery/find.c:52
int I_get_subgroup(const char *, char *)
Definition: group.c:67
int I_write_signatures(FILE *, struct Signature *)
Write signatures to file.
Definition: sig.c:245
void * I_realloc(void *, size_t)
Definition: imagery/alloc.c:14
FILE * I_fopen_subgroup_file_new(const char *, const char *, const char *)
Definition: fopen.c:123
char ** I_list_subgroups(const char *, int *)
Get list of subgroups which a group contatins.
Definition: list_subgp.c:52
int I_list_group_simple(const struct Ref *, FILE *)
Prints maps in a group (simple version)
Definition: list_gp.c:73
FILE * I_fopen_subgroup_file_old(const char *, const char *, const char *)
Definition: fopen.c:167
int I_list_subgroup_simple(const struct Ref *, FILE *)
Prints maps in a subgroup (simple version)
Definition: list_subgp.c:134
const char * I_find_signature(I_SIGFILE_TYPE, char *, const char *)
Find mapset containing signature file.
Definition: imagery/find.c:204
int I_signatures_list_by_type(I_SIGFILE_TYPE, const char *, char ***)
Get list of existing signatures by type.
FILE * I_fopen_subgroup_ref_old(const char *, const char *)
Definition: ref.c:54
int I_put_subgroup_ref(const char *, const char *, const struct Ref *)
write subgroup REF file
Definition: group.c:331
void I_iclass_init_statistics(IClass_statistics *, int, const char *, const char *, float)
Initialize statistics.
struct ClassSig * I_NewClassSig(struct SigSet *)
Definition: sigset.c:77
void I_iclass_statistics_get_cat(IClass_statistics *, int *)
Get category (class).
int I_rasterize(double *, int, unsigned char, struct Cell_head *, unsigned char *)
Wrapper for using of iclass perimeter rasterization by scatter plot. Warning: calls Rast_set_window.
Definition: iscatt_core.c:934
int I_new_signature(struct Signature *)
Definition: sig.c:30
void I_iclass_statistics_get_ncells(IClass_statistics *, int *)
Get number of cells in training areas.
double *** I_alloc_double3(int, int, int)
FILE * I_fopen_subgroup_ref_new(const char *, const char *)
Definition: ref.c:49
int I_iclass_statistics_get_max(IClass_statistics *, int, int *)
Get maximum value in band.
int I_iclass_statistics_get_sum(IClass_statistics *, int, float *)
Get sum of values in band.
int I_compute_georef_equations(struct Control_Points *, double *, double *, double *, double *, int)
int I_iclass_statistics_get_range_min(IClass_statistics *, int, int *)
Get minimum cell value based on mean and standard deviation for band.
FILE * I_fopen_group_file_old(const char *, const char *)
Open group file for reading.
Definition: fopen.c:102
int I_ReadSigSet(FILE *, struct SigSet *) WARN_UNUSED_RESULT
Read sigset signatures from file.
Definition: sigset.c:141
int I_add_file_to_group_ref(const char *, const char *, struct Ref *)
add file name to Ref structure
Definition: group.c:386
double I_stddev(double, double, int)
Definition: var.c:16
int I_free_int2(int **)
Definition: imagery/alloc.c:80
void I_scd_init_scatt_data(struct scdScattData *, int, int, void *)
Insert scatter plot data.
char ** I_sort_signatures_by_semantic_label(struct Signature *, const struct Ref *)
Reorder struct Signature to match imagery group member order.
Definition: sig.c:323
const char * I_find_signature2(I_SIGFILE_TYPE, const char *, const char *)
Find mapset containing signature (look but don't touch)
Definition: imagery/find.c:240
void I_free_signatures_list(int, char ***)
Free memory allocated by I_signatures_list_by_type.
int I_read_one_signature(FILE *, struct Signature *)
Internal function for I_read_signatures.
Definition: sig.c:88
void I_iclass_statistics_get_color(IClass_statistics *, const char **)
Get category (class) color.
int I_iclass_init_group(const char *, const char *, struct Ref *)
Read files for the specified group subgroup into the Ref structure.
Definition: iclass.c:105
int I_init_signatures(struct Signature *, int)
Initialize struct Signature before use.
Definition: sig.c:14
int I_iclass_statistics_get_product(IClass_statistics *, int, int, float *)
Get product value.
int I_id_scatt_to_bands(const int, const int, int *, int *)
Compute band ids from scatter plot id.
int I_iclass_init_signatures(struct Signature *, struct Ref *)
Initialize signatures.
int I_SigSetNClasses(struct SigSet *)
Definition: sigset.c:32
int I_iclass_statistics_get_stddev(IClass_statistics *, int, float *)
Get standard deviation of cell category values in band.
void I__list_group_name_fit(char *, const char *, const char *)
Formats map name to fit in a 80 column layout.
Definition: list_gp.c:97
int * I_alloc_int(int)
Definition: imagery/alloc.c:49
void * I_malloc(size_t)
Definition: imagery/alloc.c:5
FILE * I_fopen_sigset_file_old(const char *)
Open existing sigset signature file.
Definition: sigsetfile.c:50
int I_merge_arrays(unsigned char *, unsigned char *, unsigned, unsigned, double)
Merge arrays according to opacity. Every pixel in array must be represented by 4 values (RGBA).
Definition: iscatt_core.c:848
int I_free_double3(double ***)
void I_sc_free_cats(struct scCats *)
Free data of struct scCats, the structure itself remains allocated.
FILE * I_fopen_signature_file_old(const char *)
Open existing signature file.
Definition: sigfile.c:54
FILE * I_fopen_subgroup_file_append(const char *, const char *, const char *)
Definition: fopen.c:145
int I_get_group_ref(const char *, struct Ref *)
read group REF file
Definition: group.c:112
void I_iclass_statistics_get_name(IClass_statistics *, const char **)
Get category (class) name.
void I_sc_init_cats(struct scCats *, int, int)
Initialize structure for storing scatter plots data.
int I_free(void *)
Definition: imagery/alloc.c:21
int I_free_group_ref(struct Ref *)
free Ref structure
Definition: group.c:484
void I_iclass_statistics_set_nstd(IClass_statistics *, float)
Set the multiplier of standard deviation.
int I_find_subgroup_file(const char *, const char *, const char *)
Searches for a subgroup file in the current mapset.
Definition: imagery/find.c:134
FILE * I_fopen_group_ref_new(const char *)
Definition: ref.c:25
int I_find_subgroup_file2(const char *, const char *, const char *, const char *)
Searches for a subgroup file in the specified mapset.
Definition: imagery/find.c:162
int I_put_target(const char *, const char *, const char *)
write target information
Definition: target.c:61
int I_get_subgroup_ref(const char *, const char *, struct Ref *)
read subgroup REF file
Definition: group.c:149
int I_find_group(const char *)
does group exist?
Definition: imagery/find.c:21
int I_SetSigTitle(struct SigSet *, const char *)
Definition: sigset.c:356
int I_bands_to_id_scatt(const int, const int, const int, int *)
Compute scatter plot id from band ids.
int I_InitSigSet(struct SigSet *, int)
Initialize struct SigSet before use.
Definition: sigset.c:64
const char * I_GetSigTitle(const struct SigSet *)
Definition: sigset.c:367
int I_read_signatures(FILE *, struct Signature *)
Read signatures from file.
Definition: sig.c:147
int I_signatures_rename(I_SIGFILE_TYPE, const char *, const char *)
Rename a signature file.
int I_get_target(const char *, char *, char *)
read target information
Definition: target.c:22
int I_insert_patch_to_cat_rast(const char *, struct Cell_head *, const char *)
Insert raster map patch into pgm file.
Definition: iscatt_core.c:231
int I_find_group2(const char *, const char *)
Does the group exists?
Definition: imagery/find.c:40
void I_iclass_add_signature(struct Signature *, IClass_statistics *)
Add one signature.
FILE * I_fopen_signature_file_new(const char *)
Create signature file.
Definition: sigfile.c:28
int I_init_ref_color_nums(struct Ref *)
Definition: group.c:253
void I_iclass_create_raster(IClass_statistics *, struct Ref *, const char *)
Create raster map based on statistics.
Definition: iclass.c:160
int I_put_control_points(const char *, const struct Control_Points *)
write group control points
Definition: points.c:148
int I_create_cat_rast(struct Cell_head *, const char *)
Create category raster conditions file. The file is used for holding selected areas from mapwindow....
Definition: iscatt_core.c:59
void I_iclass_statistics_get_nbands(IClass_statistics *, int *)
Get number of bands.
int I_compute_scatts(struct Cell_head *, struct scCats *, const char **, const char **, int, struct scCats *, const char **)
Compute scatter plots data.
Definition: iscatt_core.c:685
FILE * I_fopen_group_file_append(const char *, const char *)
Definition: fopen.c:81
int I_georef(double, double, double *, double *, double *, double *, int)
int I_iclass_write_signatures(struct Signature *, const char *)
Write signtures to signature file.
int I_new_control_point(struct Control_Points *, double, double, double, double, int)
add new control point
Definition: points.c:56
int I_find_subgroup(const char *, const char *)
Searches for a subgroup in the current mapset.
Definition: imagery/find.c:86
int I_sc_add_cat(struct scCats *)
Add category.
int I_get_to_eol(char *, int, FILE *)
Definition: eol.c:13
FILE * I_fopen_group_ref_old(const char *)
Definition: ref.c:30
FILE * I_fopen_group_file_old2(const char *, const char *, const char *)
Open group file for reading.
Definition: fopen.c:117
int I_free_signatures(struct Signature *)
Free memory allocated for struct Signature.
Definition: sig.c:60
int I_get_group(char *)
Definition: group.c:37
FILE * I_fopen_group_ref_old2(const char *, const char *)
Definition: ref.c:35
int I_iclass_statistics_get_min(IClass_statistics *, int, int *)
Get minimum value in band.
int I_WriteSigSet(FILE *, const struct SigSet *)
Definition: sigset.c:394
int I_put_group(const char *)
Definition: group.c:54
double I_variance(double, double, int)
Definition: var.c:8
int I_iclass_statistics_get_histo(IClass_statistics *, int, int, int *)
Get histogram value in band.
FILE * I_fopen_subgroup_file_old2(const char *, const char *, const char *, const char *)
Definition: fopen.c:173
int I_list_group(const char *, const struct Ref *, FILE *)
Prints maps in a group (fancy version)
Definition: list_gp.c:26
int I_iclass_statistics_get_mean(IClass_statistics *, int, float *)
Get mean of cell category values in band.
int I_put_subgroup(const char *, const char *)
Definition: group.c:86
void I_iclass_statistics_get_nstd(IClass_statistics *, float *)
Get the multiplier of standard deviation.
char * I_location_info(const char *)
Definition: loc_info.c:7
int I_transfer_group_ref_file(const struct Ref *, int, struct Ref *)
copy Ref lists
Definition: group.c:434
double ** I_alloc_double2(int, int)
Definition: imagery/alloc.c:29
int ** I_alloc_int2(int, int)
Definition: imagery/alloc.c:62
const char * I_GetClassTitle(const struct ClassSig *)
Definition: sigset.c:386
int I_get_group_ref2(const char *, const char *, struct Ref *)
read group REF file
Definition: group.c:130
int I_signatures_copy(I_SIGFILE_TYPE, const char *, const char *, const char *)
Copy a signature file.
#define WARN_UNUSED_RESULT
Generate warning if function return value is unused.
Definition: gis.h:98
I_SIGFILE_TYPE
Definition: imagery.h:193
2D/3D raster map header (used also for region)
Definition: gis.h:440
Vector map info.
Definition: dig_structs.h:1243
Definition: imagery.h:24
Definition: imagery.h:94
Definition: imagery.h:67