pro prep1, bestim ; version March,16, 1998 ;Read unformatted initial image (640,512) in .bin format ;Write initial image (512,512) in pgm format ;Denoising by cycle average of (Haar,etc) wavelet thresholding (spin1.c) ;Read denoised image in pgm format ;Reconstruct best image using power maximization set_plot,'x' im_init = bytarr(640,512) im = bytarr(512,512) imdebruit = bytarr(512,512) images = bytarr(512,512,2) print,'number of files to process ?' read, nwindow nb = nwindow - 1 name1 = 'spi242' for i = 0, nb do begin number = string( format='(2I)', i) no = strcompress( number,/remove_all) s = no if (i lt 10) then s = '0' + no file = name1 + s + '.bin' openr, 1, file readu, 1, im_init close,1 print, 'Read unformatted initial image (640,512) from file ', file im = im_init(0:511,*) write_ppm,'input.pgm', im print,'Write initial image (512,512) in pgm format on file input.pgm ' print,'Denoising by cycle average of wavelet thresholding...' window, 1, xsize=512, ysize=512 tvscl, im spawn, 'spin1' ; ===== print,'Read denoised image in pgm format' read_ppm,'output.pgm',imdebruit window,2,xsize=512,ysize=512 tvscl, imdebruit images( *, *, i ) = imdebruit endfor ; reconstruct best image using power maximization ntot = 1 maxpow, images, nwindow, ntot, im ;================================= window, 0, xsize=512, ysize=512 tvscl, im ; return best image bestim = im end