include procedure t_fixd () # Task parameters char input[SZ_PATHNAME] char pixels[SZ_LINE] char dmode[SZ_LINE] int boxsz bool verbose # Local variables int range[3,50+2], nval, span, npix, ngroups, i, pixel, nxsteps, overscan int ngrp, pixsv, list real datamin, datamax, scl, mean1, mean2, sigma, slope pointer spec, sp, image, im, scale int decode_ranges(), get_next_number() int imtopen(), imtgetim(), immap(), imgl1r(), impl1r(), imgeti() int clgeti() bool clgetb(), streq() begin # Allocate memory call smark( sp ) call salloc( image, SZ_FNAME, TY_CHAR) # Get parameters call clgstr( "images", input, SZ_PATHNAME) call clgstr( "pixels", pixels, SZ_LINE) call clgstr( "dmode", dmode, SZ_LINE) if (streq(dmode,"noisy")) boxsz = clgeti( "boxsize" ) verbose = clgetb( "verbose" ) # Open image list list = imtopen( input ) # Loop over file names specified in input image list while( imtgetim( list, Memc[image], SZ_FNAME) != EOF ) { # Open the image im = immap( Memc[image], READ_WRITE, 0 ) # Get header parameters npix = IM_LEN( im, 1) ngroups = imgeti( im, "GCOUNT" ) nxsteps = imgeti( im, "NXSTEPS" ) overscan = imgeti( im, "OVERSCAN" ) span = nxsteps * overscan if (streq(dmode,"dead")) { call malloc( scale, overscan*overscan, TY_REAL) call sclmat( Memr[scale], overscan ) } call malloc( spec, npix, TY_REAL) # Loop over image groups do ngrp = 1, ngroups { call gf_opengr( im, ngrp, datamin, datamax, 0) call amovr( Memr[imgl1r(im)], Memr[spec], npix) # Decode the input list of pixel values if (decode_ranges( pixels, range, 50+2, nval ) == ERR ) call error ( 1, "Invalid list of pixels specified" ) # Loop over list of pixel values pixel = 0 pixsv = 0 while (get_next_number( range, pixel ) != EOF) { # Fix pixels affected by dead diodes if (streq(dmode,"dead")){ # Fix scaling of pixels affected by previous correction if (pixsv!=0 && pixel=llim) && (ratio<=ulim)) scl = 1./scale[i+1,j+1] } } end