GRASS GIS 8 Programmer's Manual
8.5.0dev(2024)-36359e2344
|
Go to the source code of this file.
Macros | |
#define | SIG struct One_Sig |
Functions | |
int | I_init_signatures (struct Signature *S, int nbands) |
Initialize struct Signature before use. More... | |
int | I_new_signature (struct Signature *S) |
int | I_free_signatures (struct Signature *S) |
Free memory allocated for struct Signature. More... | |
int | I_read_one_signature (FILE *fd, struct Signature *S) |
Internal function for I_read_signatures. More... | |
int | I_read_signatures (FILE *fd, struct Signature *S) |
Read signatures from file. More... | |
int | I_write_signatures (FILE *fd, struct Signature *S) |
Write signatures to file. More... | |
char ** | I_sort_signatures_by_semantic_label (struct Signature *S, const struct Ref *R) |
Reorder struct Signature to match imagery group member order. More... | |
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.
*Signature | to free |
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().
int I_init_signatures | ( | struct Signature * | S, |
int | nbands | ||
) |
Initialize struct Signature before use.
No need to call before calling I_read_signatures.
*Signature | to initialize |
nbands | band (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().
int I_new_signature | ( | struct Signature * | S | ) |
Definition at line 30 of file sig.c.
References One_Sig::desc, G_calloc, G_realloc, One_Sig::have_color, One_Sig::mean, Signature::nbands, Signature::nsigs, Signature::sig, SIG, One_Sig::status, and One_Sig::var.
Referenced by I_iclass_add_signature().
int I_read_one_signature | ( | FILE * | fd, |
struct Signature * | S | ||
) |
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.
pointer | to FILE* |
pointer | to struct Signature *S |
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:
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:
*Signature | existing signatures to check & sort |
*Ref | group reference |
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().
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.
pointer | to FILE* |
pointer | to struct Signature *S |