GRASS GIS 8 Programmer's Manual  8.5.0dev(2024)-d6dec75dd4
defs/imagery.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

void * I_malloc (size_t)
 
void * I_realloc (void *, size_t)
 
int I_free (void *)
 
double ** I_alloc_double2 (int, int)
 
int * I_alloc_int (int)
 
int ** I_alloc_int2 (int, int)
 
int I_free_int2 (int **)
 
int I_free_double2 (double **)
 
double *** I_alloc_double3 (int, int, int)
 
int I_free_double3 (double ***)
 
int I_get_to_eol (char *, int, FILE *)
 
int I_find_group (const char *)
 does group exist? More...
 
int I_find_group2 (const char *, const char *)
 Does the group exists? More...
 
int I_find_group_file (const char *, const char *)
 Searches for a group file in the current mapset. More...
 
int I_find_group_file2 (const char *, const char *, const char *)
 Searches for a group file in the specified mapset. More...
 
int I_find_subgroup (const char *, const char *)
 Searches for a subgroup in the current mapset. More...
 
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. More...
 
int I_find_subgroup_file (const char *, const char *, const char *)
 Searches for a subgroup file in the current mapset. More...
 
int I_find_subgroup_file2 (const char *, const char *, const char *, const char *)
 Searches for a subgroup file in the specified mapset. More...
 
const char * I_find_signature (I_SIGFILE_TYPE, char *, const char *)
 Find mapset containing signature file. More...
 
const char * I_find_signature2 (I_SIGFILE_TYPE, const char *, const char *)
 Find mapset containing signature (look but don't touch) More...
 
FILE * I_fopen_group_file_new (const char *, const char *)
 
FILE * I_fopen_group_file_append (const char *, const char *)
 
FILE * I_fopen_group_file_old (const char *, const char *)
 Open group file for reading. More...
 
FILE * I_fopen_group_file_old2 (const char *, const char *, const char *)
 Open group file for reading. More...
 
FILE * I_fopen_subgroup_file_new (const char *, const char *, const char *)
 
FILE * I_fopen_subgroup_file_append (const char *, const char *, const char *)
 
FILE * I_fopen_subgroup_file_old (const char *, const char *, const char *)
 
FILE * I_fopen_subgroup_file_old2 (const char *, const char *, const char *, const char *)
 
int I_compute_georef_equations (struct Control_Points *, double *, double *, double *, double *, int)
 
int I_georef (double, double, double *, double *, double *, double *, int)
 
int I_compute_georef_equations_tps (struct Control_Points *, double **, double **, double **, double **)
 
int I_georef_tps (double, double, double *, double *, double *, double *, struct Control_Points *, int)
 
int I_get_group (char *)
 
int I_put_group (const char *)
 
int I_get_subgroup (const char *, char *)
 
int I_put_subgroup (const char *, const char *)
 
int I_get_group_ref (const char *, struct Ref *)
 read group REF file More...
 
int I_get_group_ref2 (const char *, const char *, struct Ref *)
 read group REF file More...
 
int I_get_subgroup_ref (const char *, const char *, struct Ref *)
 read subgroup REF file More...
 
int I_get_subgroup_ref2 (const char *, const char *, const char *, struct Ref *)
 read subgroup REF file More...
 
int I_init_ref_color_nums (struct Ref *)
 
int I_put_group_ref (const char *, const struct Ref *)
 write group REF file More...
 
int I_put_subgroup_ref (const char *, const char *, const struct Ref *)
 write subgroup REF file More...
 
int I_add_file_to_group_ref (const char *, const char *, struct Ref *)
 add file name to Ref structure More...
 
int I_transfer_group_ref_file (const struct Ref *, int, struct Ref *)
 copy Ref lists More...
 
int I_init_group_ref (struct Ref *)
 initialize Ref structure More...
 
int I_free_group_ref (struct Ref *)
 free Ref structure More...
 
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. More...
 
int I_iclass_init_group (const char *, const char *, struct Ref *)
 Read files for the specified group subgroup into the Ref structure. More...
 
void I_iclass_create_raster (IClass_statistics *, struct Ref *, const char *)
 Create raster map based on statistics. More...
 
void I_iclass_statistics_get_nbands (IClass_statistics *, int *)
 Get number of bands. More...
 
void I_iclass_statistics_get_cat (IClass_statistics *, int *)
 Get category (class). More...
 
void I_iclass_statistics_get_name (IClass_statistics *, const char **)
 Get category (class) name. More...
 
void I_iclass_statistics_get_color (IClass_statistics *, const char **)
 Get category (class) color. More...
 
void I_iclass_statistics_get_ncells (IClass_statistics *, int *)
 Get number of cells in training areas. More...
 
int I_iclass_statistics_get_max (IClass_statistics *, int, int *)
 Get maximum value in band. More...
 
int I_iclass_statistics_get_range_max (IClass_statistics *, int, int *)
 Get maximum cell value based on mean and standard deviation for band. More...
 
int I_iclass_statistics_get_min (IClass_statistics *, int, int *)
 Get minimum value in band. More...
 
int I_iclass_statistics_get_range_min (IClass_statistics *, int, int *)
 Get minimum cell value based on mean and standard deviation for band. More...
 
int I_iclass_statistics_get_sum (IClass_statistics *, int, float *)
 Get sum of values in band. More...
 
int I_iclass_statistics_get_mean (IClass_statistics *, int, float *)
 Get mean of cell category values in band. More...
 
int I_iclass_statistics_get_stddev (IClass_statistics *, int, float *)
 Get standard deviation of cell category values in band. More...
 
void I_iclass_statistics_get_nstd (IClass_statistics *, float *)
 Get the multiplier of standard deviation. More...
 
void I_iclass_statistics_set_nstd (IClass_statistics *, float)
 Set the multiplier of standard deviation. More...
 
int I_iclass_statistics_get_histo (IClass_statistics *, int, int, int *)
 Get histogram value in band. More...
 
int I_iclass_statistics_get_product (IClass_statistics *, int, int, float *)
 Get product value. More...
 
void I_iclass_init_statistics (IClass_statistics *, int, const char *, const char *, float)
 Initialize statistics. More...
 
void I_iclass_free_statistics (IClass_statistics *)
 Free space allocated for statistics attributes. More...
 
int I_iclass_init_signatures (struct Signature *, struct Ref *)
 Initialize signatures. More...
 
void I_iclass_add_signature (struct Signature *, IClass_statistics *)
 Add one signature. More...
 
int I_iclass_write_signatures (struct Signature *, const char *)
 Write signtures to signature file. More...
 
int I_list_group (const char *, const struct Ref *, FILE *)
 Prints maps in a group (fancy version) More...
 
int I_list_group_simple (const struct Ref *, FILE *)
 Prints maps in a group (simple version) More...
 
void I__list_group_name_fit (char *, const char *, const char *)
 Formats map name to fit in a 80 column layout. More...
 
char ** I_list_subgroups (const char *, int *)
 Get list of subgroups which a group contatins. More...
 
char ** I_list_subgroups2 (const char *, const char *, int *)
 Get list of subgroups which a group contatins. More...
 
int I_list_subgroup (const char *, const char *, const struct Ref *, FILE *)
 Prints maps in a subgroup (fancy version) More...
 
int I_list_subgroup_simple (const struct Ref *, FILE *)
 Prints maps in a subgroup (simple version) More...
 
char * I_location_info (const char *)
 
int I_new_control_point (struct Control_Points *, double, double, double, double, int)
 add new control point More...
 
int I_get_control_points (const char *, struct Control_Points *)
 read group control points More...
 
int I_put_control_points (const char *, const struct Control_Points *)
 write group control points More...
 
FILE * I_fopen_group_ref_new (const char *)
 
FILE * I_fopen_group_ref_old (const char *)
 
FILE * I_fopen_group_ref_old2 (const char *, const char *)
 
FILE * I_fopen_subgroup_ref_new (const char *, const char *)
 
FILE * I_fopen_subgroup_ref_old (const char *, const char *)
 
FILE * I_fopen_subgroup_ref_old2 (const char *, const char *, const char *)
 
void I_sc_init_cats (struct scCats *, int, int)
 Initialize structure for storing scatter plots data. More...
 
void I_sc_free_cats (struct scCats *)
 Free data of struct scCats, the structure itself remains allocated. More...
 
int I_sc_add_cat (struct scCats *)
 Add category. More...
 
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_DATA or SC_SCATT_CONDITIONS). More...
 
void I_scd_init_scatt_data (struct scdScattData *, int, int, void *)
 Insert scatter plot data. More...
 
