
;+ ***********************************************************************
; NAME:
;	RD_NRHPNG
;
; PURPOSE:
;	Lecture des donnees SOHO EIT au format FITS
;
; CATEGORY:
;	Input, Output
;
; CALLING SEQUENCE:
;	 RD_NRHPNG, File, Str_fic, Image, Str_im

;
; INPUTS:
;	File	chemin et nom du fichier a lire
;	Str_fic	Structure d'information de fichiers (NRH_STR_INFIC)
;
; KEYWORD PARAMETERS:
;
; OUTPUTS:
;	Image	tableau d'image
;	Str_im	Structure d'image (NRH_STR_IMAGE)
;
; PROCEDURE:
;	Cette procedure lit l'image contenue dans un fichier PNG,
;	cree et remplit la structure STR_IM
;	La structure STR_FIC doit avoit ete correctement remplie par un appel
;	a FOPEN_PNG
;
; EXAMPLE:
;
; MODIFICATION HISTORY:
;	Ecrit par: J Bonmartin (obspm.fr)le 09/09/98
;		Chargement des tables de couleurs PNG (JB Le 15/05/00)
;       24/03/2005 : traitement des images .png en 24 bits
;       06/11/2008 : Gestion des images 3D (true color)
;-*******************************************************************

PRO RD_NRHPNG, File, Str_inf2d, Image, Str

STR = {nrh_str_image}

        READ_PNG, File, Image, R, G, B
; modif 24/03/2005 cas des images a 3 dimensions 24bits, avec R G B
; non definis.
; On prend le rouge Image(0,*,*) car c'est en principe une table noire
; et blanc, et les r g b sont equivalents
; 
;        if (size(image))(1) eq 3 then Image = reform(Image(0,*,*))
; modif du 4 nov 2008 : on accepte les images 3d (3,*,*)
        IF n_elements(r) eq 0 then begin
            loadct,0
            tvlct,r,g,b,/get
        end else begin
	    TVLCT,R,G,B
        endelse
	Str.date = Str_inf2d.date
	Str.time = Str_inf2d.hd
	Str.Freq = ''
	Str.Instrume = Str_inf2d.instrume
	Str.Crpixx =  Str_inf2d.Xcen
	Str.Crpixy =  Str_inf2d.Ycen
	Str.Ray = Str_inf2d.Ray
	
end
