IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 16039


Ignore:
Timestamp:
Jan 8, 2008, 12:49:54 PM (18 years ago)
Author:
eugene
Message:

split full color into color histogram vs set color scale; fixed F1-3 buttons

Location:
trunk/Ohana/src/kapa2
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/Ohana/src/kapa2/Makefile

    r16011 r16039  
    7979$(SRC)/PSOverlay.$(ARCH).o                $(SRC)/SetChannel.$(ARCH).o         \
    8080$(SRC)/SetColorScale.$(ARCH).o            $(SRC)/ColorCube.$(ARCH).o          \
    81 $(SRC)/ColorHistogram.$(ARCH).o           $(SRC)/sort.$(ARCH).o
     81$(SRC)/ColorHistogram.$(ARCH).o           
    8282
    8383OBJ  =  $(KAPA)
  • trunk/Ohana/src/kapa2/include/Ximage.h

    r13320 r16039  
    1 # include <Xohana.h>
     1# include <X11/Xatom.h>
     2# include <X11/Xlib.h>
     3# include <X11/Xresource.h>
     4# include <X11/Xutil.h>
     5# include <X11/cursorfont.h>
     6# include <X11/keysym.h>
     7# include <X11/keysymdef.h>
     8
     9# include <ohana.h>
    210# include <dvo.h>
    311# include <kapa.h>
  • trunk/Ohana/src/kapa2/include/structures.h

    r16011 r16039  
    1 
    2 /**************** Graphic carries X info around ****************/
    3 typedef struct {
    4   Display       *display;     // X display pointer
    5   int            screen;      // X screen number
    6   int            depth;
    7   Window         window;
    8   Visual        *visual;
    9   int            visualclass; // is visual dynamic? (XXX change name?)
    10   int            Nbits;       // pixel depth in bits (8, 16, 24, 32)
    11   GC             gc;
    12   XFontStruct   *font;
    13   Cursor         cursor;
    14   int            x,  y;
    15   unsigned int   dx, dy;
    16   XColor        *cmap;
    17   Colormap       colormap;
    18   unsigned long *color;      // graph plotting colors
    19   int            Ncolors;
    20 
    21   unsigned long *pixels;      // image pixel colors
    22   int Npixels;                // number of pixels
    23 
    24   int            ColorScaleMode; // single colormap for all images??
    25   int nRed;
    26   int nBlue;
    27   int nGreen;
    28 
    29   unsigned long  fore;        // basic foreground color
    30   unsigned long  back;        // basic background color
    31 
    32   unsigned long  overlay_color[NOVERLAYS]; // image plotting colors
    33 } Graphic;
    34 
    35 /**************** X related "widget" structures ****************/
    36 typedef struct {
    37   int      x, y, dx, dy;      /* position and size */
    38   int      width, height;     /* size of the bitmap */
    39   char    *bitmap;            /* picture on button */
    40   int    (*function_1) ();    /* mouse_button 1 function */
    41   int    (*function_2) ();    /* mouse_button 2 function */
    42   int    (*function_3) ();    /* mouse_button 3 function */
    43 } Button;
    44 
    45 typedef struct {
    46   int      x, y, dx, dy;   /* position and size */
    47   char    *label;          /* label on TextLine */
    48   char     text[1024];     /* words of TextLine */
    49   char     old_text[1024]; /* words of TextLine */
    50   int      outline;        /* draw an outline?  */
    51   int      cursor;         /* location of cursor (if selected) */
    52   int    (*function) ();   /* textline function */
    53 } TextLine;
    54 
    55 typedef char STRING[1024];
    56 
    57 typedef struct {
    58   int      x, y, dx, dy;   /* position and size */
    59   STRING  *text;           /* words of TextLine */
    60   int      Nlines;
    61   int      outline;        /* draw an outline?  */
    62   int      cursor_line;    /* cursor line */
    63   int      cursor_x;       /* location of cursor (if selected) */
    64   int      cursor_y;       /* location of cursor (if selected) */
    65   int    (*function) ();   /* textline function */
    66 } TextBox;
    671
    682/*** 3C color cube histogram tree thingy ***/
     
    8014} CCNode;
    8115
     16/**************** Graphic carries X info around ****************/
     17typedef struct {
     18  Display       *display;     // X display pointer
     19  int            screen;      // X screen number
     20  int            depth;
     21  Window         window;
     22  Visual        *visual;
     23  int            visualclass; // is visual dynamic? (XXX change name?)
     24  int            Nbits;       // pixel depth in bits (8, 16, 24, 32)
     25  GC             gc;
     26  XFontStruct   *font;
     27  Cursor         cursor;
     28  int            x,  y;
     29  unsigned int   dx, dy;
     30  CCNode        *cube;
     31  XColor        *cmap;
     32  Colormap       colormap;
     33  unsigned long *color;      // graph plotting colors
     34  int            Ncolors;
     35
     36  unsigned long *pixels;      // image pixel colors
     37  int Npixels;                // number of pixels
     38
     39  int            ColorScaleMode; // single colormap for all images??
     40  int nRed;
     41  int nBlue;
     42  int nGreen;
     43
     44  unsigned long  fore;        // basic foreground color
     45  unsigned long  back;        // basic background color
     46
     47  unsigned long  overlay_color[NOVERLAYS]; // image plotting colors
     48} Graphic;
     49
     50/**************** X related "widget" structures ****************/
     51typedef struct {
     52  int      x, y, dx, dy;      /* position and size */
     53  int      width, height;     /* size of the bitmap */
     54  char    *bitmap;            /* picture on button */
     55  int    (*function_1) ();    /* mouse_button 1 function */
     56  int    (*function_2) ();    /* mouse_button 2 function */
     57  int    (*function_3) ();    /* mouse_button 3 function */
     58} Button;
     59
     60typedef struct {
     61  int      x, y, dx, dy;   /* position and size */
     62  char    *label;          /* label on TextLine */
     63  char     text[1024];     /* words of TextLine */
     64  char     old_text[1024]; /* words of TextLine */
     65  int      outline;        /* draw an outline?  */
     66  int      cursor;         /* location of cursor (if selected) */
     67  int    (*function) ();   /* textline function */
     68} TextLine;
     69
     70typedef char STRING[1024];
     71
     72typedef struct {
     73  int      x, y, dx, dy;   /* position and size */
     74  STRING  *text;           /* words of TextLine */
     75  int      Nlines;
     76  int      outline;        /* draw an outline?  */
     77  int      cursor_line;    /* cursor line */
     78  int      cursor_x;       /* location of cursor (if selected) */
     79  int      cursor_y;       /* location of cursor (if selected) */
     80  int    (*function) ();   /* textline function */
     81} TextBox;
     82
    8283/**************** general structures ****************/
    8384typedef struct {
  • trunk/Ohana/src/kapa2/src/ButtonFunctions.c

    r16011 r16039  
    11# include "Ximage.h"
    2 
    3 static char *GREY = "greyscale";
    4 static char *HEAT = "Heat";
    5 static char *RAINBOW = "Rainbow";
    62
    73int PSfunction (Graphic *graphic, KapaImageWidget *image) {
     
    1410
    1511int greycolors (Graphic *graphic, KapaImageWidget *image) {
    16   char *name;
    17   name = GREY;
    18   SetColormap (name);
     12  SetColormap ("greyscale");
    1913  CreateColorbar (image, graphic);
    2014  SetColorScale (graphic, image);
     
    2721
    2822int heat (Graphic *graphic, KapaImageWidget *image) {
    29   char *name;
    30   name = HEAT;
    31   SetColormap ("ruffcolor");
     23  SetColormap ("heat");
    3224  CreateColorbar (image, graphic);
    3325  SetColorScale (graphic, image);
     
    4032
    4133int rainbow (Graphic *graphic, KapaImageWidget *image) {
    42   char *name;
    43   name = RAINBOW;
    44   SetColormap ("fullcolor");
     34  SetColormap ("rainbow");
    4535  CreateColorbar (image, graphic);
    4636  SetColorScale (graphic, image);
  • trunk/Ohana/src/kapa2/src/InterpretKeys.c

    r16011 r16039  
    9191    case XK_F1:
    9292      image[0].image = &image[0].channel[0];
     93      SetColorScale (graphic, image);
     94      Remap (graphic, image);
    9395      Reorient (graphic, image, image[0].X, image[0].Y, 0);
    9496      break;
     
    9698    case XK_F2:
    9799      image[0].image = &image[0].channel[1];
     100      SetColorScale (graphic, image);
     101      Remap (graphic, image);
    98102      Reorient (graphic, image, image[0].X, image[0].Y, 0);
    99103      break;
     
    101105    case XK_F3:
    102106      image[0].image = &image[0].channel[2];
     107      SetColorScale (graphic, image);
     108      Remap (graphic, image);
    103109      Reorient (graphic, image, image[0].X, image[0].Y, 0);
    104110      break;
  • trunk/Ohana/src/kapa2/src/SetColorScale.c

    r16011 r16039  
    148148
    149149// in 3D we use channels 0,1,2 to choose the pixel from the cube
    150 int SetColorScale3D_CC (Graphic *graphic, KapaImageWidget *image) {
     150int SetColorCubeHistogram () {
    151151
    152152  int i, DX, DY, Nvalues, NVALUES, Npixels, Nmin;
    153153  float *values, *colors;
    154154  CCNode *cube;
     155  Graphic *graphic;
     156  Section *section;
     157  KapaImageWidget *image;
     158
     159  graphic = GetGraphic ();
     160  section = GetActiveSection();
     161  if (section->image == NULL) return (FALSE);
     162  image = section->image;
    155163
    156164  DX = image[0].channel[KAPA_CHANNEL_RED].matrix.Naxis[0];
     
    162170
    163171  // create the top-level cube
    164   cube = CCNodeAlloc();
     172  if (graphic[0].cube != NULL) {
     173    CCNodeFree (graphic[0].cube);
     174  }
     175  graphic[0].cube = CCNodeAlloc();
     176
     177  cube = graphic[0].cube;
    165178  cube->min[CC_X] = cube->min[CC_Y] = cube->min[CC_Z] = 0.0;
    166179  cube->max[CC_X] = cube->max[CC_Y] = cube->max[CC_Z] = 1.0;
     
    185198 
    186199    // select top N cells
    187     sort (values, Nvalues);
     200    fsort (values, Nvalues);
    188201
    189202    // split nodes with more than value[n]
     
    214227    }
    215228  }
     229  return TRUE;
     230}
     231
     232// in 3D we use channels 0,1,2 to choose the pixel from the cube
     233int SetColorScale3D_CC (Graphic *graphic, KapaImageWidget *image) {
     234
     235  int i, DX, DY, Nvalues, NVALUES, Npixels, Nmin;
     236  float *values, *colors;
     237  CCNode *cube;
     238
     239  // create the top-level cube
     240  cube = graphic[0].cube;
    216241  CCNodeSetColorPixels (image, cube);
    217242  return TRUE;
  • trunk/Ohana/src/kapa2/src/SetColormap.c

    r16011 r16039  
    2323  if (!strcasecmp (name, "fullcolor")) {
    2424    graphic[0].ColorScaleMode = KAPA_SCALE_3D_FULL;
    25     return TRUE;
     25    if (SetColorCubeHistogram ()) return TRUE;
    2626  }
    2727
  • trunk/Ohana/src/kapa2/src/SetUpGraphic.c

    r16011 r16039  
    2121    ALLOCATE (graphic[0].cmap,   XColor,        NPIXELS_STATIC);
    2222    graphic[0].Npixels = NPIXELS_STATIC;
     23    graphic[0].cube = NULL;
    2324    return;
    2425  }
  • trunk/Ohana/src/kapa2/test/input

    r16037 r16039  
    55  set y = yramp(a)
    66  set z = sqrt((x-256)^2 + (y-256)^2)
    7   tvchannel 0
     7  tvchannel 1
    88  tv x 0 512
    9   tvchannel 1
     9  tvchannel 2
    1010  tv y 0 512
    11   tvchannel 2
     11  tvchannel 3
    1212  tv z 0 512
    1313end
     
    2020  set G = g*(g >= 0) + (g + 256)*(g < 0)
    2121  set B = b*(b >= 0) + (b + 256)*(b < 0)
    22   tvchannel 0
     22  tvchannel 1
    2323  tv R 0 256
    24   tvchannel 1
     24  tvchannel 2
    2525  tv G 0 256
    26   tvchannel 2
     26  tvchannel 3
    2727  tv B 0 256
     28
     29  tvcolor ruffcolor
     30  sleep 1
     31  tvcolor fullcolor
    2832end
Note: See TracChangeset for help on using the changeset viewer.