int I_compute_scatts (struct Cell_head *, struct scCats *, const char **, const char **, int, struct scCats *, const char **)
 Compute scatter plots data. More...
 
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. The reason why the standard GRASS raster is not used is that for every modification (new area is selected) we would need to create whole new raster. Instead of this scatter plot only modifies affected region in the internal pgm file. More...
 
int I_insert_patch_to_cat_rast (const char *, struct Cell_head *, const char *)
 Insert raster map patch into pgm file. More...
 
int I_id_scatt_to_bands (const int, const int, int *, int *)
 Compute band ids from scatter plot id. More...
 
int I_bands_to_id_scatt (const int, const int, const int, int *)
 Compute scatter plot id from band ids. More...
 
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). More...
 
int I_apply_colormap (unsigned char *, unsigned char *, unsigned, unsigned char *, unsigned char *)
 Apply colromap to the raster. More...
 
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. More...
 
void I_get_signatures_dir (char *, I_SIGFILE_TYPE)
 Get signature directory. More...
 
void I_make_signatures_dir (I_SIGFILE_TYPE)
 Make signature dir. More...
 
int I_signatures_remove (I_SIGFILE_TYPE, const char *)
 Remove a signature file. More...
 
int I_signatures_copy (I_SIGFILE_TYPE, const char *, const char *, const char *)
 Copy a signature file. More...
 
int I_signatures_rename (I_SIGFILE_TYPE, const char *, const char *)
 Rename a signature file. More...
 
int I_signatures_list_by_type (I_SIGFILE_TYPE, const char *, char ***)
 Get list of existing signatures by type. More...
 
void I_free_signatures_list (int, char ***)
 Free memory allocated by I_signatures_list_by_type. More...
 
int I_init_signatures (struct Signature *, int)
 Initialize struct Signature before use. More...
 
int I_new_signature (struct Signature *)
 
int I_free_signatures (struct Signature *)
 Free memory allocated for struct Signature. More...
 
int I_read_one_signature (FILE *, struct Signature *)
 Internal function for I_read_signatures. More...
 
int I_read_signatures (FILE *, struct Signature *)
 Read signatures from file. More...
 
int I_write_signatures (FILE *, struct Signature *)
 Write signatures to file. More...
 
char ** I_sort_signatures_by_semantic_label (struct Signature *, const struct Ref *)
 Reorder struct Signature to match imagery group member order. More...
 
FILE * I_fopen_signature_file_new (const char *)
 Create signature file. More...
 
FILE * I_fopen_signature_file_old (const char *)
 Open existing signature file. More...
 
int I_SigSetNClasses (struct SigSet *)
 
struct ClassDataI_AllocClassData (struct SigSet *, struct ClassSig *, int)
 
int I_InitSigSet (struct SigSet *, int)
 Initialize struct SigSet before use. More...
 
struct ClassSigI_NewClassSig (struct SigSet *)
 
struct SubSigI_NewSubSig (struct SigSet *, struct ClassSig *)
 
int I_ReadSigSet (FILE *, struct SigSet *) WARN_UNUSED_RESULT
 Read sigset signatures from file. More...
 
int I_SetSigTitle (struct SigSet *, const char *)
 
const char * I_GetSigTitle (const struct SigSet *)
 
int I_SetClassTitle (struct ClassSig *, const char *)
 
const char * I_GetClassTitle (const struct ClassSig *)
 
int I_WriteSigSet (FILE *, const struct SigSet *)
 
char ** I_SortSigSetBySemanticLabel (struct SigSet *, const struct Ref *)
 Reorder struct SigSet to match imagery group member order. More...
 
FILE * I_fopen_sigset_file_new (const char *)
 Create new sigset file. More...
 
FILE * I_fopen_sigset_file_old (const char *)
 Open existing sigset signature file. More...
 
int I_get_target (const char *, char *, char *)
 read target information More...
 
int I_put_target (const char *, const char *, const char *)
 write target information More...
 
int I_get_group_title (const char *, char *, int)
 
int I_put_group_title (const char *, const char *)
 
double I_variance (double, double, int)
 
double I_stddev (double, double, int)
 

Function Documentation

◆ I__list_group_name_fit()

void I__list_group_name_fit ( char *  buf,
const char *  name,
const char *  mapset 
)

Formats map name to fit in a 80 column layout.

Results in a map name in the "<map@mapset>" form. If necessary truncates relevant part(s) and denotes with ellipsis, e.g. "<verylongmapname...@mapset>".

Parameters
[out]bufformatted map name
namemap name
mapsetmapset name

Definition at line 97 of file list_gp.c.

References name.

Referenced by I_list_group(), and I_list_subgroup().

◆ I_add_file_to_group_ref()

int I_add_file_to_group_ref ( const char *  name,
const char *  mapset,
struct Ref ref 
)

add file name to Ref structure

This routine adds the file name and mapset to the list contained in the ref structure, if it is not already in the list. The ref structure must have been properly initialized. This routine is used by programs, such as i.maxlik, to add to the group new raster maps created from files already in the group. Returns the index into the file array within the ref structure for the file after insertion; see Imagery_Library_Data_Structures.

Parameters
name
mapset
ref
Returns
int

Definition at line 386 of file group.c.

References Ref::file, G_malloc, G_realloc, Ref_Files::mapset, Ref_Files::name, name, Ref::nfiles, and strcpy.

Referenced by I_transfer_group_ref_file().

◆ I_alloc_double2()

double** I_alloc_double2 ( int  a,
int  b 
)

Definition at line 29 of file imagery/alloc.c.

Referenced by I_cluster_exec_allocate().

◆ I_alloc_double3()

double*** I_alloc_double3 ( int  a,
int  b,
int  c 
)

Definition at line 106 of file imagery/alloc.c.

◆ I_alloc_int()

int* I_alloc_int ( int  a)

Definition at line 49 of file imagery/alloc.c.

Referenced by I_cluster_exec_allocate().

◆ I_alloc_int2()

int** I_alloc_int2 ( int  a,
int  b 
)

Definition at line 62 of file imagery/alloc.c.

◆ I_AllocClassData()

struct ClassData* I_AllocClassData ( struct SigSet S,
struct ClassSig C,
int  npixels 
)

Definition at line 43 of file sigset.c.

◆ I_apply_colormap()

int I_apply_colormap ( unsigned char *  vals,
unsigned char *  vals_mask,
unsigned  nvals,
unsigned char *  colmap,
unsigned char *  col_vals 
)

Apply colromap to the raster.

Implemented for speeding up of scatter plots rendering.

Parameters
valsarray of values for applying the colormap
vals_maskmask of vals array
nvalsnumber of items of vals_mask and vals array
colmapcolour map to be applied
[out]col_valsoutput raster with applied color map (length is 4 * nvals (RGBA))
Returns
0

Definition at line 891 of file iscatt_core.c.

◆ I_bands_to_id_scatt()

int I_bands_to_id_scatt ( const int  b_1_id,
const int  b_2_id,
const int  n_bands,
int *  scatt_id 
)

Compute scatter plot id from band ids.

See also I_id_scatt_to_bands

Parameters
b_1_idid of band1
b_1_idid of band2
n_bandsnumber of bands
[out]scatt_idscatter plot id
Returns
0

Definition at line 70 of file iscatt_structs.c.

◆ I_compute_georef_equations()

int I_compute_georef_equations ( struct Control_Points ,
double *  ,
double *  ,
double *  ,
double *  ,
int   
)

◆ I_compute_georef_equations_tps()

int I_compute_georef_equations_tps ( struct Control_Points cp,
double **  E12tps,
double **  N12tps,
double **  E21tps,
double **  N21tps 
)

◆ I_compute_scatts()

int I_compute_scatts ( struct Cell_head region,
struct scCats scatt_conds,
const char **  cats_rasts_conds,
const char **  bands,
int  n_bands,
struct scCats scatts,
const char **  cats_rasts 
)

Compute scatter plots data.

If category has not defined category raster condition file and no scatter plot exists with condition, default/full scatter plot is computed. Warning: calls Rast_set_window

Parameters
regionanalysis region, beaware that all input data must be prepared for this region (bands (their ranges), cats_rasts_conds rasters...)
regionfunction calls Rast_set_window for this region
scatt_condspointer to scScatts struct of type SC_SCATT_CONDITIONS, where are stored selected areas (conditions) in scatter plots
cats_rasts_condspaths to category raster conditions files representing selected areas from mapwindow (conditions) in rasters for every category
cats_rasts_condsindex in array represents corresponding category id
cats_rasts_condsfor manipulation with category raster conditions file see also I_id_scatt_to_bands and I_insert_patch_to_cat_rast
bandsnames of analyzed bands, order of bands is defined by their id
n_bandsnumber of bands
[out]scattspointer to scScatts struct of type SC_SCATT_DATA, where are computed scatter plots stored
[out]cats_rastsarray of raster maps names for every category where will be stored all selected pixels
Returns
0 on success
-1 on failure

