Viewing contents of file '../idllib/astron/contrib/varosi/vlibm/allpro/deconv_iterate.pro'
pro deconv_iterate, image_deconv, deconv_info, converged, $
					RE_CONVOL_IMAGE=im_reconv, NO_FT=noft

; Apply one iteration of specified deconvolution method.
; Frank Varosi NASA/GSFC 1992.

  common deconv_data, image, psf, psf_FT	; image data and PSF
  common deconv_MEM, image_mult			; Lagrange multipliers for MEM,
  common deconv_MRL, conv_cut, conv_prev	; convergence for MRL.

   if (deconv_info.Niter LE 0) then deconv_info.positivity_eps = 0
   converged = 0

   CASE deconv_info.algorithm  OF

	"MLP": BEGIN
			if (deconv_info.Niter LE 0) then setup_MLP, deconv_info

			Max_Likelihood, image, psf, image_deconv, im_reconv, $
						FT=psf_ft, NO=noft, $
						POS=deconv_info.positivity_eps
		 END

	"MLG": BEGIN
			if (deconv_info.Niter LE 0) then setup_MLG, deconv_info

			Max_Likelihood, image, psf, image_deconv, im_reconv, $
						/GAUSSIAN, FT=psf_ft, NO=noft, $
						POS=deconv_info.positivity_eps
		 END

	"MEM": BEGIN
			if (deconv_info.Niter LE 0) then image_mult = 0

			Max_Entropy, image, psf, image_deconv, image_mult, $
						RE=im_reconv, FT=psf_ft, NO=noft
		 END

	"MRL": BEGIN
		if (deconv_info.Niter LE 0) then begin

			setup_MRL, deconv_info, conv_cut
			conv_prev = replicate( 1.0, 5 )

			Max_Resid_Like, image_deconv, /INIT, $
					LAG=[ deconv_info.Lag_chisq, $
					      deconv_info.Lag_min    ], $
					POS=deconv_info.positivity_eps, $
					SIG=deconv_info.image_stats.sigma_noise
		  endif else begin

			Max_Resid_Like, image_deconv, chi_sq, conv_crit

			conv_prev = shift( conv_prev, 1 )
			conv_prev(0) = conv_crit
			if ( max( conv_prev ) LT conv_cut ) then converged=1
			if (conv_crit LT 1.e-7) then converged=1
		   endelse

		im_reconv=0
		END

	else: BEGIN
		message,"specify METHOD = one of MLP, MLG, MEM, or MRL"",/INFO
		message, deconv_info.algorithm + " not yet implemented...",/INFO
		converged=1
		return
		END
     ENDCASE

	deconv_info.Niter = deconv_info.Niter+1
return
end