import uk.ac.ed.ph.signal.*; import java.io.*; /** Simple test program to input an image using the * general readImage method, extract a region of have * size and display both in two display panels. */ public class ImageExtract { public static void main(String args[]) { // Check we have a file name if (args.length == 0) { System.err.println("Usage: java ImageExtarct filename"); System.exit(1); } RealImage im = RealImage.readImage(args[0]); System.out.println("Read image is " + im); // set extarction parameters int w = im.getWidth()/2; // Half width int h = im.getHeight()/2; // Half height int left = w/2 + 10; // Left int top = h/2; // Top // do the extarction RealImage part = im.extract(left,top,w,h); System.out.println("Extarcted image is " + part); // Dsiplay the two images. ImageFrame displayFull = new ImageFrame(im.getTitle()); displayFull.addImage(im); ImageFrame displayPart = new ImageFrame(part.getTitle()); displayPart.addImage(part); } }