FUNCTION qView_ImageInfo, state, file=file, image=image, number_images=number_images, $ first_file=first_file, last_file=last_file, incr_file=incr_file, list_file=list_file, $ active_file=active_file, display_file=display_file ;+ ; NAME: ; qView_ImageInfo ; PURPOSE: ; Get information about current set of images loaded in memory ; CATEGORY: ; Widget qView ; CALLING SEQUENCE: ; INPUTS: ; state array[1]; structure ; qView state structure ; OPTIONAL INPUT PARAMETERS: ; Each keyword retrieves different information. If more than one keyword is used ; the keywords are processed in the order listed and the information is concatenated into ; a single return long integer return array. ; ; file=file scalar; type: integer ; the corresponding image index is added to the return array ; image=image scalar; type: integer ; image index from the data cube in memory ; the corresponding file index is added to the return array ; /number_images if set the number of images in the image cube is added ; /first_file adds the file index for the first image in the image cube ; /last_file adds the file index for the last image ; /incr_file adds the file increment between images ; /active_file adds the file index for the active image (rounded to the nearest valid index) ; /display_file adds the file index for the image on display ; /list_file adds the whole list of file indices for all images in the image cube ; OPTIONAL OUTPUT PARAMETERS: ; file=file scalar; type: integer ; file index from the list of files ; if the input file was not on the list of files currently in memory ; then the output value is rounded to the nearest file index that is ; in memory. ; image=image scalar; type: integer ; image index from the data cube in memory ; if the input image index was out of range the return value is set ; to the first or last image. ; INCLUDE: @compile_opt.pro ; On error, return to caller ; RESTRICTIONS: ; At least one keyword must be set ; PROCEDURE: ; The images currently loaded in memory are stored in the user value of the state.wid_data ; widget. The images were read from a list of files stored in the user value of the ; state.wid_pick widget. The images were read from a part of the total list of files: ; from frst_file to last_file in steps of incr_file. The total number of files read (= ; the number of images in the image cube) is number_images. ; ; The file index is an index into the list of files. The image index is an index into the ; image cube array. ; STATE INFO USED: ; widget_control, state.wid_active, get_value=active, get_uvalue=display ; widget_control, state.wid_frst, get_value=frst ; widget_control, state.wid_last, get_value=last ; widget_control, state.wid_incr, get_value=incr ; STATE INFO MODIFIED: ; (none) ; MODIFICATION HISTORY: ; FEB-2000, Paul Hick (UCSD/CASS; pphick@ucsd.edu) ;- InitVar, number_images , /key InitVar, first_file , /key InitVar, last_file , /key InitVar, incr_file , /key InitVar, active_file , /key InitVar, display_file , /key InitVar, list_file , /key widget_control, state.wid_active, get_value=active, get_uvalue=display widget_control, state.wid_frst , get_value=frst widget_control, state.wid_last , get_value=last widget_control, state.wid_incr , get_value=incr nimg = 1+((last-frst)>0)/(incr > 1) ; # Images in memory files = frst+lindgen(nimg)*incr ; List of original files (as index into allfiles array) out = 0 IF IsType(file, /defined) THEN BEGIN i = min(abs(files-file), img) ; Pick image closest to 'fromfile' file = files[img] ; Updated file index out = [out,img] ENDIF IF IsType(image, /defined) THEN BEGIN image = (image > 0) < (nimg-1) out = [out,files[image]] ; Updated file index ENDIF IF number_images THEN out = [out, nimg] IF first_file THEN out = [out, frst] IF last_file THEN out = [out, last] IF incr_file THEN out = [out, incr] IF active_file THEN BEGIN IF active NE -1 THEN BEGIN i = min(abs(files-active), image) ; Pick image closest to 'active' out = [out, files[image]] ENDIF ELSE $ out = [out, -1] ENDIF IF display_file THEN out = [out, display] IF list_file THEN out = [out, files] out = out[1:*] IF n_elements(out) EQ 1 THEN out = out[0] RETURN, out & END