(ImagePlus imp, boolean showProgress)
| 783 | } // end doOneProjectionZ() |
| 784 | |
| 785 | private ImagePlus zScale(ImagePlus imp, boolean showProgress) { |
| 786 | if (imp.getBitDepth()==16 || imp.getBitDepth()==32) |
| 787 | IJ.run(imp, "8-bit", ""); |
| 788 | IJ.showStatus("Z Scaling..."); |
| 789 | ImageStack stack1 = imp.getStack(); |
| 790 | int depth1 = stack1.getSize(); |
| 791 | ImagePlus imp2 = null; |
| 792 | String title = imp.getTitle(); |
| 793 | ImageProcessor ip = imp.getProcessor(); |
| 794 | ColorModel cm = ip.getColorModel(); |
| 795 | int width1 = imp.getWidth(); |
| 796 | int height1 = imp.getHeight(); |
| 797 | Rectangle r = ip.getRoi(); |
| 798 | int width2 = r.width; |
| 799 | int height2 = r.height; |
| 800 | int depth2 = (int)(stack1.getSize()*sliceInterval+0.5); |
| 801 | imp2 = NewImage.createImage(title, width2, height2, depth2, isRGB?24:8, NewImage.FILL_BLACK); |
| 802 | if (imp2==null || depth2!=imp2.getStackSize()) return null; |
| 803 | ImageStack stack2 = imp2.getStack(); |
| 804 | ImageProcessor xzPlane1 = ip.createProcessor(width2, depth1); |
| 805 | xzPlane1.setInterpolate(true); |
| 806 | ImageProcessor xzPlane2; |
| 807 | int[] line = new int[width2]; |
| 808 | for (int y=0; y<height2; y++) { |
| 809 | for (int z=0; z<depth1; z++) { |
| 810 | if (isRGB) |
| 811 | getRGBRow(stack1, r.x, r.y+y, z, width1, width2, line); |
| 812 | else |
| 813 | getByteRow(stack1, r.x, r.y+y, z, width1, width2, line); |
| 814 | xzPlane1.putRow(0, z, line, width2); |
| 815 | } |
| 816 | //if (y==r.y) new ImagePlus("xzPlane", xzPlane1).show(); |
| 817 | xzPlane1.setProgressBar(null); |
| 818 | xzPlane2 = xzPlane1.resize(width2, depth2); |
| 819 | for (int z=0; z<depth2; z++) { |
| 820 | xzPlane2.getRow(0, z, line, width2); |
| 821 | if (isRGB) |
| 822 | putRGBRow(stack2, y, z, width2, line); |
| 823 | else |
| 824 | putByteRow(stack2, y, z, width2, line); |
| 825 | } |
| 826 | if (showProgress) |
| 827 | IJ.showProgress(y, height2-1); |
| 828 | } |
| 829 | //imp2.show(); |
| 830 | //imp2.setCalibration(imp.getCalibration()); |
| 831 | ImageProcessor ip2 = imp2.getProcessor(); |
| 832 | ip2.setColorModel(cm); |
| 833 | return imp2; |
| 834 | } |
| 835 | |
| 836 | private void showProgress(double percent) { |
| 837 | if (showMicroProgress && !done) |
no test coverage detected