
;+ ***********************************************************************
; NAME:
;	READ_MAP_PNG
;
; PURPOSE:
;	This procedure read a gif file to plot the image with the MAPPING
;	software (D Zarro)
;	It is necessary to be able to define the optical sun by 3 points
;	or by the center coodinates and the radius in pixels
;
; CATEGORY:
;	NRH2D gen
;
; CALLING SEQUENCE:
;	READ_MAP_PNG, File, Index, Data, [R], [G], [B]
;
; INPUTS:
;	FILE	PNG file
;	
; KEYWORD PARAMETERS:
;	DIR	PNG file Directory (default current directory)
;
; OUTPUTS:
;	INDEX	Index to map
;	DATA	Data to map
;	R,B,B	Color table
;
; COMMON BLOCKS:
;	No
;
; SIDE EFFECTS:
;
; RESTRICTIONS:
;	
; PROCEDURE:
;	The procedure generate a widget window to define the optical sun
;
; EXAMPLE:
;	READ_MAP_PNG, 'image.png', Index, Data, r, g, b
;	INDEX2MAP, Index, Data, Image
;	TVLCT,r,g,b
;	TVLCT,r,g,b,/get
;	nc = N_ELEMENTS(r)
;	PLOT_MAP, Image, NCOLORS=Nc
;
; MODIFICATION HISTORY:
;	Ecrit par: Jen Bonmartin (jean;bonmartin@obspm.fr) le 25/04/01
;		18/05/01 Add colors table (JB)
;-*******************************************************************

PRO READ_MAP_PNG, File, Index, Data, R, G, B, DIR = dir

INDEX = {STR_INDEX_PNG, Naxis:2, Naxis1:0, Naxis2:0, Bitpix:8, $
	Crpix1:0.0, Crpix2:0.0, Solar_R:0.0, $
	Cdelt1:0.0, Cdelt2:0.0}


IF NOT KEYWORD_SET (DIR) THEN Dir = ''

	READ_PNG, Dir+File, Data, R, G ,B
	SZ = SIZE(Data)
	Index.Naxis1=SZ[1]
	Index.Naxis2=SZ[2]
	OPTIC_CIRC, data, Crpix1, crpix2, Solar_R
	Index.Crpix1= Crpix1
	Index.Crpix2= Crpix2
	Index.Solar_R = Solar_R
	Index.Cdelt1 = 16.028 * 60./Index.Solar_R
	Index.Cdelt2 = Index.cdelt1

END
