14 #define SIG struct One_Sig 27 for (n = 0; n < S->
nbands; n++)
32 sprintf(S->
sig[i].
desc,
"Class %d", i + 1);;
41 for (i = 0; i < S->
nsigs; i++) {
42 for (n = 0; n < S->
nbands; n++)
58 while ((i = fgetc(fd)) != EOF)
70 if (fscanf(fd,
"%d", &s->
npoints) != 1)
73 for (i = 0; i < S->
nbands; i++) {
74 if (fscanf(fd,
"%lf", &s->
mean[i]) != 1)
78 for (i = 0; i < S->
nbands; i++) {
79 for (n = 0; n <= i; n++) {
80 if (fscanf(fd,
"%lf", &s->
var[i][n]) != 1)
82 s->
var[n][i] = s->
var[i][n];
85 if (fscanf(fd,
"%f%f%f", &s->
r, &s->
g, &s->
b) == 3 &&
86 s->
r >= 0.0 && s->
r <= 1.0 &&
87 s->
g >= 0.0 && s->
g <= 1.0 && s->
b >= 0.0 && s->
b <= 1.0)
99 while ((n = fgetc(fd)) != EOF)
123 fprintf(fd,
"#%s\n", S->
title);
124 for (k = 0; k < S->
nsigs; k++) {
128 fprintf(fd,
"#%s\n", s->
desc);
129 fprintf(fd,
"%d\n", s->
npoints);
130 for (i = 0; i < S->
nbands; i++)
131 fprintf(fd,
"%g ", s->
mean[i]);
133 for (i = 0; i < S->
nbands; i++) {
134 for (n = 0; n <= i; n++)
135 fprintf(fd,
"%g ", s->
var[i][n]);
139 fprintf(fd,
"%g %g %g\n", s->
r, s->
g, s->
b);
int I_new_signature(struct Signature *S)
void G_strip(char *)
Removes all leading and trailing white space from string.
int I_read_signatures(FILE *fd, struct Signature *S)
int I_init_signatures(struct Signature *S, int nbands)
int I_write_signatures(FILE *fd, struct Signature *S)
int I_free_signatures(struct Signature *S)
int I_get_to_eol(char *, int, FILE *)
int I_read_one_signature(FILE *fd, struct Signature *S)