IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 40627 for trunk


Ignore:
Timestamp:
Feb 23, 2019, 10:34:16 AM (7 years ago)
Author:
eugene
Message:

add additional colormap file options

File:
1 edited

Legend:

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

    r38465 r40627  
    214214
    215215  /* anuenue */
    216   if (!strncmp (graphic->colormapName, "file:", 5)) {
     216  if (!strncmp (graphic->colormapName, "file:", 5) ||
     217      !strncmp (graphic->colormapName, "lgcy:", 5) ||
     218      !strncmp (graphic->colormapName, "cetf:", 5) ||
     219      !strncmp (graphic->colormapName, "csvf:", 5)) {
     220
    217221    FILE *f = fopen (&graphic->colormapName[5], "r");
    218222    if (!f) {
     
    227231    float lastGreen = 0.0;
    228232
     233    int isCSV = !strncmp (graphic->colormapName, "csvf:", 5);
     234    int isCET = !strncmp (graphic->colormapName, "cetf:", 5);
     235    int isLegacy = !strncmp (graphic->colormapName, "lgcy:", 5);
     236
    229237    float fracIndex, fracRed, fracBlue, fracGreen;
     238
     239    if (isCET) fracIndex = 0.0;
    230240
    231241    while (scan_line_maxlen (f, line, 1024) != EOF) {
    232242      // file contains f R G B : f = 0.0 - 1.0, R,G,B = 0.0 - 1.0
    233       int Nscan = sscanf (line, "%f %f %f %f", &fracIndex, &fracRed, &fracBlue, &fracGreen);
    234       if (Nscan != 4) continue;
     243
     244      int Nscan;
     245      if (isCSV) {
     246        Nscan = sscanf (line, "%f,%f,%f,%f", &fracIndex, &fracRed, &fracGreen, &fracBlue);
     247        if (Nscan != 4) continue;
     248      }
     249      if (isCET) {
     250        Nscan = sscanf (line, "%f,%f,%f", &fracRed, &fracGreen, &fracBlue);
     251        fracIndex += 1.0 / 256.0;
     252        if (Nscan != 3) continue;
     253      }
     254      if (isLegacy) {
     255        Nscan = sscanf (line, "%f %f %f %f", &fracIndex, &fracRed, &fracBlue, &fracGreen);
     256        if (Nscan != 4) continue;
     257      }
     258      if (!isCSV && !isLegacy && !isCET) {
     259        Nscan = sscanf (line, "%f %f %f %f", &fracIndex, &fracRed, &fracGreen, &fracBlue);
     260        if (Nscan != 4) continue;
     261      }
    235262
    236263      int nextIndex = fracIndex * MaxValue;
Note: See TracChangeset for help on using the changeset viewer.