(String title, ImageProcessor ip, ImageStack newStack)
| 879 | } |
| 880 | |
| 881 | @AstroImageJ(reason = "Remove ip null check, add check for PlotWindow", modified = true) |
| 882 | void setProcessor2(String title, ImageProcessor ip, ImageStack newStack) { |
| 883 | if (title!=null) setTitle(title); |
| 884 | if (ip==null) |
| 885 | return; |
| 886 | this.ip = ip; |
| 887 | if (getWindow()!=null && !(getWindow() instanceof PlotWindow)) |
| 888 | notifyListeners(UPDATED); |
| 889 | if (ij!=null) |
| 890 | ip.setProgressBar(ij.getProgressBar()); |
| 891 | int stackSize = 1; |
| 892 | boolean dimensionsChanged = width>0 && height>0 && (width!=ip.getWidth() || height!=ip.getHeight()); |
| 893 | if (stack!=null) { |
| 894 | stackSize = stack.size(); |
| 895 | if (currentSlice>stackSize) |
| 896 | setCurrentSlice(stackSize); |
| 897 | if (currentSlice>=1 && currentSlice<=stackSize && !dimensionsChanged) |
| 898 | stack.setPixels(ip.getPixels(),currentSlice); |
| 899 | } |
| 900 | img = null; |
| 901 | if (dimensionsChanged) roi = null; |
| 902 | int type; |
| 903 | if (ip instanceof ByteProcessor) |
| 904 | type = GRAY8; |
| 905 | else if (ip instanceof ColorProcessor) |
| 906 | type = COLOR_RGB; |
| 907 | else if (ip instanceof ShortProcessor) |
| 908 | type = GRAY16; |
| 909 | else |
| 910 | type = GRAY32; |
| 911 | if (width==0) |
| 912 | imageType = type; |
| 913 | else |
| 914 | setType(type); |
| 915 | width = ip.getWidth(); |
| 916 | height = ip.getHeight(); |
| 917 | if (win!=null) { |
| 918 | if (dimensionsChanged && stackSize==1) |
| 919 | win.updateImage(this); |
| 920 | else if (newStack==null) |
| 921 | repaintWindow(); |
| 922 | draw(); |
| 923 | } |
| 924 | } |
| 925 | |
| 926 | /** Replaces the image with the specified stack and updates the display. */ |
| 927 | public void setStack(ImageStack stack) { |
no test coverage detected