IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 37759


Ignore:
Timestamp:
Dec 18, 2014, 2:47:00 PM (12 years ago)
Author:
eugene
Message:

add more channels, add channel # to display; wide window should show whole image

Location:
branches/eam_branches/ipp-20140904/Ohana/src/kapa2
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/ipp-20140904/Ohana/src/kapa2/include/constants.h

    r36084 r37759  
    1010 | PointerMotionMask)
    1111
    12 # define NCHANNELS 3
     12# define NCHANNELS 10
    1313# define NPIXELS_DYNAMIC 128
    1414
  • branches/eam_branches/ipp-20140904/Ohana/src/kapa2/include/structures.h

    r32695 r37759  
    217217  KapaImageChannel *image;
    218218  KapaImageChannel channel[NCHANNELS];
     219  int currentChannel;
    219220} KapaImageWidget;
    220221
  • branches/eam_branches/ipp-20140904/Ohana/src/kapa2/src/CreatePicture.c

    r16270 r37759  
    4040
    4141  case 24:
     42   
     43    extra = 4 - (image[0].wide.dx * 3) % 4;
     44    REALLOCATE (image[0].wide.data, char, image[0].wide.dy*(3*image[0].wide.dx+extra));
     45
     46    extra = 4 - (image[0].zoom.dx * 3) % 4;
     47    REALLOCATE (image[0].zoom.data, char, image[0].zoom.dy*(3*image[0].zoom.dx+extra));
     48
    4249    extra = 4 - (image[0].picture.dx * 3) % 4;
    43     REALLOCATE (image[0].wide.data, char, image[0].wide.dy*(3*image[0].wide.dx+extra));
    44     REALLOCATE (image[0].zoom.data, char, image[0].zoom.dy*(3*image[0].zoom.dx+extra));
    4550    REALLOCATE (image[0].picture.data, char, image[0].picture.dy*(3*image[0].picture.dx+extra));
    4651    c = (unsigned char *) image[0].picture.data;
  • branches/eam_branches/ipp-20140904/Ohana/src/kapa2/src/Image.c

    r37386 r37759  
    3434    InitImageChannel (&image[0].channel[i]);
    3535  }
    36   image[0].image = &image[0].channel[0];
     36
     37  image[0].currentChannel = 0;
     38  image[0].image = &image[0].channel[image[0].currentChannel];
    3739
    3840  image[0].nPixels = 0;
  • branches/eam_branches/ipp-20140904/Ohana/src/kapa2/src/InterpretKeys.c

    r25757 r37759  
    8989  switch (keysym) {
    9090
    91     case XK_F1:
    92       image[0].image = &image[0].channel[0];
    93       SetColorScale (graphic, image);
    94       Remap (graphic, image);
    95       Reorient (graphic, image, image[0].picture.Xc, image[0].picture.Yc, 0);
     91# define SET_CHANNEL_CASE(NCHAN) \
     92    case XK_F##NCHAN: \
     93      image[0].image = &image[0].channel[NCHAN-1]; \
     94      SetColorScale (graphic, image); \
     95      Remap (graphic, image); \
     96      Reorient (graphic, image, image[0].picture.Xc, image[0].picture.Yc, 0); \
    9697      break;
    9798
    98     case XK_F2:
    99       image[0].image = &image[0].channel[1];
    100       SetColorScale (graphic, image);
    101       Remap (graphic, image);
    102       Reorient (graphic, image, image[0].picture.Xc, image[0].picture.Yc, 0);
    103       break;
    104 
    105     case XK_F3:
    106       image[0].image = &image[0].channel[2];
    107       SetColorScale (graphic, image);
    108       Remap (graphic, image);
    109       Reorient (graphic, image, image[0].picture.Xc, image[0].picture.Yc, 0);
    110       break;
     99    // the number of entries here must match the value of NCHANNELS in contants.h
     100    SET_CHANNEL_CASE(1);
     101    SET_CHANNEL_CASE(2);
     102    SET_CHANNEL_CASE(3);
     103    SET_CHANNEL_CASE(4);
     104    SET_CHANNEL_CASE(5);
     105    SET_CHANNEL_CASE(6);
     106    SET_CHANNEL_CASE(7);
     107    SET_CHANNEL_CASE(8);
     108    SET_CHANNEL_CASE(9);
     109    SET_CHANNEL_CASE(10);
    111110
    112111    case XK_KP_Home:
  • branches/eam_branches/ipp-20140904/Ohana/src/kapa2/src/LoadPicture.c

    r28241 r37759  
    5555  // choose expand for wide to guarantee we fit:
    5656  wx = MAX ((header.Naxis[0] / (float) image[0].wide.dx), (header.Naxis[1] / (float) image[0].wide.dy));
    57   if (wx > 1.0) {
    58     image[0].wide.expand = -wx;
    59   } else {
    60     image[0].wide.expand = 1.0 / wx;
    61   }   
     57
     58  // -4.002 -> -5
     59  // image[0].wide.expand = (wx > 1.0) ? ceil (-wx) : floor (1.0 / wx);
     60  image[0].wide.expand = (wx > 1.0) ? floor (-wx) : ceil (1.0 / wx);
     61  fprintf (stderr, "%d : %f\n", image[0].wide.expand, wx);
     62  // image[0].wide.expand = (wx > 1.0) ? ceil (-wx) : floor (1.0 / wx);
     63
    6264  image[0].wide.Xc = 0.5*header.Naxis[0];
    6365  image[0].wide.Yc = 0.5*header.Naxis[1];
  • branches/eam_branches/ipp-20140904/Ohana/src/kapa2/src/Remap32.c

    r34088 r37759  
    3737  swap_client = 0;
    3838# endif 
    39 
    4039  swap_server = ImageByteOrder (graphic[0].display);
    4140  swap_bytes = !(swap_client ^ swap_server);
     
    9190  in_pix  = &image[0].pixmap[DX*(int)MAX(Iy,0) + (int)MAX(Ix,0)];
    9291
     92  unsigned short *in_base = image[0].pixmap;
     93  OUT_TYPE *out_base = (OUT_TYPE *) picture[0].data;
     94
     95  int Ninmax = matrix[0].Naxis[0] * matrix[0].Naxis[1];
     96  int Noutmax = picture[0].dx * picture[0].dy;
     97
    9398  /********** below we do the mapping from buffer pixels (in) to picture pixels (out) **********/
    9499
    95100  /**** fill in bottom area ****/
    96101  for (j = 0; j < dx*j_start; j++, out_pix++) {
     102    myAssert (out_pix - out_base < Noutmax, "too far out");
    97103    *out_pix = back;
    98104  }
     
    105111      out_pix2 = out_pix + jj*dx;
    106112      for (i = 0; i < i_start; i++, out_pix2++) {
     113        myAssert (out_pix2 - out_base < Noutmax, "too far out");
    107114        *out_pix2 = back;
    108115      }
     
    114121    if (expand_out == 1) {
    115122      for (i = i_start; i < i_end; i++, in_pix2 += inDX*expand_in, out_pix++) {
     123        myAssert (out_pix - out_base < Noutmax, "too far out");
     124        myAssert (in_pix2 - in_base < Ninmax, "too far in");
    116125        *out_pix = pixel[*in_pix2];
    117126      }
    118127    } else {
    119128      for (i = i_start; i < i_end; i+= expand_out, in_pix2 += inDX, out_pix+= expand_out) {
     129        myAssert (in_pix2 - in_base < Ninmax, "too far in");
    120130        pixvalue = pixel[*in_pix2];
    121131        out_pix2 = out_pix;
    122132        for (jj = 0; (jj < expand_out) && (j + jj < dy); jj++, out_pix2+=(dx-expand_out)) {
    123133          for (ii = 0; ii < expand_out; ii++, out_pix2++) {
     134            myAssert (out_pix2 - out_base < Noutmax, "too far out");
    124135            *out_pix2 = pixvalue;
    125136          }
     
    133144      out_pix2 = out_pix + jj*dx;
    134145      for (i = i_end; i < dx; i++, out_pix2++) {
     146        myAssert (out_pix2 - out_base < Noutmax, "too far out");
    135147        *out_pix2 = back;
    136148      }
     
    142154  for (j = 0; j < dy - j_end; j++) {
    143155    for (i = 0; i < dx; i++, out_pix ++) {
     156      myAssert (out_pix - out_base < Noutmax, "too far out");
    144157      *out_pix = back;
    145158    }
  • branches/eam_branches/ipp-20140904/Ohana/src/kapa2/src/SetChannel.c

    r37718 r37759  
    2121  if (Nchannel >= NCHANNELS) return (TRUE);
    2222 
    23   image[0].image = &image[0].channel[Nchannel];
     23  image[0].currentChannel = Nchannel;
     24  image[0].image = &image[0].channel[image[0].currentChannel];
    2425  SetColorScale (graphic, image);
    2526
  • branches/eam_branches/ipp-20140904/Ohana/src/kapa2/src/UpdateStatusBox.c

    r30606 r37759  
    2020 
    2121    bzero (line, 100);
    22     snprintf (line, 100, "(%d x %d) @ %d                                         ",
    23              image[0].picture.dx, image[0].picture.dy, image[0].picture.expand);
     22    snprintf (line, 100, "(%d x %d) @ %d   ch: %d                                     ",
     23              image[0].picture.dx, image[0].picture.dy, image[0].picture.expand, image[0].currentChannel+1);
    2424    XDrawString (graphic[0].display, graphic[0].window, graphic[0].gc,
    2525                 image[0].text_x + PAD1, image[0].text_y + 4*textpad + 4*PAD1, line, 25);
Note: See TracChangeset for help on using the changeset viewer.