/Users/lyon/j4p/src/j2d/RoiProcessor.java

1    package j2d; 
2     
3    import graphics.graph.ImageUtil; 
4     
5    import java.awt.*; 
6    import java.awt.image.BufferedImage; 
7    // TODO: NOT YET IMPLEMENTED 
8    public class RoiProcessor 
9            implements ImageProcessorInterface { 
10       Rectangle roi; 
11       ImageProcessorInterface ip; 
12    
13       public RoiProcessor(Rectangle roi, 
14                           ImageProcessorInterface ip) { 
15           this.ip = ip; 
16           this.roi = roi; 
17    
18       } 
19    
20       public Image process(Image image) { 
21           BufferedImage bi = ImageUtils.getBufferedImage(image); 
22           BufferedImage bSubImage = bi.getSubimage( 
23                   (int)roi.getMinX(), 
24                   (int)roi.getMinY(), 
25                   (int)roi.getWidth(), 
26                   (int)roi.getHeight()); 
27           Image psu = ip.process(ImageUtils.getImage(bSubImage)); 
28           return psu; 
29       } 
30   } 
31    
32