include include include include # RSDPBACX -- Convert CDBS/FOC background files to RSDP format images # # D. Giaretta, 01-Aug-1987 Original SPP version # Phil Hodge, 10-Jul-1991 get sampoff,lineoff instead of sampbeg,linebeg procedure rsdpbacx() char input[SZ_FNAME] char output[SZ_FNAME] char template[SZ_FNAME] pointer in, imgl2r() pointer out, impl2r() pointer temppt pointer immap() int i, npix, nlines, line pointer i_l, o_l real rtemp, datamin, datamax char temp[SZ_FNAME] int imgeti() begin call clgstr("input", input, SZ_FNAME) in = immap( input, READ_ONLY, NULL) call clgstr("output", output, SZ_FNAME) call clgstr( "template", template, SZ_FNAME) temppt = immap( template, READ_ONLY, 0) out = immap( output, NEW_COPY, temppt) IM_LEN(out, 1) = IM_LEN(in, 1) IM_LEN(out, 2) = IM_LEN(in, 2) IM_PIXTYPE(out) = IM_PIXTYPE(in) npix = IM_LEN(out,1) nlines = IM_LEN(out, 2) datamin = INDEFR datamax = 0 for ( line =1; line <= nlines; line=line+1) { i_l = imgl2r(in, line) o_l = impl2r(out, line) for (i=1; i<=npix; i=i+1) { rtemp = Memr[ i_l+i-1] if ( rtemp > datamax ) datamax = rtemp if ( rtemp < datamin ) datamin = rtemp } call amovr( Memr[i_l], Memr[o_l], npix) } # label the output image call imgstr( in, "OPTCRLY", temp, SZ_FNAME) call imastr( out, "OPTCRLY", temp) call imgstr( in, "PXFORMT", temp, SZ_FNAME) call imastr( out, "PXFORMT", temp) call imaddi( out, "SAMPBEG", imgeti( in, "SAMPOFF") + 1) call imaddi( out, "LINEBEG", imgeti( in, "LINEOFF") + 1) call imastr( out, "COMMENT", " " ) call imaddr( out, "DATAMIN", datamin) call imaddr( out, "DATAMAX", datamax) call imastr( out, "INSTRUME", "FOC") call imastr( out, "FILETYPE", "BACKGROUND") call strcpy( output, temp, SZ_FNAME) call strcat( ".hhh", temp, SZ_FNAME) call imastr( out, "HEADNAME", temp) call strcpy( output, temp, SZ_FNAME) call strcat( ".hhd", temp, SZ_FNAME) call imastr( out, "DATANAME", temp) call foc_date( temp, SZ_FNAME) call imastr( out, "DATE", temp) call imastr( out, "DATAFRMT", "COUNT/SEC") call imunmap( in) call imunmap(out) call imunmap(temppt) end