Skip to content

Commit

Permalink
Rename band references to semantic labels (OSGeo#1928)
Browse files Browse the repository at this point in the history
Rename band references to semantic labels (fixes OSGeo#1868)
  • Loading branch information
marisn authored and ninsbl committed Oct 26, 2022
1 parent db95fc2 commit b98a46d
Show file tree
Hide file tree
Showing 61 changed files with 793 additions and 753 deletions.
2 changes: 1 addition & 1 deletion imagery/i.cca/i.cca.html
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ <h2>AUTHORS</h2>
Ali R. Vali,
University of Texas
<br>
Band reference support: Maris Nartiss,
Semantic label support: Maris Nartiss,
University of Latvia

<!--
Expand Down
4 changes: 2 additions & 2 deletions imagery/i.cca/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -135,9 +135,9 @@ int main(int argc, char *argv[])
if (nclass < 2)
G_fatal_error(_("Need at least two signatures in signature file."));

err = I_sort_signatures_by_bandref(&sigs, &refs);
err = I_sort_signatures_by_semantic_label(&sigs, &refs);
if (err)
G_fatal_error(_("Signature – group member band reference mismatch.\n"
G_fatal_error(_("Signature – group member semantic label mismatch.\n"
"Extra signatures for bands: %s\n"
"Imagery group bands without signatures: %s"),
err[0] ? err[0] : _("none"),
Expand Down
2 changes: 1 addition & 1 deletion imagery/i.cluster/global.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ extern int mcs;
extern char *group;
extern char *subgroup;
extern struct Ref ref;
extern char **bandrefs;
extern char **semantic_labels;
extern char outsigfile[GNAME_MAX + GMAPSET_MAX];
extern char *insigfile;
extern char *reportfile;
Expand Down
32 changes: 16 additions & 16 deletions imagery/i.cluster/i.cluster.html
Original file line number Diff line number Diff line change
Expand Up @@ -73,12 +73,12 @@ <h2>DESCRIPTION</h2>

<p>
For all raster maps used to generate signature file it is recommended
to have band reference set.
to have semantic label set.
Use <em><a href="r.support.html">r.support</a></em> to set
band references of each member of the imagery group.
semantc labels of each member of the imagery group.
Signatures generated for one scene are suitable for classification
of other scenes as long as they consist of same raster bands
(band references match). If band references are not set, it will be
(semantic labels match). If semantic labels are not set, it will be
possible to use obtained signature file to classify only the same
imagery group used for generating signatures.

Expand Down Expand Up @@ -287,22 +287,22 @@ <h2>EXAMPLE</h2>
to classify the current imagery group only (lsat7_2002).
If the user would like to re-use the signature file for the
classification of different imagery group(s), they can set
band references for each group member beforehand, i.e.,
semantic labels for each group member beforehand, i.e.,
before generating the signature files.
Band references are set by means of <em>r.support</em>
Semantic labels are set by means of <em>r.support</em>
as shown below:

<div class="code"><pre>
# Define band references for all LANDSAT bands
r.support map=lsat7_2002_10 bandref=TM7_1
r.support map=lsat7_2002_20 bandref=TM7_2
r.support map=lsat7_2002_30 bandref=TM7_3
r.support map=lsat7_2002_40 bandref=TM7_4
r.support map=lsat7_2002_50 bandref=TM7_5
r.support map=lsat7_2002_61 bandref=TM7_61
r.support map=lsat7_2002_62 bandref=TM7_62
r.support map=lsat7_2002_70 bandref=TM7_7
r.support map=lsat7_2002_80 bandref=TM7_8
# Define semantic labels for all LANDSAT bands
r.support map=lsat7_2002_10 semantic_label=TM7_1
r.support map=lsat7_2002_20 semantic_label=TM7_2
r.support map=lsat7_2002_30 semantic_label=TM7_3
r.support map=lsat7_2002_40 semantic_label=TM7_4
r.support map=lsat7_2002_50 semantic_label=TM7_5
r.support map=lsat7_2002_61 semantic_label=TM7_61
r.support map=lsat7_2002_62 semantic_label=TM7_62
r.support map=lsat7_2002_70 semantic_label=TM7_7
r.support map=lsat7_2002_80 semantic_label=TM7_8
</pre></div>

<h2>SEE ALSO</h2>
Expand Down Expand Up @@ -335,7 +335,7 @@ <h2>AUTHORS</h2>
Tao Wen,
University of Illinois at Urbana-Champaign, Illinois
<br>
Band reference support: Maris Nartiss,
Semantic label support: Maris Nartiss,
University of Latvia

<!--
Expand Down
4 changes: 2 additions & 2 deletions imagery/i.cluster/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ int mcs;
char *group;
char *subgroup;
struct Ref ref;
char **bandrefs;
char **semantic_labels;
char outsigfile[GNAME_MAX + GMAPSET_MAX];
char *insigfile;
char *reportfile;
Expand Down Expand Up @@ -334,7 +334,7 @@ int main(int argc, char *argv[])
if ((fd =
I_fopen_signature_file_new(outsigfile)) != NULL) {
for (unsigned int i = C.S.nbands; i--;)
C.S.bandrefs[i] = bandrefs[i];
C.S.semantic_labels[i] = semantic_labels[i];
I_write_signatures(fd, &C.S);
fclose(fd);
}
Expand Down
12 changes: 6 additions & 6 deletions imagery/i.cluster/open_files.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@

int open_files(void)
{
char *name, *mapset, **err, *bandref;
char *name, *mapset, **err, *semantic_label;
FILE *fd;
int n, missing;

I_init_group_ref(&ref);
I_free_group_ref(&ref);
I_get_subgroup_ref(group, subgroup, &ref);

bandrefs = (char **)G_malloc(ref.nfiles * sizeof(char **));
semantic_labels = (char **)G_malloc(ref.nfiles * sizeof(char **));
missing = 0;
for (n = 0; n < ref.nfiles; n++) {
name = ref.file[n].name;
Expand All @@ -25,8 +25,8 @@ int open_files(void)
G_warning(_("Raster map <%s> do not exists in subgroup <%s>"),
G_fully_qualified_name(name, mapset), subgroup);
}
bandref = Rast_get_bandref_or_name(ref.file[n].name, ref.file[n].mapset);
bandrefs[n] = G_store(bandref);
semantic_label = Rast_get_semantic_label_or_name(ref.file[n].name, ref.file[n].mapset);
semantic_labels[n] = G_store(semantic_label);
}
if (missing)
G_fatal_error(_("No raster maps found"));
Expand Down Expand Up @@ -66,9 +66,9 @@ int open_files(void)
G_fatal_error(_("<%s> has too many signatures (limit is 255)"),
insigfile);

err = I_sort_signatures_by_bandref(&in_sig, &ref);
err = I_sort_signatures_by_semantic_label(&in_sig, &ref);
if (err)
G_fatal_error(_("Signature – group member band reference mismatch.\n"
G_fatal_error(_("Signature – group member semantic label mismatch.\n"
"Extra signatures for bands: %s\n"
"Imagery group bands without signatures: %s"),
err[0] ? err[0] : _("none"),
Expand Down
14 changes: 7 additions & 7 deletions imagery/i.gensig/i.gensig.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,12 @@ <h2>DESCRIPTION</h2>
to actually create the final classified map.

<p>
All raster maps used to generate signature file must have band reference
All raster maps used to generate signature file can have semantic label
set. Use <em><a href="r.support.html">r.support</a></em> to set
band references of each member of the imagery group.
semantic labels of each member of the imagery group.
Signatures generated for one scene are suitable for classification
of other scenes as long as they consist of same raster bands
(band references match).
(semantic labels match).

<h2>OPTIONS</h2>

Expand Down Expand Up @@ -75,7 +75,7 @@ <h3>Parameters</h3>
and covariance matrices) for each class in the training map
that is associated with the band files in the subgroup
select (see <a href="#subgroup">above</a>). Resultant singature file
can be used with any other imagery group as long as band references
can be used with any other imagery group as long as semantic labels
match.
</dl>

Expand All @@ -91,7 +91,7 @@ <h2>NOTES</h2>
<div class="code"><pre>
1 1
2 #
3 Band_reference1
3 Semantic_label1
4 #water
5 4186
6 67.9508 48.7346 37.8915 15.3129 13.8473 12.0855
Expand All @@ -106,7 +106,7 @@ <h2>NOTES</h2>
<ul>
<li> Line 1: version number (currently always 1)
<li> Line 2: text label
<li> Line 3: Space separated list of band references
<li> Line 3: Space separated list of semantic labels
<li> Line 4: text label of class
<li> Line 5: number of points in class
<li> Line 6: mean values per band of the class
Expand All @@ -132,7 +132,7 @@ <h2>AUTHOR</h2>
Michael Shapiro,
U.S.Army Construction Engineering Research Laboratory
<br>
Band reference support: Maris Nartiss,
Semantic label support: Maris Nartiss,
University of Latvia

<!--
Expand Down
8 changes: 4 additions & 4 deletions imagery/i.gensig/openfiles.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
int openfiles(struct parms *parms, struct files *files, struct Signature *S)
{
struct Ref Ref; /* subgroup reference list */
const char *mapset, *bandref;
const char *mapset, *semantic_label;
int n;


Expand All @@ -37,13 +37,13 @@ int openfiles(struct parms *parms, struct files *files, struct Signature *S)
I_init_signatures(S, Ref.nfiles);

/* open all maps for reading and
store band references of imagery group bands */
store semantic labels of imagery group bands */
for (n = 0; n < Ref.nfiles; n++) {
files->band_fd[n] =
Rast_open_old(Ref.file[n].name, Ref.file[n].mapset);
files->band_cell[n] = Rast_allocate_d_buf();
bandref = Rast_get_bandref_or_name(Ref.file[n].name, Ref.file[n].mapset);
S->bandrefs[n] = G_store(bandref);
semantic_label = Rast_get_semantic_label_or_name(Ref.file[n].name, Ref.file[n].mapset);
S->semantic_labels[n] = G_store(semantic_label);
}

I_free_group_ref(&Ref);
Expand Down
8 changes: 4 additions & 4 deletions imagery/i.gensigset/i.gensigset.html
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@ <h2>DESCRIPTION</h2>

<p>
For all raster maps used to generate signature file it is recommended
to have band reference set.
to have semantic label set.
Use <em><a href="r.support.html">r.support</a></em> to set
band references of each member of the imagery group.
semantic labels of each member of the imagery group.
Signatures generated for one scene are suitable for classification
of other scenes as long as they consist of same raster bands
(band references match). If band references are not set, it will be
(semantic labels match). If semantic labels are not set, it will be
possible to use obtained signature file to classify only the same
imagery group used for generating signatures.

Expand Down Expand Up @@ -233,7 +233,7 @@ <h2>AUTHORS</h2>
Michael Shapiro,
U.S.Army Construction Engineering Research Laboratory
<br>
Band reference support: Maris Nartiss,
Semantic label support: Maris Nartiss,
University of Latvia

<!--
Expand Down
6 changes: 3 additions & 3 deletions imagery/i.gensigset/openfiles.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
int openfiles(struct parms *parms, struct files *files, struct SigSet *S)
{
struct Ref Ref; /* subgroup reference list */
const char *mapset, *bandref;
const char *mapset, *semantic_label;
int n;


Expand Down Expand Up @@ -41,8 +41,8 @@ int openfiles(struct parms *parms, struct files *files, struct SigSet *S)
files->band_fd[n] =
Rast_open_old(Ref.file[n].name, Ref.file[n].mapset);
files->band_cell[n] = Rast_allocate_d_buf();
bandref = Rast_get_bandref_or_name(Ref.file[n].name, Ref.file[n].mapset);
S->bandrefs[n] = G_store(bandref);
semantic_label = Rast_get_semantic_label_or_name(Ref.file[n].name, Ref.file[n].mapset);
S->semantic_labels[n] = G_store(semantic_label);
}

I_free_group_ref(&Ref);
Expand Down
2 changes: 1 addition & 1 deletion imagery/i.maxlik/i.maxlik.html
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ <h2>AUTHORS</h2>
University of Illinois at Urbana-Champaign,
Illinois
<br>
Band reference support: Maris Nartiss,
Semantic label support: Maris Nartiss,
University of Latvia

<!--
Expand Down
4 changes: 2 additions & 2 deletions imagery/i.maxlik/open.c
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,9 @@ int open_files(void)
G_fatal_error(_("<%s> has too many signatures (limit is 255)"),
sigfile);

err = I_sort_signatures_by_bandref(&S, &Ref);
err = I_sort_signatures_by_semantic_label(&S, &Ref);
if (err)
G_fatal_error(_("Signature – group member band reference mismatch.\n"
G_fatal_error(_("Signature – group member semantic label mismatch.\n"
"Extra signatures for bands: %s\n"
"Imagery group bands without signatures: %s"),
err[0] ? err[0] : _("none"),
Expand Down
28 changes: 14 additions & 14 deletions imagery/i.smap/i.smap.html
Original file line number Diff line number Diff line change
Expand Up @@ -176,22 +176,22 @@ <h2>EXAMPLE</h2>
to classify the current imagery group only (lsat7_2002).
If the user would like to re-use the signature file for the
classification of different imagery group(s), they can set
band references for each group member beforehand, i.e.,
semantic labels for each group member beforehand, i.e.,
before generating the signature files.
Band references are set by means of <em>r.support</em>
Semantic labels are set by means of <em>r.support</em>
as shown below:

<div class="code"><pre>
# Define band references for all LANDSAT bands
r.support map=lsat7_2002_10 bandref=TM7_1
r.support map=lsat7_2002_20 bandref=TM7_2
r.support map=lsat7_2002_30 bandref=TM7_3
r.support map=lsat7_2002_40 bandref=TM7_4
r.support map=lsat7_2002_50 bandref=TM7_5
r.support map=lsat7_2002_61 bandref=TM7_61
r.support map=lsat7_2002_62 bandref=TM7_62
r.support map=lsat7_2002_70 bandref=TM7_7
r.support map=lsat7_2002_80 bandref=TM7_8
# Define sematic labels for all LANDSAT bands
r.support map=lsat7_2002_10 semantic_label=TM7_1
r.support map=lsat7_2002_20 semantic_label=TM7_2
r.support map=lsat7_2002_30 semantic_label=TM7_3
r.support map=lsat7_2002_40 semantic_label=TM7_4
r.support map=lsat7_2002_50 semantic_label=TM7_5
r.support map=lsat7_2002_61 semantic_label=TM7_61
r.support map=lsat7_2002_62 semantic_label=TM7_62
r.support map=lsat7_2002_70 semantic_label=TM7_7
r.support map=lsat7_2002_80 semantic_label=TM7_8
</pre></div>

<h2>REFERENCES</h2>
Expand All @@ -216,7 +216,7 @@ <h2>REFERENCES</h2>
<h2>SEE ALSO</h2>

<em>
<a href="r.support.html">r.support</a></em> for setting band references,
<a href="r.support.html">r.support</a></em> for setting semantic labels,
<br>
<em>
<a href="i.group.html">i.group</a></em> for creating groups and subgroups
Expand All @@ -243,7 +243,7 @@ <h2>AUTHORS</h2>
U.S.Army Construction Engineering
Research Laboratory
<br>
Band reference support: Maris Nartiss,
Semantic label support: Maris Nartiss,
University of Latvia

<!--
Expand Down
4 changes: 2 additions & 2 deletions imagery/i.smap/openfiles.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@ int openfiles(struct parms *parms, struct files *files, struct SigSet *S)

fclose(fd);

err = I_SortSigSetByBandref(S, &Ref);
err = I_SortSigSetBySemanticLabel(S, &Ref);
if (err)
G_fatal_error(_("Signature – group member band reference mismatch.\n"
G_fatal_error(_("Signature – group member semantic label mismatch.\n"
"Extra signatures for bands: %s\n"
"Imagery group bands without signatures: %s"),
err[0] ? err[0] : _("none"),
Expand Down
2 changes: 1 addition & 1 deletion imagery/imageryintro.html
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ <h3>Image classification</h3>
<p>
Note - signatures generated for one scene are suitable for classification
of other scenes as long as they consist of same raster bands
(band references match). This comes handy when classifying multiple scenes
(semantic labels match). This comes handy when classifying multiple scenes
from a single sensor taken in different areas or different times.

<h3>Image fusion</h3>
Expand Down
4 changes: 2 additions & 2 deletions include/grass/defs/imagery.h
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ int I_free_signatures(struct Signature *);
int I_read_one_signature(FILE *, struct Signature *);
int I_read_signatures(FILE *, struct Signature *);
int I_write_signatures(FILE *, struct Signature *);
char **I_sort_signatures_by_bandref(struct Signature *, const struct Ref *);
char **I_sort_signatures_by_semantic_label(struct Signature *, const struct Ref *);

/* sigfile.c */
FILE *I_fopen_signature_file_new(const char *);
Expand All @@ -181,7 +181,7 @@ 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_SortSigSetByBandref(struct SigSet *, const struct Ref *);
char **I_SortSigSetBySemanticLabel(struct SigSet *, const struct Ref *);

/* sigsetfile.c */
FILE *I_fopen_sigset_file_new(const char *);
Expand Down
Loading

0 comments on commit b98a46d

Please sign in to comment.