function gt_shape, item, header=header, string=string, short=short, spaces=spaces, x=x, y=y, fr=fr, obs_region=obs_region ; ;+ ;NAME: ; gt_shape ;PURPOSE: ; To extract the word which stores the shape of the image (NX, NY) from the ; index or roadmap ;CALLING SEQUENCE: ; x = gt_shape(roadmap) ; x = gt_shape(index) ; x = gt_shape(index.sxt, /space) ;put single space before string ; x = gt_shape(index, space=3) ;put 3 spaces ; x = gt_shape(roadmap, /x) ;just return 1xN array of x shape ;METHOD: ; The input can be a structure or a scalar. The structure can ; be the index, or roadmap, or observing log. ;INPUT: ; item - A structure or scalar. It can be an array. ;OPTIONAL INPUT: ; string - If present, return the string mnemonic (long notation) ; short - If present, return the short string mnemonic ; spaces - If present, place that many spaces before the output ; string. ; x - If present, just return the x (column) shape ; y - If present, just return the y (lines) shape ; fr - If present, then return the size in Full Resolution pixel ; equivalent. This can only be used if the input is a ; index or roadmap structure. ; obs_region - If set, return the shape of the observing region, not ; the PFI strip ;OUTPUT: ; returns - The shape commanded, a integer value or a string ; value depending on the switches used. It is a vector ; if the input is a vector. The default is a 2xN array ; where N is the size of the roadmap or index array. If ; you use the /X or /Y options, it is 1xN. ;OPTIONAL OUTPUT: ; header - A string that describes the item that was selected ; to be used in listing headers. ;HISTORY: ; Written 6-Jun-93 by M.Morrison ; 23-Jun-93 (MDM) - Modified to use SHAPE_CMD for roadmaps ; 21-Jul-93 (MDM) - Added /OBS_REGION keyword ; 26-Aug-93 (MDM) - Added fix that /OBS_REGION is ignored if ; there are history records ; 15-Aug-2008 (Aki Takeda) - Modified to accept FITS header. ; (NAXIS1, NAXIS2 keywords are used.) ;- ; header_array = ' NX x NY' fmt = "(i4,'x',i3)" ;8 characters ; n = n_elements(item) siz = size(item) typ = siz( siz(0)+1 ) if (typ eq 8) then begin ; tags = tag_names(item) case 1 of (tag_exist(item,'GEN',/top)) : begin ; index out = item.sxt.shape_sav ;if (keyword_set(obs_region) and (max(out(1,*)) eq 64)) then out = item.sxt.shape_cmd if (keyword_set(obs_region) and ( (where(out(1,*) eq 64))(0) ne -1) and $ (not his_exist(item))) then out = item.sxt.shape_cmd ;^^ want to make sure that the data does not have processing which made the shape different from SHAPE_CMD end (tag_exist(item,'SIMPLE',/top)) : begin ; FITS out = transpose([[item.NAXIS1],[item.NAXIS2]]) if (keyword_set(obs_region) and ( (where(out(1,*) eq 64))(0) ne -1) and $ (not his_exist(item))) then out = transpose([[item.SHAPE_C1],[item.SHAPE_C2]]) end else : out = item.shape_cmd ; roadmap endcase end else begin out = item end ; if (keyword_set(fr) and (typ eq 8)) then begin out(0,*) = out(0,*) * 2^gt_res(item) out(1,*) = out(1,*) * 2^gt_res(item) end ; if (keyword_set(x)) then begin header_array = ' NX ' fmt = "(i4)" out = reform(out(0,*)) end if (keyword_set(y)) then begin header_array = ' NY' fmt = "(i3)" out = reform(out(1,*)) end out = gt_conv2str(out, conv2str, conv2short, header_array, header=header, $ string=string, short=short, spaces=spaces, fmt=fmt) ; if (n_elements(out) eq 1) then out = out(0) ;MDM added 2-Jun-93 ; return, out end