Creates a new stack by cropping this one.
(int x, int y, int z, int width, int height, int depth)
| 695 | |
| 696 | /** Creates a new stack by cropping this one. */ |
| 697 | public ImageStack crop(int x, int y, int z, int width, int height, int depth) { |
| 698 | if (x<0||y<0||z<0||x+width>this.width||y+height>this.height||z+depth>size()) |
| 699 | throw new IllegalArgumentException("Argument out of range"); |
| 700 | ImageStack stack2 = new ImageStack(width, height, getColorModel()); |
| 701 | for (int i=z; i<z+depth; i++) { |
| 702 | ImageProcessor ip2 = this.getProcessor(i+1); |
| 703 | ip2.setRoi(x, y, width, height); |
| 704 | ip2 = ip2.crop(); |
| 705 | stack2.addSlice(this.getSliceLabel(i+1), ip2); |
| 706 | } |
| 707 | return stack2; |
| 708 | } |
| 709 | |
| 710 | /** Creates a float version of this stack. */ |
| 711 | public ImageStack convertToFloat() { |
no test coverage detected