GRASS GIS 8 Programmer's Manual
8.2.2dev(2023)-3d2c704037
|
#include <string.h>
#include <stdlib.h>
#include <grass/gis.h>
#include <grass/glocale.h>
#include <grass/imagery.h>
Go to the source code of this file.
Macros | |
#define | eq(a, b) strcmp(a,b)==0 |
Functions | |
int | I_SigSetNClasses (struct SigSet *S) |
struct ClassData * | I_AllocClassData (struct SigSet *S, struct ClassSig *C, int npixels) |
int | I_InitSigSet (struct SigSet *S, int nbands) |
Initialize struct SigSet before use. More... | |
struct ClassSig * | I_NewClassSig (struct SigSet *S) |
struct SubSig * | I_NewSubSig (struct SigSet *S, struct ClassSig *C) |
int | I_ReadSigSet (FILE *fd, struct SigSet *S) |
Read sigset signatures from file. More... | |
int | I_SetSigTitle (struct SigSet *S, const char *title) |
const char * | I_GetSigTitle (const struct SigSet *S) |
int | I_SetClassTitle (struct ClassSig *C, const char *title) |
const char * | I_GetClassTitle (const struct ClassSig *C) |
int | I_WriteSigSet (FILE *fd, const struct SigSet *S) |
char ** | I_SortSigSetBySemanticLabel (struct SigSet *S, const struct Ref *R) |
Reorder struct SigSet to match imagery group member order. More... | |
const char* I_GetClassTitle | ( | const struct ClassSig * | C | ) |
const char* I_GetSigTitle | ( | const struct SigSet * | S | ) |
int I_InitSigSet | ( | struct SigSet * | S, |
int | nbands | ||
) |
Initialize struct SigSet before use.
No need to call before calling I_ReadSigSet.
*Signature | to initialize |
nbands | band (imagery group member) count |
Definition at line 65 of file sigset.c.
References SigSet::ClassSig, G_malloc, SigSet::nbands, SigSet::nclasses, NULL, SigSet::semantic_labels, and SigSet::title.
Referenced by I_ReadSigSet().
Definition at line 78 of file sigset.c.
References ClassSig::classnum, SigSet::ClassSig, G_malloc, G_realloc, SigSet::nclasses, ClassSig::nsubclasses, NULL, SIGNATURE_TYPE_MIXED, ClassSig::title, ClassSig::type, and ClassSig::used.
Definition at line 98 of file sigset.c.
References SubSig::cnst, G_calloc, G_malloc, G_realloc, SubSig::means, SubSig::N, SigSet::nbands, ClassSig::nsubclasses, SubSig::pi, SubSig::R, SubSig::Rinv, ClassSig::SubSig, and SubSig::used.
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.
pointer | to FILE* |
pointer | to struct SigSet *S |
Definition at line 144 of file sigset.c.
References _, G_warning(), and I_InitSigSet().
int I_SetClassTitle | ( | struct ClassSig * | C, |
const char * | title | ||
) |
int I_SetSigTitle | ( | struct SigSet * | S, |
const char * | title | ||
) |
int I_SigSetNClasses | ( | struct SigSet * | S | ) |
Definition at line 32 of file sigset.c.
References SigSet::ClassSig, count, SigSet::nclasses, and ClassSig::used.
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:
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:
*SigSet | existing signatures to check & sort |
*Ref | group reference |
Definition at line 475 of file sigset.c.
References Ref::file, G_calloc, G_fatal_error(), G_malloc, Ref_Files::mapset, Ref_Files::name, SigSet::nbands, SigSet::nclasses, Ref::nfiles, and Rast_get_semantic_label_or_name().
int I_WriteSigSet | ( | FILE * | fd, |
const struct SigSet * | S | ||
) |
Definition at line 396 of file sigset.c.
References ClassSig::classnum, SigSet::ClassSig, I_GetClassTitle(), I_GetSigTitle(), SubSig::means, SigSet::nbands, SigSet::nclasses, ClassSig::nsubclasses, SubSig::pi, SubSig::R, SigSet::semantic_labels, ClassSig::SubSig, ClassSig::type, and ClassSig::used.