Definition at line 685 of file iscatt_core.c.

◆ I_create_cat_rast()

int I_create_cat_rast ( struct Cell_head cat_rast_region,
const char *  cat_rast 
)

Create category raster conditions file. The file is used for holding selected areas from mapwindow. The reason why the standard GRASS raster is not used is that for every modification (new area is selected) we would need to create whole new raster. Instead of this scatter plot only modifies affected region in the internal pgm file.

Parameters
cat_rast_regionregion to be file generated for
[out]cat_rastpath where the pgm raster file will be generated

Definition at line 59 of file iscatt_core.c.

References G_warning().

◆ I_find_group()

int I_find_group ( const char *  group)

does group exist?

Returns 1 if the specified group exists in the current mapset; 0 otherwise. Use I_find_group2 to search in all or a specific mapset.

Parameters
group
Returns
int 1 if group was found, 0 otherwise

Definition at line 21 of file imagery/find.c.

References G_find_file2(), G_mapset(), and NULL.

Referenced by I_find_group_file(), I_find_subgroup(), I_find_subgroup_file(), I_get_subgroup(), and I_put_subgroup().

◆ I_find_group2()

int I_find_group2 ( const char *  group,
const char *  mapset 
)

Does the group exists?

Finds a group in specified mapset or any mapset if mapset is not set. Internally uses G_find_file2().

Parameters
group
mapset
Returns
int 1 if group was found, 0 otherwise

Definition at line 40 of file imagery/find.c.

References G_find_file2(), and NULL.

Referenced by I_find_group_file2(), I_find_subgroup2(), I_find_subgroup_file2(), and list_subgroups().

◆ I_find_group_file()

int I_find_group_file ( const char *  group,
const char *  file 
)

Searches for a group file in the current mapset.

Parameters
group
file
Returns
int 1 if file was found, 0 otherwise

Definition at line 52 of file imagery/find.c.

References file, G_find_file2_misc(), G_mapset(), I_find_group(), and NULL.

◆ I_find_group_file2()

int I_find_group_file2 ( const char *  group,
const char *  mapset,
const char *  file 
)

Searches for a group file in the specified mapset.

Parameters
group
file
Returns
int 1 if file was found, 0 otherwise

Definition at line 69 of file imagery/find.c.

References file, G_find_file2_misc(), I_find_group2(), and NULL.

Referenced by fopen_group_file_old().

◆ I_find_signature()

const char* I_find_signature ( I_SIGFILE_TYPE  type,
char *  name,
const char *  mapset 
)

Find mapset containing signature file.

Looks for the signature name of type type in the database. The mapset parameter can either be the empty string "", which means search all the mapsets in the users current mapset search path (see Mapset_Search_Path for more details about the search path) or it can be a specific mapset name, which means look for the signature only in this one mapset (for example, in the current mapset). If found, the mapset where the signature lives is returned. If not found, the NULL pointer is returned.

Note: If the user specifies a fully qualified signature name which exists, then I_find_signature() modifies name by removing the "@<i>mapset</i>". Use I_find_signature2 if altering passed in name is not desired.

Parameters
typeI_SIGFILE_TYPE
nameof signature
mapsetset NULL to search in all mapsets
Returns
mapset or NULL

Definition at line 204 of file imagery/find.c.

◆ I_find_signature2()

const char* I_find_signature2 ( I_SIGFILE_TYPE  type,
const char *  name,
const char *  mapset 
)

