 pro wrt_disp_spec_im

 COMMON WRT_WIDGET_COM
 COMMON WRT_DATA_COM
 print ,'* wrt_disp_spec_im.pro *'

         imgmax=max(im_data(0:nlig_data-1,*))
         imgmin=min(im_data(0:nlig_data-1,*))
;=============================================================================
;_______ plot du cadre (1st line of the image ) ______________________________
;=============================================================================
     if nlig_data eq 1 then begin
        nbxt=0
        nbyt=0
        if curr_header.size1 lt 100 then nbxt=1
        if curr_header.size2 lt 100 then nbyt=1
        xthlen = -0.02
        ythlen = -0.02
        if curr_header.size1 gt 500 then ythlen = -0.01
        plot_x = [0, curr_header.size1 - 1]
        plot_y = [0, curr_header.size2 - 1]
        plot,  [plot_x(0) , plot_x(1)] , [plot_y(0) , plot_y(1)]          $
         ,POSITION = [xpos_dev,ypos_dev,xpos_dev+curr_header.size1 - 1	, $
                      ypos_dev+ curr_header.size2 - 1 ]			, $
                      xstyle=1,ystyle=1                                 , $
         	      xticks = nbxt, yticks = nbyt                      , $
                      xticklen = xthlen					, $
                      yticklen = ythlen					, $
                      /nodata      ,/device ,/noerase
     endif
;=============================================================================
; format and output the data to the im_data display
;=============================================================================
     case curr_header.datafmt of
          1: begin
             im=bytscl(im_data,max=imgmax,min=imgmin)
             tv,im,xpos_dev,ypos_dev
             end
          2: begin
             im=bytscl(im_data,max=imgmax,min=imgmin)
             tv,im,xpos_dev,ypos_dev
             end
          3: begin
             im=im_data
             if imgmin lt 0 then  im(where(im_data lt 0))=maxi4
;             im=bytscl(im/(long(2)^16))
             im=bytscl(im_data,max=imgmax,min=imgmin)
             tv,im,xpos_dev,ypos_dev
             end
          4: begin
             im=bytscl(im_data,max=imgmax,min=imgmin)
             tv,im,xpos_dev,ypos_dev
             end
          5: begin
             im=im_data
             if imgmin lt 0 then  im(where(im lt 0))=maxi2-im(where(im lt 0))
             im=bytscl(im_data,max=imgmax,min=imgmin)
             tv,im,xpos_dev,ypos_dev
             end
     endcase

     if imgstat eq 1 then begin
        nbxt=0
        nbyt=0
        if curr_header.size1 lt 100 then nbxt=1
        if curr_header.size2 lt 100 then nbyt=1
        xthlen = -0.02
        ythlen = -0.02
        if curr_header.size1 gt 500 then ythlen = -0.01
        plot_x = [0, curr_header.size1 - 1]
        plot_y = [0, curr_header.size2 - 1]
        plot,  [plot_x(0) , plot_x(1)] , [plot_y(0) , plot_y(1)]          $
         ,POSITION = [xpos_dev,ypos_dev,xpos_dev+curr_header.size1 - 1	, $
                      ypos_dev+ curr_header.size2 - 1 ]			, $
                      xstyle=1,ystyle=1                                 , $
         	      xticks = nbxt, yticks = nbyt                      , $
                      xticklen = xthlen					, $
                      yticklen = ythlen					, $
                      /nodata      ,/device ,/noerase
 
       	if curr_header.datafmt eq 1 then begin
         	imgmax=fix(imgmax)
         	imgmin=fix(imgmin)
      	endif

      	xyouts,.80,.945, 'TOTAL COUNT : '+ strtrim(curr_header.ssimgtot , 2),$
      	charsize=1.3,/normal
      	xyouts,.80,.92,  'MAX : '+strtrim(imgmax,2),$
      	charsize=1.3,/normal
      	xyouts,.80,.895, 'MIN : '+strtrim(imgmin,2),$
      	charsize=1.3,/normal     
     endif                                                                           

     im_draw_status =1
     display_status =10

end
