include include # RSDPFMTX -- Convert CDBS/FOC format dependent ref files to RSDP format images # # D. Giaretta, 01-Jan-1988 Original SPP version # Phil Hodge, 10-Jul-1991 Don't get sampbeg or linebeg; fix bug that # the value of lineoff was assigned to sampoff variable. procedure rsdpfmtx() char input[SZ_FNAME] # input image char output[SZ_FNAME] # output image file char template[SZ_FNAME] # output image template #-- pointer in, out, temppt, imgl2r(), impl2r(), i_l pointer immap() int pix, line, naxis1, naxis2 real imgetr(), sampoff, lineoff, datamin, datamax, rtemp bool imaccf() char temp[SZ_LINE] errchk imgl2r, impl2r, imputi, imgstr, impstr, imgetr, imputr begin # get input image call clgstr("input", input, SZ_FNAME) in = immap( input, READ_ONLY, 0) # now get the output image name call clgstr("output", output, SZ_FNAME) # we need the template before opening the output call clgstr( "template", template, SZ_FNAME) temppt = immap( template, READ_ONLY, NULL) out = immap( output, NEW_COPY, temppt) IM_NDIM( out) = 2 IM_LEN( out, 1) = IM_LEN( in, 1) IM_LEN( out, 2) = IM_LEN( in, 2) naxis1 = IM_LEN( out, 1) naxis2 = IM_LEN( out, 2) # Now copy input image to output datamin = MAX_REAL datamax = -MAX_REAL for ( line=1; line <= naxis2; line= line+1) { i_l = imgl2r( in, line) do pix = 1, naxis1 { rtemp = Memr[i_l + pix - 1] if ( rtemp > datamax ) datamax = rtemp if ( rtemp < datamin ) datamin = rtemp } call amovr( Memr[i_l], Memr[impl2r( out, line)], naxis1 ) } # label the output image - # get the info from the input 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) if ( imaccf(in, "sampoff") ) sampoff = imgetr( in, "sampoff") else sampoff = 0. call imaddr( out, "sampoff", sampoff) if ( imaccf(in, "lineoff") ) lineoff = imgetr( in, "lineoff") # bug fix: PEH, 10-July-1991 else lineoff = 0. call imaddr( out, "lineoff", lineoff) call imaddi( out, "SAMPPLN", IM_LEN( in, 1) ) call imaddi( out, "LINEPFM", IM_LEN( in, 2) ) call add_headname( out, output, datamin, datamax ) # close files: call imunmap(out) call imunmap(temppt) call imunmap(in) end