Viewing contents of file '../idllib/astron/contrib/varosi/code/allpro/add_new_mosaic.pro'
;+
; NAME:
; add_new_mosaic
; PURPOSE:
; Add new averaged/spliced mosaic to the common block of mosaics,
; also creates a default entry in the mosaic_specs structure array.
; CALLING:
; add_new_mosaic, mosaic, mosaic_info, mtitle, MAGF=Magf
; INPUTS:
; mosaic, mosaic_info, mtitle
; KEYWORDS:
; MAGF =
; OUTPUTS:
; All thru common mosaic_array.
; EXTERNAL CALLS:
; function N_struct
; function mosaic_struct
; pro display_mosaic
; pro image_insert
; COMMON BLOCKS:
; common mosaic_array, mosaics, mosaic_specs, mosaic_infos
; common display_option2, rotation ;default image rotation.
; HISTORY:
; Written, Frank Varosi NASA/GSFC 1992. (code used to be in mosaic.pro)
;-
pro add_new_mosaic, mosaic, mosaic_info, mtitle, MAGF=Magf
common mosaic_array, mosaics, mosaic_specs, mosaic_infos
common array_scale, ArcSec_Pix_x, ArcSec_Pix_y ;plate scale of pixel array
common image_scale, minval, maxval, topval, scale_type, minLog
common image_scale2, smooth_flag
common image_scale4, smooth_iterate
common display_mosaics, imos
common display_option2, rotation ;default image rotation.
if N_elements( mosaic ) LE 1 then return
if N_elements( rotation ) NE 1 then rotation=1 ;default Rotation for
; IRTF observations.
if N_struct( mosaic_specs ) LE 0 then $
mosaic_specs = mosaic_struct( 9, TYPE="spec" )
w = where( mosaic_specs.size_image(0) LE 0, Nempty )
if (Nempty GT 0) then imos = w(0) else begin
imos = N_struct( mosaic_specs )
print,string(10b) + " currently ", strtrim( imos, 2 ),$
" mosaic images in memory,"
print," you may want to remove some of them..." + string(7b)
wait,1
mosaic_specs = [mosaic_specs, mosaic_struct( 9, TYPE="spec" )]
endelse
mosaic_spec = mosaic_specs(imos)
maxm = max( mosaic, MIN=minm )
range = maxm-minm
mosaic_spec.max = maxm
mosaic_spec.min = minm
mosaic_spec.maxT = maxm + range
mosaic_spec.minT = minm - range
mosaic_spec.Truncate = 0
mosaic_spec.magf = Magf
mosaic_spec.scaling = scale_type
mosaic_spec.minLog = minLog
mosaic_spec.Rotation = rotation > 0
if (mosaic_spec.rotation MOD 2) then begin
mosaic_spec.RA_pix = ArcSec_Pix_y
mosaic_spec.DEC_pix = ArcSec_Pix_x
endif else begin
mosaic_spec.RA_pix = ArcSec_Pix_x
mosaic_spec.DEC_pix = ArcSec_Pix_y
endelse
mosaic_spec.name = mtitle
mosaic_spec.title = mtitle
mosaic_spec.file = ""
mosaic_spec.number = imos+1
mosaic_spec.winame = "Mosaic#" + strtrim( imos+1, 2 ) + ": " + mtitle
Nimos = N_struct( mosaic_info )
if (Nimos GT 0) then history = strtrim( Nimos, 2 ) else history=""
if strpos( mtitle, "SB" ) GE 0 then begin
mosaic_spec.history = "Splice(" + history + ")"
endif else begin
history = "Average(" + history + ")"
if strpos( mtitle, "FB" ) GE 0 then $
mosaic_spec.history = history + "frac-offsets" $
else mosaic_spec.history = history + "int-offsets"
endelse
if (smooth_flag GT 0) then begin
mosaic_spec.filt_width = smooth_flag>3
if (smooth_iterate) AND (smooth_flag GT 3) then $
mosaic_spec.filter="iterate" $
else mosaic_spec.filter="smooth"
endif else begin
mosaic_spec.filter = "none"
mosaic_spec.filt_width = 0
endelse
display_mosaic, mosaic, mosaic_spec, XPOS=1000, YPOS=(200-imos*50)>0
mosaic_spec.display = mosaic_spec.display + "NEW"
mosaic_specs(imos) = mosaic_spec
mos_sizes = mosaic_specs.size_image
image_insert, mosaic, imos, mosaics, mos_sizes
mosaic_specs.size_image = mos_sizes
if (Nimos GT 0) then begin
mosaic_info(*).index = imos
if N_struct( mosaic_infos ) LE 0 then mosaic_infos=mosaic_info $
else mosaic_infos = [ mosaic_infos, mosaic_info ]
endif
end