Viewing contents of file '../idllib/astron/contrib/varosi/vlibm/allpro/deconv_get_imag.pro'
function deconv_get_imag, image_data, image_stats, deconv_info, LOG10=Log10
;+
; NAME:
; deconv_get_imag
; PURPOSE:
; Function extracts a region from the input image, and adjusts for deconv.
; CALLING EXAMPLE:
; image = deconv_get_imag( image, image_stats )
; INPUTS:
; image
; image_stats
; KEYWORDS:
; /MENUS
; /TV_MONITOR
; OUTPUTS:
; RESULTS:
; Function returns the extracted region of input image.
; EXTERNAL CALLS:
; function extract_region
; PROCEDURE:
; HISTORY:
; Written, Frank Varosi NASA/GSFC 1992.
;-
minim = image_stats.min
maxim = image_stats.max
sky = image_stats.sky_Level
sigma = image_stats.sigma_noise
sim = size( image_data )
sim = sim(1:2)
print," current image size (default): ",sim
input=""
read," enter desired x & y size of image : ",input
if strlen( input ) LE 0 then sxy = sim else begin
sxy = fix( get_words( input ) )
if N_elements( sxy ) EQ 1 then sxy = [sxy,sxy]
endelse
if min( sim LE sxy ) then begin
image = make_array( DIM=sxy, /FLOAT, VAL=minim )
Loc = ( sxy/2 - sim/2 ) > 0
image( Loc(0), Loc(1) ) = image_data
endif else if min( sim EQ sxy ) then image=image_data else begin
if keyword_set( Log10 ) then begin
if (sigma GT 0) then Logmin = sky > sigma $
else Logmin = 10.^( nint( aLog10( maxim ) ) - 4 )
endif
image = extract_region( image_data, SIZE=sxy, VAL=minim, $
/DISPLAY_IMAGE, LOG=Logmin )
endelse
wm = where( image LE minim, nmin )
if (nmin GT 9) AND (image_stats.gaussian) then begin
print,nmin," pixels with no data are flagged in image"
read," replace them with noise ? (default = yes) ",input
if (strmid( strupcase( input ),0,1 ) NE "N") then begin
;print," enter standard deviation of noise to use"
;print," default =",sigma
;read,input
;if strlen( input ) GT 0 then sigma = float( input )
;print," enter background sky Level to use"
;print," default =",sky
;read,input
;if strlen( input ) GT 0 then sky = float( input )
print," substituting Gaussian noise, mean = ", sky, $
" st.dev. = ",sigma
image(wm) = sigma * randomn( seed, nmin ) + sky
image_stats.min = min( image(wm) )
endif
endif
if (image_stats.gaussian) then begin
read," do you want to adjust sky Level ? (default = no) ",input
if (strmid( strupcase( input ),0,1 ) EQ "Y") then begin
skyoff = -sky
print," enter sky adjustment offset:"
print," default =",skyoff
read,input
if strlen( input ) GT 0 then skyoff = float( input )
image = image + skyoff
image_stats.min = image_stats.min + skyoff
image_stats.max = image_stats.max + skyoff
image_stats.sky_Level = sky + skyoff
deconv_info.sky_offset = skyoff
print," sky (background) Level adjusted to:",$
image_stats.sky_Level
endif
endif
return, image
end