IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 40707


Ignore:
Timestamp:
May 3, 2019, 11:04:45 AM (7 years ago)
Author:
eugene
Message:

add cetr file option (reverse CET profile)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/ohana.20190329/src/kapa2/src/SetColormap.c

    r40627 r40707  
    7272          }
    7373      }
    74       fprintf (stderr, "ruff Npix: %d vs %d\n", i, graphic[0].Npixels);
     74      // fprintf (stderr, "ruff Npix: %d vs %d\n", i, graphic[0].Npixels);
    7575
    7676      // all other modes are 1D: set the flag:
     
    217217      !strncmp (graphic->colormapName, "lgcy:", 5) ||
    218218      !strncmp (graphic->colormapName, "cetf:", 5) ||
     219      !strncmp (graphic->colormapName, "cetr:", 5) ||
    219220      !strncmp (graphic->colormapName, "csvf:", 5)) {
    220221
     
    233234    int isCSV = !strncmp (graphic->colormapName, "csvf:", 5);
    234235    int isCET = !strncmp (graphic->colormapName, "cetf:", 5);
     236    int isCETRev = !strncmp (graphic->colormapName, "cetr:", 5);
    235237    int isLegacy = !strncmp (graphic->colormapName, "lgcy:", 5);
    236238
    237239    float fracIndex, fracRed, fracBlue, fracGreen;
    238240
    239     if (isCET) fracIndex = 0.0;
     241    if (isCET || isCETRev) fracIndex = 0.0;
    240242
    241243    while (scan_line_maxlen (f, line, 1024) != EOF) {
     
    247249        if (Nscan != 4) continue;
    248250      }
    249       if (isCET) {
     251      if (isCET || isCETRev) {
    250252        Nscan = sscanf (line, "%f,%f,%f", &fracRed, &fracGreen, &fracBlue);
    251253        fracIndex += 1.0 / 256.0;
     
    256258        if (Nscan != 4) continue;
    257259      }
    258       if (!isCSV && !isLegacy && !isCET) {
     260      if (!isCSV && !isLegacy && !isCET && !isCETRev) {
    259261        Nscan = sscanf (line, "%f %f %f %f", &fracIndex, &fracRed, &fracGreen, &fracBlue);
    260262        if (Nscan != 4) continue;
     
    299301      }
    300302    }
     303
     304    // reverse the color sequence:
     305    if (isCETRev) {
     306      for (i = 0; i < MaxValue / 2; i++) { 
     307        unsigned short tmp;
     308        // fprintf (stderr, "swap: %d %d\n", graphic[0].cmap[i].red, graphic[0].cmap[MaxValue - 1 - i].red);
     309        tmp = graphic[0].cmap[i].red;   graphic[0].cmap[i].red   = graphic[0].cmap[MaxValue - 1 - i].red;   graphic[0].cmap[MaxValue - 1 - i].red   = tmp;
     310        tmp = graphic[0].cmap[i].blue;  graphic[0].cmap[i].blue  = graphic[0].cmap[MaxValue - 1 - i].blue;  graphic[0].cmap[MaxValue - 1 - i].blue  = tmp;
     311        tmp = graphic[0].cmap[i].green; graphic[0].cmap[i].green = graphic[0].cmap[MaxValue - 1 - i].green; graphic[0].cmap[MaxValue - 1 - i].green = tmp;
     312      }
     313    }
     314
    301315    goto store_colors;
    302316  }
Note: See TracChangeset for help on using the changeset viewer.