IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 40544 for trunk


Ignore:
Timestamp:
Oct 19, 2018, 10:15:10 PM (8 years ago)
Author:
eugene
Message:

for a color-cube (ruffcolor) color map, use the NAN color if any of RGB is NAN

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Ohana/src/kapa2/src/SetColorScale.c

    r35766 r40544  
    104104  unsigned short maxGreen = graphic[0].nGreen - 1;
    105105
     106  unsigned short NANValue = graphic[0].Npixels - 1;
     107 
    106108  // set start & slope for red (channel 0)
    107109  if (image[0].channel[KAPA_CHANNEL_RED].range != 0.0) {
     
    141143
    142144  // 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
    143146  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    }
    144153    rValue = *rData * redSlope   - redStart;
    145154    if (rValue < 0) rValue = 0;
    146155    if (rValue > maxRed) rValue = maxRed;
    147156
     157    // BLUE channel
     158    if (isnan(*bData) || isinf(*bData)) {
     159      *oData = NANValue;
     160      continue;
     161    }
    148162    bValue = *bData * blueSlope  - blueStart;
    149163    if (bValue < 0) bValue = 0;
    150164    if (bValue > maxBlue) bValue = maxBlue;
    151165
     166    // GREEN channel
     167    if (isnan(*gData) || isinf(*gData)) {
     168      *oData = NANValue;
     169      continue;
     170    }
    152171    gValue = *gData * greenSlope - greenStart;
    153172    if (gValue < 0) gValue = 0;
     
    183202  // XXX a bit bogus: we are going to store a special color at Npixels-1 for
    184203  // marking the NAN pixels. 
    185   {
     204  // XXX : isn't this set now by the user ?
     205  if (0) {
    186206      // XXX set pure green for now
    187207      graphic[0].cmap[graphic[0].Npixels-1].red = 0;
Note: See TracChangeset for help on using the changeset viewer.