Changeset 40544
- Timestamp:
- Oct 19, 2018, 10:15:10 PM (8 years ago)
- File:
-
- 1 edited
-
trunk/Ohana/src/kapa2/src/SetColorScale.c (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Ohana/src/kapa2/src/SetColorScale.c
r35766 r40544 104 104 unsigned short maxGreen = graphic[0].nGreen - 1; 105 105 106 unsigned short NANValue = graphic[0].Npixels - 1; 107 106 108 // set start & slope for red (channel 0) 107 109 if (image[0].channel[KAPA_CHANNEL_RED].range != 0.0) { … … 141 143 142 144 // convert pixel data values to pixel index values (0 - Npixel) 145 // NOTE: a nan value in any of the 3 channels will result in a nan value for output 143 146 for (i = 0; i < nPixels; i++, rData++, bData++, gData++, oData++) { 147 148 // RED channel 149 if (isnan(*rData) || isinf(*rData)) { 150 *oData = NANValue; 151 continue; 152 } 144 153 rValue = *rData * redSlope - redStart; 145 154 if (rValue < 0) rValue = 0; 146 155 if (rValue > maxRed) rValue = maxRed; 147 156 157 // BLUE channel 158 if (isnan(*bData) || isinf(*bData)) { 159 *oData = NANValue; 160 continue; 161 } 148 162 bValue = *bData * blueSlope - blueStart; 149 163 if (bValue < 0) bValue = 0; 150 164 if (bValue > maxBlue) bValue = maxBlue; 151 165 166 // GREEN channel 167 if (isnan(*gData) || isinf(*gData)) { 168 *oData = NANValue; 169 continue; 170 } 152 171 gValue = *gData * greenSlope - greenStart; 153 172 if (gValue < 0) gValue = 0; … … 183 202 // XXX a bit bogus: we are going to store a special color at Npixels-1 for 184 203 // marking the NAN pixels. 185 { 204 // XXX : isn't this set now by the user ? 205 if (0) { 186 206 // XXX set pure green for now 187 207 graphic[0].cmap[graphic[0].Npixels-1].red = 0;
Note:
See TracChangeset
for help on using the changeset viewer.
