NAME
RputMinVal - set new minimum cell value
SYNOPSIS
#include "csf.h"
void RputMinVal
(
MAP *map,
const void *minVal
);
PARAMETERS
-
MAP *map
-
map handle
-
const void *minVal
-
New minimum value
DESCRIPTION
RputMinVal set a new value stored in
the header as the minimum value.
minMaxStatus is set to MM_DONTKEEPTRACK
NOTE
Note that the header minimum set must be equal or
smaller than the minimum value in the map.
EXAMPLE
#include
#include "csf.h"
/* set header min/max of a scalar map
* to 0 and 1, since it's a membership
* function
*/
void main(int argc, char *argv[] )
{
MAP *map;
REAL8 min,max;
if (argc != 2)
{
fprintf(stderr,"%s: no file specified\n",argv[0]);
exit(1);
}
if ((map = Mopen(argv[1], M_READ_WRITE)) == NULL)
{
Mperror(argv[1]);
exit(1);
}
if ( (! RvalueScaleIs(map, VS_SCALAR))
|| RuseAs(map, CR_REAL8) )
{
fprintf(stderr,"%s is not a scalar map\n", argv[1]);
exit(1);
}
if ( RgetMinVal(map, &min) &&
RgetMaxVal(map, &max) &&
min >= 0 && max <= 1)
{
min = 0; max = 1;
RputMinVal(map,&min);
RputMaxVal(map,&max);
}
else {
fprintf(stderr,
"%s: min/max not set or not in [0, 1]\n",
argv[1]);
exit(1);
}
Mclose(map);
exit(0);
}