/**        Read in a real image and simulate imageing with specifed number
 *         of photons per pixel.
 *         Demo for dia course.
 *         @auther Will Hossack, 
 */
import uk.ac.ed.ph.signal.*;                   // Signal classes

public class PoissonDisplay {
    public static void main(String args[]) {

	//            Check that argument was given.
	if (args.length < 2) {
            System.err.println("Usage: java SNRDisplay filename photons");
            System.exit(1);
        }
        String file = args[0];
	double photons = Double.parseDouble(args[1].trim());

	//            Read image (type depermined by suffix)
	RealImage im = RealImage.readImage(file);
	System.out.println("Read image is : " + im);

	

	//            Create a display panel
	ImageFrame display = new ImageFrame("Original Image");
	display.addImage(im);     // Add image with (with autscale defaults)
	display.centre();         // Display in centre of screen


	RealImage nim = im.clone();

	Noise.addPoissonNoise(nim,photons);


	ImageFrame noisedisplay = new ImageFrame("Original Image");
	noisedisplay.addImage(nim); 
    }
}