Find mapset containing signature (look but don't touch)

Looks for the signature name of type type in the database. The mapset parameter can either be the empty string "", which means search all the mapsets in the users current mapset search path (see Mapset_Search_Path for more details about the search path) or it can be a specific mapset name, which means look for the signature only in this one mapset (for example, in the current mapset). If found, the mapset where the signature lives is returned. If not found, the NULL pointer is returned.

Note: The passed name argument is not altered. Use I_find_signature if stripping mapset part from the name is desired.

Parameters
typeI_SIGFILE_TYPE
nameof signature
mapsetset NULL to search in all mapsets
Returns
mapset or NULL

Definition at line 240 of file imagery/find.c.

◆ I_find_subgroup()

int I_find_subgroup ( const char *  group,
const char *  subgroup 
)

Searches for a subgroup in the current mapset.

Parameters
group
subgroup
Returns
int 1 if subgroup was found, 0 otherwise

Definition at line 86 of file imagery/find.c.

References G_debug(), G_find_file2_misc(), G_mapset(), GNAME_MAX, HOST_DIRSEP, I_find_group(), and NULL.

◆ I_find_subgroup2()

int I_find_subgroup2 ( const char *  group,
const char *  subgroup,
const char *  mapset 
)

Searches for a subgroup in specified mapset or any mapset if mapset is not set.

Parameters
group
subgroup
mapset
Returns
int 1 if subrgoup was found, 0 otherwise

Definition at line 110 of file imagery/find.c.

References G_debug(), G_find_file2_misc(), GNAME_MAX, HOST_DIRSEP, I_find_group2(), and NULL.

◆ I_find_subgroup_file()

int I_find_subgroup_file ( const char *  group,
const char *  subgroup,
const char *  file 
)

Searches for a subgroup file in the current mapset.

Parameters
group
subgroup
file
Returns
int 1 if file was found, 0 otherwise

Definition at line 134 of file imagery/find.c.

References file, G_debug(), G_find_file2_misc(), G_mapset(), GNAME_MAX, HOST_DIRSEP, I_find_group(), and NULL.

◆ I_find_subgroup_file2()

int I_find_subgroup_file2 ( const char *  group,
const char *  subgroup,
const char *  mapset,
const char *  file 
)

Searches for a subgroup file in the specified mapset.

Parameters
group
subgroup
mapset
file
Returns
int 1 if file was found, 0 otherwise

Definition at line 162 of file imagery/find.c.

References file, G_debug(), G_find_file2_misc(), GNAME_MAX, HOST_DIRSEP, I_find_group2(), and NULL.

Referenced by fopen_subgroup_file_old().

◆ I_fopen_group_file_append()

FILE* I_fopen_group_file_append ( const char *  group,
const char *  file 
)

Definition at line 81 of file fopen.c.

References _, file, G_fopen_append_misc(), G_mapset(), and G_warning().

◆ I_fopen_group_file_new()

FILE* I_fopen_group_file_new ( const char *  group,
const char *  file 
)

◆ I_fopen_group_file_old()

FILE* I_fopen_group_file_old ( const char *  group,
const char *  file 
)

Open group file for reading.

Internally uses G_fopen_old_misc

Parameters
group
file
Returns
FILE *

Definition at line 102 of file fopen.c.

References file, fopen_group_file_old(), and NULL.

Referenced by I_fopen_group_ref_old(), I_get_control_points(), I_get_group_title(), I_get_subgroup(), and I_get_target().

◆ I_fopen_group_file_old2()

FILE* I_fopen_group_file_old2 ( const char *  group,
const char *  mapset,
const char *  file 
)

Open group file for reading.

Internally uses G_fopen_old_misc

Parameters
group
mapset
file
Returns
FILE *

Definition at line 117 of file fopen.c.

References file, and fopen_group_file_old().

Referenced by I_fopen_group_ref_old2().

◆ I_fopen_group_ref_new()

FILE* I_fopen_group_ref_new ( const char *  group)

Definition at line 25 of file ref.c.

References I_fopen_group_file_new().

◆ I_fopen_group_ref_old()

FILE* I_fopen_group_ref_old ( const char *  group)

Definition at line 30 of file ref.c.

References I_fopen_group_file_old().

◆ I_fopen_group_ref_old2()

FILE* I_fopen_group_ref_old2 ( const char *  group,
const char *  mapset 
)

Definition at line 35 of file ref.c.

References I_fopen_group_file_old2().

◆ I_fopen_signature_file_new()

FILE* I_fopen_signature_file_new ( const char *  name)

Create signature file.

Returns a pointer to FILE for writing signature file. Use fclose on the pointer to close after use.

Parameters
namesignature filename
Returns
pointer to FILE
NULL on error

Definition at line 28 of file sigfile.c.

References G_fopen_new_misc(), GNAME_MAX, I_get_signatures_dir(), I_make_signatures_dir(), I_SIGFILE_TYPE_SIG, and name.

◆ I_fopen_signature_file_old()

FILE* I_fopen_signature_file_old ( const char *  name)

Open existing signature file.

Use fully qualified names for signatures from other mapsets.

Returns a pointer to FILE with signature. Use fclose on the pointer after use.

Parameters
namesignature filename
Returns
pointer to FILE
NULL on error

Definition at line 54 of file sigfile.c.

References G_fopen_old_misc(), G_mapset(), G_unqualified_name(), GMAPSET_MAX, GNAME_MAX, I_get_signatures_dir(), I_SIGFILE_TYPE_SIG, name, NULL, and strcpy.

◆ I_fopen_sigset_file_new()

FILE* I_fopen_sigset_file_new ( const char *  name)

Create new sigset file.

Parameters
namename of sigset file
Returns
pointer to FILE
NULL on error

Definition at line 28 of file sigsetfile.c.

References G_fopen_new_misc(), GNAME_MAX, I_get_signatures_dir(), I_make_signatures_dir(), I_SIGFILE_TYPE_SIGSET, and name.

◆ I_fopen_sigset_file_old()

FILE* I_fopen_sigset_file_old ( const char *  name)

Open existing sigset signature file.

Parameters
namename of signature file (may be fully qualified)
Returns
pointer to FILE*
NULL on error

Definition at line 50 of file sigsetfile.c.

References G_fopen_old_misc(), G_mapset(), G_unqualified_name(), GMAPSET_MAX, GNAME_MAX, I_get_signatures_dir(), I_SIGFILE_TYPE_SIGSET, name, NULL, and strcpy.

◆ I_fopen_subgroup_file_append()

FILE* I_fopen_subgroup_file_append ( const char *  group,
const char *  subgroup,
const char *  file 
)

◆ I_fopen_subgroup_file_new()

FILE* I_fopen_subgroup_file_new ( const char *  group,
const char *  subgroup,
const char *  file 
)

◆ I_fopen_subgroup_file_old()

FILE* I_fopen_subgroup_file_old ( const char *  group,
const char *  subgroup,
const char *  file 
)

Definition at line 167 of file fopen.c.

References file, fopen_subgroup_file_old(), and NULL.

Referenced by I_fopen_subgroup_ref_old().

◆ I_fopen_subgroup_file_old2()

FILE* I_fopen_subgroup_file_old2 ( const char *  group,
const char *  subgroup,
const char *  mapset,
const char *  file 
)

Definition at line 173 of file fopen.c.

References file, and fopen_subgroup_file_old().

Referenced by I_fopen_subgroup_ref_old2().

◆ I_fopen_subgroup_ref_new()

FILE* I_fopen_subgroup_ref_new ( const char *  group,
const char *  subgroup 
)

Definition at line 49 of file ref.c.

References I_fopen_subgroup_file_new().

◆ I_fopen_subgroup_ref_old()

FILE* I_fopen_subgroup_ref_old ( const char *  group,
const char *  subgroup 
)

Definition at line 54 of file ref.c.

References I_fopen_subgroup_file_old().

◆ I_fopen_subgroup_ref_old2()

FILE* I_fopen_subgroup_ref_old2 ( const char *  group,
const char *  subgroup,
const char *  mapset 
)

Definition at line 62 of file ref.c.

References I_fopen_subgroup_file_old2().

◆ I_free()

int I_free ( void *  b)

Definition at line 21 of file imagery/alloc.c.

References b, G_free(), and NULL.

Referenced by I_cluster_exec_free().

◆ I_free_double2()

int I_free_double2 ( double **  x)

Definition at line 93 of file imagery/alloc.c.

References G_free(), NULL, and x.

Referenced by I_cluster_exec_free(), and I_free_double3().

◆ I_free_double3()

int I_free_double3 ( double ***  x)

Definition at line 128 of file imagery/alloc.c.

References G_free(), I_free_double2(), NULL, and x.

◆ I_free_group_ref()

int I_free_group_ref ( struct Ref ref)

free Ref structure

This routine frees memory allocated to the ref structure.

Parameters
ref
Returns
int

Definition at line 484 of file group.c.

References Ref::file, free(), and Ref::nfiles.

Referenced by I_iclass_init_group().

◆ I_free_int2()

int I_free_int2 ( int **  x)

Definition at line 80 of file imagery/alloc.c.

References G_free(), NULL, and x.

◆ I_free_signatures()

int I_free_signatures ( struct Signature S)

Free memory allocated for struct Signature.

One must call I_init_signatures() to re-use struct after it has been passed to this function.

Parameters
*Signatureto free
Returns
always 0

Definition at line 60 of file sig.c.

References free(), One_Sig::mean, Signature::nbands, Signature::nsigs, NULL, Signature::semantic_labels, Signature::sig, Signature::title, and One_Sig::var.

Referenced by I_cluster_begin().

◆ I_free_signatures_list()

void I_free_signatures_list ( int  count,
char ***  list 
)

Free memory allocated by I_signatures_list_by_type.

Calls G_free for all list items returned by I_signatures_list_by_type() Sets pointer to NULL to prevent accidental use after free.

Parameters
intReturn value of I_signatures_list_by_type()
pointerto array filled by I_signatures_list_by_type()

Definition at line 264 of file manage_signatures.c.

References count, G_free(), and NULL.

◆ I_georef()

int I_georef ( double  ,
double  ,
double *  ,
double *  ,
double *  ,
double *  ,
int   
)

◆ I_georef_tps()

int I_georef_tps ( double  e1,
double  n1,
double *  e,
double *  n,
double *  E,
double *  N,
struct Control_Points cp,
int  fwd 
)

◆ I_get_control_points()

int I_get_control_points ( const char *  group,
struct Control_Points cp 
)

read group control points

Reads the control points from the POINTS file for the group into the cp structure. Returns 1 if successful; 0 otherwise (and prints a diagnostic error). Note. An error message is printed if the POINTS file is invalid, or does not exist.

Parameters
group
cp
Returns
int

Definition at line 113 of file points.c.

References _, G_mapset(), G_warning(), I_fopen_group_file_old(), NULL, and POINT_FILE.

◆ I_get_group()

int I_get_group ( char *  group)

Definition at line 37 of file group.c.

References G_fopen_old(), G_mapset(), G_suppress_warnings(), GROUPFILE, and NULL.

◆ I_get_group_ref()

int I_get_group_ref ( const char *  group,
struct Ref ref 
)

read group REF file

Reads the contents of the REF file for the specified group into the ref structure. Returns 1 if successful; 0 otherwise (but no error messages are printed).

Parameters
group
ref
Returns
int

Definition at line 112 of file group.c.

Referenced by I_iclass_init_group().

◆ I_get_group_ref2()

int I_get_group_ref2 ( const char *  group,
const char *  mapset,
struct Ref ref 
)

read group REF file

Reads the contents of the REF file for the specified group into the ref structure. Returns 1 if successful; 0 otherwise (but no error messages are printed).

Parameters
group
mapset
ref
Returns
int

Definition at line 130 of file group.c.

◆ I_get_group_title()

int I_get_group_title ( const char *  group,
char *  title,
int  n 
)

Definition at line 4 of file title.c.

References G_getl2(), G_suppress_warnings(), I_fopen_group_file_old(), and NULL.

◆ I_get_signatures_dir()

void I_get_signatures_dir ( char *  dir,
I_SIGFILE_TYPE  type 
)

Get signature directory.

The directory will be in a form "signatures/<type>".

Parameters
dir[GNAME_MAX] allocated string buffer
typeI_SIGFILE_TYPE

Definition at line 29 of file manage_signatures.c.

Referenced by I_fopen_signature_file_new(), I_fopen_signature_file_old(), I_fopen_sigset_file_new(), and I_fopen_sigset_file_old().

◆ I_get_subgroup()

int I_get_subgroup ( const char *  group,
char *  subgroup 
)

Definition at line 67 of file group.c.

References G_suppress_warnings(), I_find_group(), I_fopen_group_file_old(), NULL, and SUBGROUPFILE.

◆ I_get_subgroup_ref()

int I_get_subgroup_ref ( const char *  group,
const char *  subgroup,
struct Ref ref 
)

read subgroup REF file

Reads the contents of the REF file for the specified subgroup of the specified group into the ref structure. Returns 1 if successful; 0 otherwise (but no error messages are printed).

Parameters
group
subgroup
ref
Returns
int

Definition at line 149 of file group.c.

Referenced by I_iclass_init_group().

◆ I_get_subgroup_ref2()

int I_get_subgroup_ref2 ( const char *  group,
const char *  subgroup,
const char *  mapset,
struct Ref ref 
)

read subgroup REF file

Reads the contents of the REF file for the specified subgroup of the specified group into the ref structure. Returns 1 if successful; 0 otherwise (but no error messages are printed).

Parameters
group
subgroup
mapset
ref
Returns
int

Definition at line 168 of file group.c.

◆ I_get_target()

int I_get_target ( const char *  group,
char *  location,
char *  mapset 
)

read target information

Reads the target location and mapset from the TARGET file for the specified group. Returns 1 if successful; 0 otherwise (and prints a diagnostic error). This routine is used by g.gui.gcp and i.rectify and probably should not be used by other programs. Note. This routine does not validate the target information.

Parameters
group
location
mapset
Returns
int

Definition at line 22 of file target.c.

References _, G_suppress_warnings(), G_warning(), I_fopen_group_file_old(), and NULL.

◆ I_get_to_eol()

int I_get_to_eol ( char *  line,
int  len,
FILE *  fd 
)

Definition at line 13 of file eol.c.

◆ I_GetClassTitle()

const char* I_GetClassTitle ( const struct ClassSig C)

Definition at line 386 of file sigset.c.

References ClassSig::title.

Referenced by I_WriteSigSet().

◆ I_GetSigTitle()

const char* I_GetSigTitle ( const struct SigSet S)

Definition at line 367 of file sigset.c.

References SigSet::title.

Referenced by I_WriteSigSet().

◆ I_iclass_add_signature()

void I_iclass_add_signature ( struct Signature sigs,
IClass_statistics statistics 
)

◆ I_iclass_analysis()

int I_iclass_analysis ( IClass_statistics statistics,
struct Ref refer,
struct Map_info map_info,
const char *  layer_name,
const char *  group,
const char *  raster_name 
)

Calculates statistical values for one class and multiple bands based on training areas.

Calculates values statistical based on the cells that are within training areas. Creates raster map to display the cells of the image bands which fall within standard deviations from the means.

Parameters
statisticspointer to bands statistics
referpointer to band files structure
map_infovector map with training areas
layer_namevector layer
groupname of imagery group
raster_namename of temporary raster map (to be created)
Returns
number of processed training areas
-1 on failure

Definition at line 50 of file iclass.c.

References _, alloc_statistics(), IClass_statistics::cat, close_band_files(), create_raster(), free_perimeters(), G_debug(), G_get_set_window(), G_warning(), make_all_statistics(), Ref::nfiles, open_band_files(), and vector2perimeters().

◆ I_iclass_create_raster()

void I_iclass_create_raster ( IClass_statistics statistics,
struct Ref refer,
const char *  raster_name 
)

Create raster map based on statistics.

Parameters
statisticspointer to bands statistics
referpointer to band files structure
raster_namename of temporary raster map (to be created)

Definition at line 160 of file iclass.c.

References b, band_range(), close_band_files(), create_raster(), IClass_statistics::nbands, and open_band_files().

◆ I_iclass_free_statistics()

void I_iclass_free_statistics ( IClass_statistics statistics)

◆ I_iclass_init_group()

int I_iclass_init_group ( const char *  group_name,
const char *  subgroup_name,
struct Ref refer 
)

Read files for the specified group subgroup into the Ref structure.

Parameters
group_namename of imagery group
subgroup_namename of imagery subgroup
subgroup_nameif it is NULL, bands from group will be used
[out]referpointer to band files structure
Returns
1 on success
0 on failure

Definition at line 105 of file iclass.c.

References _, Ref::file, G_debug(), G_find_raster(), G_warning(), I_free_group_ref(), I_get_group_ref(), I_get_subgroup_ref(), I_init_group_ref(), Ref_Files::mapset, Ref_Files::name, Ref::nfiles, and NULL.

◆ I_iclass_init_signatures()

int I_iclass_init_signatures ( struct Signature sigs,
struct Ref refer 
)

Initialize signatures.

Parameters
[out]sigspointer to signatures
referpointer to band files structure
Returns
1 on success
0 on failure

Definition at line 45 of file iclass_signatures.c.

References Ref::file, G_debug(), I_init_signatures(), Ref_Files::mapset, Ref_Files::name, Ref::nfiles, Rast_get_semantic_label_or_name(), and Signature::semantic_labels.

◆ I_iclass_init_statistics()

void I_iclass_init_statistics ( IClass_statistics statistics,
int  category,
const char *  name,
const char *  color,
float  nstd 
)

◆ I_iclass_statistics_get_cat()

void I_iclass_statistics_get_cat ( IClass_statistics statistics,
int *  cat 
)

Get category (class).

Parameters
statisticspointer to statistics structure
[out]catcategory

Definition at line 471 of file iclass_statistics.c.

References IClass_statistics::cat.

◆ I_iclass_statistics_get_color()

void I_iclass_statistics_get_color ( IClass_statistics statistics,
const char **  color 
)

Get category (class) color.

Note
color is pointer to already allocated const char * in statistics. You should not free it.
Parameters
statisticspointer to statistics structure
[out]colorcategory color

Definition at line 502 of file iclass_statistics.c.

References IClass_statistics::color.

◆ I_iclass_statistics_get_histo()

int I_iclass_statistics_get_histo ( IClass_statistics statistics,
int  band,
int  cat,
int *  value 
)

Get histogram value in band.

Each band has one value for each raster cell category. Value is number of cells in category.

Parameters
statisticspointer to statistics structure
bandband index
catraster cell category
[out]valuenumber of cells in category
Returns
1 on success
0 band index or cell category value out of range

Definition at line 670 of file iclass_statistics.c.

References _, IClass_statistics::band_histo, G_warning(), and IClass_statistics::nbands.

◆ I_iclass_statistics_get_max()

int I_iclass_statistics_get_max ( IClass_statistics statistics,
int  band,
int *  max 
)

Get maximum value in band.

Parameters
statisticspointer to statistics structure
bandband index
[out]maxmaximum value
Returns
1 on success
0 band index out of range

Definition at line 574 of file iclass_statistics.c.

References _, IClass_statistics::band_max, G_warning(), max, and IClass_statistics::nbands.

◆ I_iclass_statistics_get_mean()

int I_iclass_statistics_get_mean ( IClass_statistics statistics,
int  band,
float *  mean 
)

Get mean of cell category values in band.

Parameters
statisticspointer to statistics structure
bandband index
[out]meanmean
Returns
1 on success
0 band index out of range

Definition at line 620 of file iclass_statistics.c.

References _, IClass_statistics::band_mean, G_warning(), mean(), and IClass_statistics::nbands.

◆ I_iclass_statistics_get_min()

int I_iclass_statistics_get_min ( IClass_statistics statistics,
int  band,
int *  min 
)

Get minimum value in band.

Parameters
statisticspointer to statistics structure
bandband index
[out]minminimum value
Returns
1 on success
0 band index out of range

Definition at line 551 of file iclass_statistics.c.

References _, IClass_statistics::band_min, G_warning(), min, and IClass_statistics::nbands.

◆ I_iclass_statistics_get_name()

void I_iclass_statistics_get_name ( IClass_statistics statistics,
const char **  name 
)

Get category (class) name.

Note
name is pointer to already allocated const char * in statistics. You should not free it.
Parameters
statisticspointer to statistics structure
[out]namecategory name

Definition at line 486 of file iclass_statistics.c.

References IClass_statistics::name, and name.

◆ I_iclass_statistics_get_nbands()

void I_iclass_statistics_get_nbands ( IClass_statistics statistics,
int *  nbands 
)

Get number of bands.

Parameters
statisticspointer to statistics structure
[out]nbandsnumber of bands

Definition at line 460 of file iclass_statistics.c.

References IClass_statistics::nbands.

◆ I_iclass_statistics_get_ncells()

void I_iclass_statistics_get_ncells ( IClass_statistics statistics,
int *  ncells 
)

Get number of cells in training areas.

Parameters
statisticspointer to statistics structure
[out]ncellsnumber of cells

Definition at line 514 of file iclass_statistics.c.

References IClass_statistics::ncells.

◆ I_iclass_statistics_get_nstd()

void I_iclass_statistics_get_nstd ( IClass_statistics statistics,
float *  nstd 
)

Get the multiplier of standard deviation.

Parameters
statisticspointer to statistics structure
[out]nstdmultiplier of standard deviation

Definition at line 525 of file iclass_statistics.c.

References IClass_statistics::nstd.

◆ I_iclass_statistics_get_product()

int I_iclass_statistics_get_product ( IClass_statistics statistics,
int  band1,
int  band2,
float *  value 
)

Get product value.

Product value of two bands is sum of products of cell category values of two bands. Only cells from training areas are taken into account.

Parameters
statisticsstatistics object
band1index of first band
band2index of second band
[out]valueproduct value
Returns
1 on success
0 band index out of range

Definition at line 702 of file iclass_statistics.c.

References _, IClass_statistics::band_product, G_warning(), and IClass_statistics::nbands.

◆ I_iclass_statistics_get_range_max()

int I_iclass_statistics_get_range_max ( IClass_statistics statistics,
int  band,
int *  max 
)

Get maximum cell value based on mean and standard deviation for band.

Parameters
statisticspointer to statistics structure
bandband index
[out]maxmaximum value
Returns
1 on success
0 band index out of range

Definition at line 748 of file iclass_statistics.c.

References _, IClass_statistics::band_range_max, G_warning(), max, and IClass_statistics::nbands.

◆ I_iclass_statistics_get_range_min()

int I_iclass_statistics_get_range_min ( IClass_statistics statistics,
int  band,
int *  min 
)

Get minimum cell value based on mean and standard deviation for band.

Parameters
statisticspointer to statistics structure
bandband index
[out]minminimum value
Returns
1 on success
0 band index out of range

Definition at line 725 of file iclass_statistics.c.

References _, IClass_statistics::band_range_min, G_warning(), min, and IClass_statistics::nbands.

◆ I_iclass_statistics_get_stddev()

int I_iclass_statistics_get_stddev ( IClass_statistics statistics,
int  band,
float *  stddev 
)

Get standard deviation of cell category values in band.

Parameters
statisticspointer to statistics structure
bandband index
[out]stddevstandard deviation
Returns
1 on success
0 band index out of range

Definition at line 643 of file iclass_statistics.c.

References _, IClass_statistics::band_stddev, G_warning(), IClass_statistics::nbands, and stddev().

◆ I_iclass_statistics_get_sum()

int I_iclass_statistics_get_sum ( IClass_statistics statistics,
int  band,
float *  sum 
)

Get sum of values in band.

Parameters
statisticspointer to statistics structure
bandband index
[out]sumsum
Returns
1 on success
0 band index out of range

Definition at line 597 of file iclass_statistics.c.

References _, IClass_statistics::band_sum, G_warning(), and IClass_statistics::nbands.

◆ I_iclass_statistics_set_nstd()

void I_iclass_statistics_set_nstd ( IClass_statistics statistics,
float  nstd 
)

Set the multiplier of standard deviation.

Parameters
statisticspointer to statistics structure
nstdmultiplier of standard deviation

Definition at line 536 of file iclass_statistics.c.

References IClass_statistics::nstd.

◆ I_iclass_write_signatures()

int I_iclass_write_signatures ( struct Signature sigs,
const char *  file_name 
)

Write signtures to signature file.

Parameters
sigspointer to signatures
file_namename of signature file
Returns
1 on success
0 on failure

Definition at line 108 of file iclass_signatures.c.

◆ I_id_scatt_to_bands()

int I_id_scatt_to_bands ( const int  scatt_id,
const int  n_bands,
int *  b_1_id,
int *  b_2_id 
)

Compute band ids from scatter plot id.

Scatter plot id describes which bands defines the scatter plot.

Let say we have 3 bands, their ids are 0, 1 and 2. Scatter plot with id 0 consists of band 1 (b_1_id) 0 and band 2 (b_2_id) 1. All scatter plots: scatt_id b_1_id b_2_id 0 0 1 1 0 2 2 1 2

Parameters
scatt_idscatter plot id
n_bandsnumber of bands
[out]b_1_idid of band1
[out]b_2_idid of band2
Returns
0

Definition at line 41 of file iscatt_structs.c.

Referenced by I_sc_insert_scatt_data().

◆ I_init_group_ref()

int I_init_group_ref ( struct Ref ref)

initialize Ref structure

This routine initializes the ref structure for other library calls which require a Ref structure. This routine must be called before any use of the structure can be made. Note. The routines I_get_group_ref and I_get_subgroup_ref call this routine automatically.

Parameters
ref
Returns
int

Definition at line 466 of file group.c.

References Ref::blu, Ref_Color::n, Ref::nfiles, NULL, and Ref_Color::table.

Referenced by I_iclass_init_group().

◆ I_init_ref_color_nums()

int I_init_ref_color_nums ( struct Ref ref)

Definition at line 253 of file group.c.

References Ref::blu, Ref_Color::index, Ref_Color::n, Ref::nfiles, NULL, and Ref_Color::table.

◆ I_init_signatures()

int I_init_signatures ( struct Signature S,
int  nbands 
)

Initialize struct Signature before use.

No need to call before calling I_read_signatures.

Parameters
*Signatureto initialize
nbandsband (imagery group member) count

Definition at line 14 of file sig.c.

References G_malloc, Signature::have_oclass, Signature::nbands, Signature::nsigs, NULL, Signature::semantic_labels, Signature::sig, and Signature::title.

Referenced by I_cluster_begin(), I_cluster_clear(), and I_iclass_init_signatures().

◆ I_InitSigSet()

int I_InitSigSet ( struct SigSet S,
int  nbands 
)

Initialize struct SigSet before use.

No need to call before calling I_ReadSigSet.

Parameters
*Signatureto initialize
nbandsband (imagery group member) count

Definition at line 64 of file sigset.c.

References SigSet::ClassSig, G_malloc, SigSet::nbands, SigSet::nclasses, NULL, SigSet::semantic_labels, and SigSet::title.

Referenced by I_ReadSigSet().

◆ I_insert_patch_to_cat_rast()

int I_insert_patch_to_cat_rast ( const char *  patch_rast,
struct Cell_head cat_rast_region,
const char *  cat_rast 
)

Insert raster map patch into pgm file.

See also
I_create_cat_rast

Warning: calls Rast_set_window

Parameters
patch_rastname of raster map
cat_rast_regionregion of category raster file
cat_rastpath to category raster file
Returns
0 on success
-1 on failure

Definition at line 231 of file iscatt_core.c.

◆ I_list_group()

int I_list_group ( const char *  group,
const struct Ref ref,
FILE *  fd 
)

Prints maps in a group (fancy version)

Parameters
groupgroup name
refgroup reference (set with I_get_group_ref())
fdwhere to print (typically stdout)
Returns
0

Definition at line 26 of file list_gp.c.

References _, Ref::file, I__list_group_name_fit(), Ref_Files::mapset, max, Ref_Files::name, and Ref::nfiles.

◆ I_list_group_simple()

int I_list_group_simple ( const struct Ref ref,
FILE *  fd 
)

Prints maps in a group (simple version)

Same as I_list_group(), but without all the fancy stuff. Prints one map per line in map@mapset form.

Parameters
refgroup reference (set with I_get_group_ref())
fdwhere to print (typically stdout)
Returns
0

Definition at line 73 of file list_gp.c.

References Ref::file, Ref_Files::mapset, Ref_Files::name, and Ref::nfiles.

Referenced by I_list_subgroup_simple().

◆ I_list_subgroup()

int I_list_subgroup ( const char *  group,
const char *  subgroup,
const struct Ref ref,
FILE *  fd 
)

Prints maps in a subgroup (fancy version)

Parameters
groupgroup name
subgroupsubgroup name
refgroup reference (set with I_get_subgroup_ref())
fdwhere to print (typically stdout)
Returns
0

Definition at line 81 of file list_subgp.c.

References _, Ref::file, I__list_group_name_fit(), Ref_Files::mapset, max, Ref_Files::name, and Ref::nfiles.

◆ I_list_subgroup_simple()

int I_list_subgroup_simple ( const struct Ref ref,
FILE *  fd 
)

Prints maps in a subgroup (simple version)

Same as I_list_subgroup(), but without all the fancy stuff. Prints one map per line in map@mapset form.

Parameters
refgroup reference (set with I_get_subgroup_ref())
fdwhere to print (typically stdout)
Returns
0

Definition at line 134 of file list_subgp.c.

References I_list_group_simple().

◆ I_list_subgroups()

char** I_list_subgroups ( const char *  group,
int *  subgs_num 
)

Get list of subgroups which a group contatins.

Parameters
groupgroup name
[out]subgs_numnumber of subgroups which the group contains
Returns
array of subgroup names

Definition at line 52 of file list_subgp.c.

References G_mapset(), and list_subgroups().

◆ I_list_subgroups2()

char** I_list_subgroups2 ( const char *  group,
const char *  mapset,
int *  subgs_num 
)

Get list of subgroups which a group contatins.

Parameters
groupgroup name
mapsetmapset name
[out]subgs_numnumber of subgroups which the group contains
Returns
array of subgroup names

Definition at line 67 of file list_subgp.c.

References list_subgroups().

◆ I_location_info()

char* I_location_info ( const char *  middle)

Definition at line 7 of file loc_info.c.

References G_calloc, G_location(), and G_mapset().

◆ I_make_signatures_dir()

void I_make_signatures_dir ( I_SIGFILE_TYPE  type)

Make signature dir.

Creates directories for storage of signature files of specified type. E.g. "<location>/<mapset>/signatures/<type>/"

Parameters
typeI_SIGFILE_TYPE

Definition at line 53 of file manage_signatures.c.

Referenced by I_fopen_signature_file_new(), and I_fopen_sigset_file_new().

◆ I_malloc()

void* I_malloc ( size_t  n)

Definition at line 5 of file imagery/alloc.c.

References b, and G_malloc.

◆ I_merge_arrays()

int I_merge_arrays ( unsigned char *  merged_arr,
unsigned char *  overlay_arr,
unsigned  rows,
unsigned  cols,
double  alpha 
)

Merge arrays according to opacity. Every pixel in array must be represented by 4 values (RGBA).

Implemented for speeding up of scatter plots rendering.

Parameters
merged_arrarray which will be overlayd with overlay_arr
overlay_arrarray to be merged_arr overlaid with
rowsnumber of rows for the both arrays
colsnumber of columns for the both arrays
alphatransparency (0-1) of the overlay array for merging
Returns
0

Definition at line 848 of file iscatt_core.c.

◆ I_new_control_point()

int I_new_control_point ( struct Control_Points cp,
double  e1,
double  n1,
double  e2,
double  n2,
int  status 
)

add new control point

Once the control points have been read into the cp structure, this routine adds new points to it. The new control point is given by e1 (column) and n1 (row) on the image, and the e2 (east) and n2 (north) for the target database. The value of status should be 1 if the point is a valid point; 0 otherwise.

Remarks
{Use of this routine implies that the point is probably good, so status should be set to 1.}
Parameters
cp
e1
n1
e2
n2
status
Returns
int

Definition at line 56 of file points.c.

References Control_Points::count, Control_Points::e1, Control_Points::e2, G_realloc, Control_Points::n1, Control_Points::n2, and Control_Points::status.

◆ I_new_signature()

int I_new_signature ( struct Signature S)

◆ I_NewClassSig()

◆ I_NewSubSig()

struct SubSig* I_NewSubSig ( struct SigSet S,
struct ClassSig C 
)

◆ I_put_control_points()

int I_put_control_points ( const char *  group,
const struct Control_Points cp 
)

write group control points

Writes the control points from the cp structure to the POINTS file for the specified group. Note. Points in cp with a negative status are not written to the POINTS file.

Parameters
group
cp
Returns
int

Definition at line 148 of file points.c.

References _, G_mapset(), G_warning(), I_fopen_group_file_new(), NULL, and POINT_FILE.

◆ I_put_group()

int I_put_group ( const char *  group)

Definition at line 54 of file group.c.

References G_fopen_new(), GROUPFILE, and NULL.

◆ I_put_group_ref()

int I_put_group_ref ( const char *  group,
const struct Ref ref 
)

write group REF file

Writes the contents of the ref structure to the REF file for the specified group. Returns 1 if successful; 0 otherwise (and prints a diagnostic error). Note. This routine will create the group, if it does not already exist.

Parameters
group
ref
Returns
int

Definition at line 310 of file group.c.

◆ I_put_group_title()

int I_put_group_title ( const char *  group,
const char *  title 
)

Definition at line 20 of file title.c.

References I_fopen_group_file_new(), and NULL.

◆ I_put_subgroup()

int I_put_subgroup ( const char *  group,
const char *  subgroup 
)

Definition at line 86 of file group.c.

References I_find_group(), I_fopen_group_file_new(), NULL, and SUBGROUPFILE.

◆ I_put_subgroup_ref()

int I_put_subgroup_ref ( const char *  group,
const char *  subgroup,
const struct Ref ref 
)

write subgroup REF file

Writes the contents of the ref structure into the REF file for the specified subgroup of the specified group. Returns 1 if successful; 0 otherwise (and prints a diagnostic error). Note. This routine will create the subgroup, if it does not already exist.

Parameters
group
subgroup
ref
Returns
int

Definition at line 331 of file group.c.

◆ I_put_target()

int I_put_target ( const char *  group,
const char *  location,
const char *  mapset 
)

write target information

Writes the target location and mapset to the TARGET file for the specified group. Returns 1 if successful; 0 otherwise (but no error messages are printed). This routine is used by i.target and probably should not be used by other programs. Note. This routine does not validate the target information.

Parameters
group
location
mapset
Returns
int

Definition at line 61 of file target.c.

References I_fopen_group_file_new(), and NULL.

◆ I_rasterize()

int I_rasterize ( double *  polygon,
int  pol_n_pts,
unsigned char  val,
struct Cell_head rast_region,
unsigned char *  rast 
)

Wrapper for using of iclass perimeter rasterization by scatter plot. Warning: calls Rast_set_window.

Parameters
polygonarray of polygon coordinates [x, y, x, y...]
pol_n_ptsnumber of points in the polygon array
valvalue to be assigned to cells, which belong to plygon
rast_regionregion of raster
[out]rastraster to be pologyn rasterized in
Returns
0 on success
1 on failure

Definition at line 934 of file iscatt_core.c.

◆ I_read_one_signature()

int I_read_one_signature ( FILE *  fd,
struct Signature S 
)

Internal function for I_read_signatures.

Definition at line 88 of file sig.c.

◆ I_read_signatures()

int I_read_signatures ( FILE *  fd,
struct Signature S 
)

Read signatures from file.

File stream should be opened in advance by call to I_fopen_signature_file_old() It is up to caller to fclose the file stream afterwards.

There is no need to initialize struct Signature in advance, as this function internally calls I_init_signatures.

Parameters
pointerto FILE*
pointerto struct Signature *S
Returns
1 on success, -1 on failure

Definition at line 147 of file sig.c.

◆ I_ReadSigSet()

int I_ReadSigSet ( FILE *  fd,
struct SigSet S 
)

Read sigset signatures from file.

File stream should be opened in advance by call to I_fopen_sigset_file_old() It is up to caller to fclose the file stream afterwards.

There is no need to initialise struct SigSet in advance, as this function internally calls I_InitSigSet.

Parameters
pointerto FILE*
pointerto struct SigSet *S
Returns
1 on success, -1 on failure

Definition at line 141 of file sigset.c.

References _, G_warning(), and I_InitSigSet().

◆ I_realloc()

void* I_realloc ( void *  b,
size_t  n 
)

Definition at line 14 of file imagery/alloc.c.

References b, and G_realloc.

◆ I_sc_add_cat()

int I_sc_add_cat ( struct scCats cats)

Add category.

Category represents group of scatter plots.

Parameters
catspointer to scCats struct
Returns
assigned category id (starts with 0)
-1 if maximum number of categories was reached

Definition at line 155 of file iscatt_structs.c.

References scCats::cats_arr, scCats::cats_ids, scCats::cats_idxs, G_malloc, G_zero(), scCats::n_a_cats, scScatts::n_a_scatts, scCats::n_cats, scCats::n_scatts, scScatts::scatt_idxs, scScatts::scatts_arr, and scScatts::scatts_bands.

◆ I_sc_free_cats()

void I_sc_free_cats ( struct scCats cats)

Free data of struct scCats, the structure itself remains allocated.

Parameters
catspointer to existing scCats struct

Definition at line 119 of file iscatt_structs.c.

References scCats::cats_arr, scCats::cats_ids, scCats::cats_idxs, G_free(), scCats::n_a_cats, scCats::n_bands, scCats::n_cats, scCats::n_scatts, scScatts::scatt_idxs, scScatts::scatts_arr, scScatts::scatts_bands, and scCats::type.

◆ I_sc_init_cats()

void I_sc_init_cats ( struct scCats cats,
int  n_bands,
int  type 
)

Initialize structure for storing scatter plots data.

Parameters
catspointer to scCats struct
n_bandsnumber of bands
typeSC_SCATT_DATA - stores scatter plots
typeSC_SCATT_CONDITIONS - stores selected areas in scatter plots

Definition at line 89 of file iscatt_structs.c.

◆ I_sc_insert_scatt_data()

int I_sc_insert_scatt_data ( struct scCats cats,
struct scdScattData scatt_data,
int  cat_id,
int  scatt_id 
)

Insert scatter plot data . Inserted scatt_data struct must have same type as cats struct (SC_SCATT_DATA or SC_SCATT_CONDITIONS).

Parameters
catspointer to scCats struct
scarr_datapointer to scdScattData struct
cat_idid number of category
scatt_idid number of scatter plot
Returns
0 on success
-1 on failure

Definition at line 208 of file iscatt_structs.c.

References scdScattData::b_conds_arr, scCats::cats_arr, scCats::cats_idxs, I_id_scatt_to_bands(), scScatts::n_a_scatts, scCats::n_bands, scCats::n_cats, scCats::n_scatts, SC_SCATT_CONDITIONS, SC_SCATT_DATA, scScatts::scatt_idxs, scdScattData::scatt_vals_arr, scScatts::scatts_arr, scScatts::scatts_bands, and scCats::type.

◆ I_scd_init_scatt_data()

void I_scd_init_scatt_data ( struct scdScattData scatt_data,
int  type,
int  n_vals,
void *  data 
)

Insert scatter plot data.

Parameters
scatt_datapointer to existing struct scdScattData
typeSC_SCATT_DATA for scatter plots or SC_SCATT_CONDITIONS for selected areas in scatter plot
n_valsnumber of data values
dataarray of values (unsigned char for SC_SCATT_CONDITIONS, unsigned int for SC_SCATT_DATA)

Definition at line 259 of file iscatt_structs.c.

◆ I_SetClassTitle()

int I_SetClassTitle ( struct ClassSig C,
const char *  title 
)

Definition at line 375 of file sigset.c.

References free(), G_store(), NULL, and ClassSig::title.

◆ I_SetSigTitle()

int I_SetSigTitle ( struct SigSet S,
const char *  title 
)

Definition at line 356 of file sigset.c.

References free(), G_store(), NULL, and SigSet::title.

◆ I_signatures_copy()

int I_signatures_copy ( I_SIGFILE_TYPE  type,
const char *  old_name,
const char *  old_mapset,
const char *  new_name 
)

Copy a signature file.

If copy fails, prints warning messages and returns 1. It is safe to pass fully qualified names.

Parameters
typeI_SIGFILE_TYPE signature type
nameof old signature
mapsetof old signature
nameof new signature
Returns
0 on success
1 on failure

Definition at line 114 of file manage_signatures.c.

◆ I_signatures_list_by_type()

int I_signatures_list_by_type ( I_SIGFILE_TYPE  type,
const char *  mapset,
char ***  out_list 
)

Get list of existing signatures by type.

Fills passed list with fully qualified names of existing signatures.

If no mapset is passed, all mapsets in the search path are used. If no signatures are found, returns 0 and list is set to NULL.

The function will assign memory for the list. It is up to callee to free the memory of each list item and the list itself.

Parameters
typeI_SIGFILE_TYPE signature type
mapsetoptional mapset to search in or NULL
pointerto array of found signature strings or NULL if none found
Returns
count of signature strings in the array

Definition at line 237 of file manage_signatures.c.

◆ I_signatures_remove()

int I_signatures_remove ( I_SIGFILE_TYPE  type,
const char *  name 
)

Remove a signature file.

If removal fails, prints a warning and returns 1. It is safe to pass fully qualified names.

Parameters
typeI_SIGFILE_TYPE signature type
nameof signature to remove
Returns
0 on success
1 on failure

Definition at line 75 of file manage_signatures.c.

◆ I_signatures_rename()

int I_signatures_rename ( I_SIGFILE_TYPE  type,
const char *  old_name,
const char *  new_name 
)

Rename a signature file.

If rename fails, prints warning messages and returns 1. It is safe to pass fully qualified names.

Parameters
typeI_SIGFILE_TYPE signature type
nameof old signature
nameof new signature
Returns
0 on success
1 on failure

Definition at line 172 of file manage_signatures.c.

◆ I_SigSetNClasses()

int I_SigSetNClasses ( struct SigSet S)

Definition at line 32 of file sigset.c.

References SigSet::ClassSig, count, SigSet::nclasses, and ClassSig::used.

◆ I_sort_signatures_by_semantic_label()

char** I_sort_signatures_by_semantic_label ( struct Signature S,
const struct Ref R 
)

Reorder struct Signature to match imagery group member order.

The function will check for semantic label match between signature struct and imagery group.

In the case of a complete semantic label match, values of passed in struct Signature are reordered to match the order of imagery group items.

If all semantic labels are not identical (in arbitrary order), function will return two dimensional array with comma separated list of:

  • [0] semantic labels present in the signature struct but absent in the imagery group
  • [1] semantic labels present in the imagery group but absent in the signature struct

If no mismatch of simantic labels for signatures or imagery group are detected (== all are present in the other list), a NULL value will be returned in the particular list of mismatches (not an empty string). For example:

if (ret && ret[1]) printf("List of imagery group bands without
signatures: %s\n, ret[1]);
Parameters
*Signatureexisting signatures to check & sort
*Refgroup reference
Returns
NULL successfully sorted
err_array two comma separated lists of mismatches

Definition at line 323 of file sig.c.

References Ref::file, G_calloc, G_fatal_error(), G_malloc, Ref_Files::mapset, Ref_Files::name, Signature::nbands, Ref::nfiles, Signature::nsigs, and Rast_get_semantic_label_or_name().

◆ I_SortSigSetBySemanticLabel()

char** I_SortSigSetBySemanticLabel ( struct SigSet S,
const struct Ref R 
)

Reorder struct SigSet to match imagery group member order.

The function will check for semantic label match between sigset struct and imagery group.

In the case of a complete semantic label match, values of passed in struct SigSet are reordered to match the order of imagery group items. This reordering is done only for items present in the sigset file. Thus reordering should be done only after calling I_ReadSigSet.

If all semantic labels are not identical (in arbitrary order), function will return two dimensional array with comma separated list of:

  • [0] semantic labels present in the signature struct but absent in the imagery group
  • [1] semantic labels present in the imagery group but absent in the signature struct

If no mismatch of semantic labels for signatures or imagery group are detected (== all are present in the other list), a NULL value will be returned in the particular list of mismatches (not an empty string). For example:

if (ret && ret[1]) printf("List of imagery group bands without
signatures: %s\n, ret[1]);
Parameters
*SigSetexisting signatures to check & sort
*Refgroup reference
Returns
NULL successfully sorted
err_array two comma separated lists of mismatches

Definition at line 474 of file sigset.c.

References G_calloc, G_fatal_error(), G_malloc, SigSet::nbands, SigSet::nclasses, SubSig::R, and Rast_get_semantic_label_or_name().

◆ I_stddev()

double I_stddev ( double  sum,
double  sum2,
int  n 
)

Definition at line 16 of file var.c.

References I_variance().

◆ I_transfer_group_ref_file()

int I_transfer_group_ref_file ( const struct Ref ref2,
int  n,
struct Ref ref1 
)

copy Ref lists

This routine is used to copy file names from one Ref structure to another. The name and mapset for file n from the src structure are copied into the dst structure (which must be properly initialized). For example, the following code copies one Ref structure to another:

struct Ref src,dst;
int n;
// some code to get information into <b>src</b>
...
I_init_group_ref (&dst);
for (n = 0; n < src.nfiles; n++)
int I_transfer_group_ref_file(const struct Ref *, int, struct Ref *)
copy Ref lists
Definition: group.c:434
char * dst
Definition: lz4.h:981
const char * src
Definition: lz4.h:989
Definition: imagery.h:24

This routine is used by g.gui.gcp to create the REF file for a subgroup.

Parameters
src
n
dst
Returns
int

Definition at line 434 of file group.c.

References Ref::blu, Ref::file, I_add_file_to_group_ref(), Ref_Files::mapset, Ref_Color::n, and Ref_Files::name.

◆ I_variance()

double I_variance ( double  sum,
double  sum2,
int  n 
)

Definition at line 8 of file var.c.

Referenced by I_stddev().

◆ I_write_signatures()

int I_write_signatures ( FILE *  fd,
struct Signature S 
)

Write signatures to file.

File stream should be opened in advance by call to I_fopen_signature_file_new() It is up to caller to fclose the file stream afterwards.

Parameters
pointerto FILE*
pointerto struct Signature *S
Returns
always 1

Definition at line 245 of file sig.c.

◆ I_WriteSigSet()