Palette - Look Up Table - Image Display

Every image that is displayed is first scaled to 8 bits (unsigned byte)

and then given a palette or Look Up Table (LUT).  The default LUT ramps

linearly from black for zero to white for 255.  The LUT is modified by

the sliders.  The LUT is specified by GIF files and TIFF files with a

Colormap and 8 bit pixels.

Change palette to gray scale        Simply changes the palette to

                                    the default b/w linear ramp.

Display gray level component        Displays new image showing the

                                    value ('V' of RGB->HSV) or

                                    brightness component.

      Equivalent to 'fix palette' in NIH Image.

      Displays an 8 bit gray level image showing the Intensity

      component of the color or gray level of what appears on the

      screen (the current palette).  Also works with RGB window.

Copy palette      Copies the palette from the selected window to the

                  front window. 

                  To see the palette NIH Image style:

                        '***Buttons*** / Edit / Linear Ramp'

                        Click on ramp if it is not in front.

                        'Palette / Copy Palette', select source window.


Programming Details


display_image function (new window from array or update pixmap)


  display_image ara <name>

    (setf (pixels , or (red-pixels, etc.

    (update-pixmap w :invalidate t)

  (when palette

      (setf (pixmap-palette w) palette)

      (update-pixmap w :only-palette t :invalidate t)

  display_image ((w pixmap-view) name &optional dummy)

  "Redisplays the image - image array is already there.

   Applys the same palette that it had before."

   ;; Set the scaled image and the scaling information.

    (update-pixmap w :invalidate t)


Pixmap functions


cp_make_pixmap cp_pixmapp

cp_pixmap_type cp_pixmap_dims

cp_display_pixmap cp_free_pixmap



   To change the palette, simply assure that pixmap-type is :8-bit,

   and place the new palette (array of 256 cp_make_color elements)

   in pixmap-palette.  Then call update-pixmap.  If you want to change

   just the palette , pass :only-palette as t.

      :redraw           (also calls cp_redraw_window)

      :invalidate       (also calls cp_invalidate)

      :only-palette     (CP_INSTALL_PALETTE only.  Otherwise:





Palette functions (palette.lisp)


cp_install_palette (pixmap.lisp)

      (cp_install_palette (pixmap 3bw) (log-3-band-palette))

      (cp_invalidate 3bw)



  (setf (pixels w) (fix-image-array-to-default-palette (pixmap-pixels w)

     (pixmap-palette w)))

  (setf (pixmap-palette w) (cp_default_gray_palette))

  (display_image w nil)