--- ray/src/common/falsecolor.c 2005/11/15 06:52:38 3.2 +++ ray/src/common/falsecolor.c 2005/11/15 20:04:50 3.3 @@ -1,5 +1,5 @@ #ifndef lint -static const char RCSid[] = "$Id: falsecolor.c,v 3.2 2005/11/15 06:52:38 greg Exp $"; +static const char RCSid[] = "$Id: falsecolor.c,v 3.3 2005/11/15 20:04:50 greg Exp $"; #endif /* * False color mapping functions. @@ -49,7 +49,7 @@ fcFixedLinear(FCstruct *fcs, double Lwmax) return(TM_E_NOMEM); mult = 255.999/tmLuminance(fcs->mbrmax); for (i = fcs->mbrmin; i <= fcs->mbrmax; i++) - fcs->lumap[i] = (int)(mult * tmLuminance(i)); + fcs->lumap[i - fcs->mbrmin] = (int)(mult * tmLuminance(i)); returnOK; } @@ -68,22 +68,21 @@ fcFixedLog(FCstruct *fcs, double Lwmin, double Lwmax) fcs->lumap = (BYTE *)malloc(sizeof(BYTE)*(fcs->mbrmax - fcs->mbrmin + 1)); if (fcs->lumap == NULL) return(TM_E_NOMEM); - for (i = fcs->mbrmin; i <= fcs->mbrmax; i++) - fcs->lumap[i] = 256*(i - fcs->mbrmin) / - (fcs->mbrmax - fcs->mbrmin + 1); + for (i = fcs->mbrmax - fcs->mbrmin; i >= 0; i--) + fcs->lumap[i] = 256L * i / (fcs->mbrmax - fcs->mbrmin + 1); returnOK; } /* Compute linear false color map */ int -fcLinearMapping(FCstruct *fcs, TMstruct *tms, int pctile) +fcLinearMapping(FCstruct *fcs, TMstruct *tms, double pctile) { int i; int32 histot, cnt; TMbright wbrmin, wbrmax; if ((fcs == NULL) | (tms == NULL) || (tms->histo == NULL) | - (0 > pctile) | (pctile >= 100)) + (0 > pctile) | (pctile >= 50)) return(TM_E_ILLEGAL); histot = 0; for (i = tms->hbrmax - tms->hbrmin; i >= 0; ) @@ -99,14 +98,14 @@ fcLinearMapping(FCstruct *fcs, TMstruct *tms, int pcti /* Compute logarithmic false color map */ int -fcLogMapping(FCstruct *fcs, TMstruct *tms, int pctile) +fcLogMapping(FCstruct *fcs, TMstruct *tms, double pctile) { int i; int32 histot, cnt; TMbright wbrmin, wbrmax; if ((fcs == NULL) | (tms == NULL) || (tms->histo == NULL) | - (0 > pctile) | (pctile >= 100)) + (0 > pctile) | (pctile >= 50)) return(TM_E_ILLEGAL); histot = 0; for (i = tms->hbrmax - tms->hbrmin; i >= 0; ) @@ -199,45 +198,260 @@ fcDone(FCstruct *fcs) } BYTE fcDefaultScale[256][3] = { /* default false color scale */ - 48,0,68, 45,0,70, 42,0,72, 39,0,74, 36,0,76, 33,0,78, 30,0,81, - 27,0,83, 24,0,85, 21,0,87, 18,0,89, 15,0,91, 13,0,94, 12,0,96, - 11,0,99, 9,0,101, 8,0,104, 7,0,106, 6,0,109, 5,0,111, 4,0,114, - 2,0,116, 1,0,119, 0,0,121, 0,0,122, 0,1,123, 0,1,124, 0,2,125, - 0,2,125, 0,3,126, 0,4,127, 0,4,128, 0,5,129, 0,5,129, 0,6,130, - 0,7,131, 0,9,131, 0,11,132, 0,13,133, 0,16,133, 0,18,134, - 0,20,134, 0,22,135, 0,24,135, 0,26,136, 0,29,136, 0,31,137, - 0,34,137, 0,37,136, 0,41,136, 0,45,135, 0,48,135, 0,52,135, - 0,55,134, 0,59,134, 0,62,134, 0,66,133, 0,69,133, 0,73,132, - 0,76,130, 0,79,127, 0,82,125, 0,85,123, 0,88,120, 0,91,118, - 0,94,115, 0,97,113, 0,101,110, 0,104,108, 0,107,106, 0,109,102, - 0,110,97, 0,111,91, 0,112,86, 0,113,81, 0,115,76, 0,116,71, - 0,117,65, 0,118,60, 0,119,55, 0,120,50, 0,122,45, 0,121,42, - 1,120,39, 1,119,36, 1,119,34, 1,118,31, 2,117,28, 2,116,26, - 2,115,23, 2,115,20, 3,114,18, 3,113,15, 3,112,13, 4,110,13, - 5,108,13, 6,106,13, 7,104,12, 9,102,12, 10,100,12, 11,98,12, - 12,97,12, 13,95,12, 14,93,11, 15,91,11, 17,89,12, 19,86,12, - 22,83,12, 24,81,13, 26,78,13, 29,76,14, 31,73,14, 34,70,15, - 36,68,15, 39,65,16, 41,63,16, 44,60,17, 46,58,17, 49,56,17, - 51,54,17, 54,52,17, 57,50,17, 59,48,17, 62,45,17, 64,43,17, - 67,41,17, 70,39,17, 72,37,17, 74,35,17, 75,34,16, 76,33,16, - 77,32,16, 79,31,15, 80,30,15, 81,29,14, 82,28,14, 83,26,13, - 84,25,13, 85,24,13, 87,23,12, 87,22,12, 88,21,11, 89,20,11, - 90,19,10, 91,18,10, 92,17,9, 93,16,9, 94,15,8, 95,14,8, - 95,13,7, 96,12,7, 97,11,7, 98,11,6, 99,10,6, 99,9,5, 100,9,5, - 101,8,5, 102,8,4, 102,7,4, 103,6,4, 104,6,3, 104,5,3, 105,4,2, - 106,4,2, 107,4,2, 107,3,2, 108,3,2, 109,3,2, 109,2,1, 110,2,1, - 111,2,1, 112,1,1, 112,1,1, 113,1,0, 114,1,0, 115,0,0, 116,0,0, - 117,0,0, 118,0,0, 119,0,0, 121,0,0, 122,0,0, 123,0,0, 124,0,0, - 125,0,0, 126,0,0, 128,0,0, 131,0,0, 134,0,0, 137,0,0, 140,0,0, - 144,0,0, 147,0,0, 150,0,0, 153,0,0, 156,0,0, 159,0,0, 162,0,0, - 165,0,0, 168,0,0, 171,0,0, 174,0,0, 177,0,0, 180,1,0, 183,1,0, - 186,1,0, 189,1,0, 192,1,0, 195,2,0, 198,2,0, 201,5,0, 204,7,0, - 207,9,0, 210,11,0, 213,13,0, 216,15,0, 219,17,0, 222,19,0, - 225,21,0, 228,23,0, 230,25,0, 233,29,0, 235,34,0, 237,39,0, - 239,43,0, 241,48,0, 243,52,0, 245,57,0, 247,61,0, 250,66,0, - 252,71,0, 254,75,0, 255,80,0, 255,88,0, 255,95,1, 255,103,1, - 255,110,1, 255,117,1, 255,125,1, 255,132,2, 255,139,2, 255,147,2, - 255,154,2, 255,162,2, 255,169,3, 255,176,3, 255,183,3, 254,190,4, - 254,198,4, 254,205,4, 254,212,4, 253,219,5, 253,226,5, 253,234,5, - 252,241,6, 252,248,6 + 119,10,140, + 116,10,142, + 112,10,144, + 109,9,146, + 105,9,148, + 101,8,150, + 97,7,151, + 92,7,153, + 88,6,155, + 83,5,157, + 77,4,158, + 72,2,160, + 67,2,162, + 64,4,164, + 61,5,166, + 58,6,168, + 55,6,170, + 51,7,171, + 47,8,173, + 43,8,175, + 38,9,177, + 33,9,179, + 25,10,180, + 14,10,182, + 10,17,183, + 10,22,183, + 9,27,184, + 9,30,184, + 8,33,185, + 8,36,185, + 7,39,186, + 6,41,187, + 5,43,187, + 4,45,188, + 3,47,188, + 0,50,189, + 0,57,189, + 0,62,189, + 0,67,190, + 0,72,190, + 0,77,190, + 0,81,191, + 0,84,191, + 1,88,191, + 1,92,192, + 1,95,192, + 1,98,192, + 2,102,192, + 3,107,192, + 3,112,192, + 4,116,191, + 5,120,191, + 5,124,191, + 5,128,191, + 6,131,191, + 6,135,190, + 7,138,190, + 7,141,190, + 7,145,189, + 8,147,188, + 8,150,186, + 9,153,185, + 9,155,183, + 10,158,181, + 10,160,180, + 11,163,178, + 11,165,176, + 11,167,175, + 12,170,173, + 12,172,171, + 13,173,168, + 13,174,164, + 14,175,160, + 14,176,156, + 15,177,152, + 15,178,147, + 16,178,143, + 16,179,138, + 17,180,133, + 17,181,127, + 18,182,122, + 18,182,116, + 20,182,112, + 22,181,109, + 24,181,105, + 26,180,102, + 27,180,98, + 29,179,94, + 30,179,90, + 32,178,86, + 33,177,81, + 34,177,77, + 35,176,71, + 37,176,67, + 42,174,67, + 46,173,66, + 49,171,66, + 52,170,65, + 55,169,65, + 58,167,65, + 61,166,64, + 64,164,64, + 66,163,63, + 68,161,63, + 71,160,63, + 75,158,63, + 79,156,64, + 84,154,65, + 88,151,66, + 92,149,68, + 95,147,69, + 99,145,70, + 102,142,71, + 105,140,71, + 109,137,72, + 112,135,73, + 115,132,74, + 118,130,74, + 121,128,74, + 123,126,74, + 126,124,74, + 129,121,75, + 132,119,75, + 134,117,75, + 137,114,75, + 139,112,75, + 142,109,75, + 144,106,75, + 146,104,75, + 147,103,74, + 148,101,73, + 149,100,72, + 150,98,71, + 151,96,70, + 152,95,70, + 152,93,69, + 153,91,68, + 154,90,67, + 155,88,66, + 156,86,65, + 157,84,64, + 158,83,63, + 158,81,62, + 159,79,60, + 160,77,59, + 161,75,58, + 161,73,57, + 162,71,55, + 163,69,54, + 163,67,52, + 164,65,51, + 165,63,49, + 165,61,48, + 166,60,47, + 166,58,46, + 167,56,44, + 167,55,43, + 168,53,42, + 169,51,40, + 169,49,39, + 170,46,37, + 170,44,35, + 171,42,33, + 171,40,32, + 172,39,31, + 172,37,30, + 173,36,29, + 173,34,28, + 174,33,27, + 174,31,25, + 175,29,24, + 175,27,22, + 176,25,21, + 176,23,19, + 177,21,17, + 178,20,16, + 179,19,16, + 179,18,15, + 180,17,14, + 181,16,13, + 182,15,13, + 182,13,12, + 183,12,11, + 184,10,9, + 185,8,8, + 185,5,6, + 187,3,5, + 189,3,5, + 191,3,5, + 193,3,6, + 195,3,6, + 197,2,6, + 198,2,6, + 200,2,6, + 202,2,6, + 204,1,6, + 206,1,6, + 208,0,6, + 209,9,7, + 211,13,7, + 213,15,8, + 214,18,8, + 216,20,9, + 218,21,9, + 219,23,9, + 221,24,10, + 223,26,10, + 224,27,10, + 226,28,11, + 228,33,11, + 229,43,11, + 231,50,11, + 232,56,11, + 234,61,11, + 235,66,11, + 237,71,11, + 238,75,11, + 239,79,11, + 241,83,11, + 242,86,11, + 244,90,11, + 245,96,11, + 246,102,12, + 247,108,12, + 248,114,13, + 249,119,13, + 250,124,13, + 251,129,14, + 252,134,14, + 253,138,15, + 254,143,15, + 255,147,15, + 255,151,16, + 255,157,18, + 255,163,20, + 255,169,22, + 255,174,24, + 255,179,25, + 255,184,26, + 255,189,28, + 255,194,29, + 255,199,30, + 255,203,31, + 255,207,32, + 255,212,34, + 255,216,35, + 255,220,37, + 255,224,38, + 255,227,40, + 255,231,41, + 255,235,42, + 254,238,43, + 254,242,44, + 254,245,46, + 254,249,47, + 254,252,48, };