public void run(ImageProcessor ip) { slice++; filter(ip); }
void filter(ImageProcessor ip) { ImageProcessor ip2 = ip; if (ip2 instanceof ColorProcessor) { showStatus("Extracting brightness"); ip2 = ((ColorProcessor)ip2).getBrightness(); showStatus("Pad to "+i+"x"+i); ip2 = tileMirror(ip2, i, i, fitRect.x, fitRect.y); IJ.showProgress(2,20); showStatus(i+"x"+i+" forward transform"); FHT fht = new FHT(ip2); fht.setShowProgress(false); showStatus("Filter in frequency domain"); filterLargeSmall(fht, filterLarge, filterSmall, choiceIndex, sharpness); showStatus("Inverse transform"); fht.inverseTransform(); IJ.showProgress(19,20); showStatus("Crop and convert to original type"); fht.setRoi(fitRect); ip2 = fht.crop(); case 24: ip.snapshot(); showStatus("Setting brightness"); ((ColorProcessor)ip).setBrightness((FloatProcessor)ip2); break;
FHT newFHT(ImageProcessor ip) { FHT fht; int width = ip.getWidth(); int height = ip.getHeight(); int maxN = Math.max(width, height); int size = 2; while (size<1.5*maxN) size *= 2; rect.x = (int)Math.round((size-width)/2.0); rect.y = (int)Math.round((size-height)/2.0); rect.width = width; rect.height = height; FFTFilter fftFilter = new FFTFilter(); if (ip instanceof ColorProcessor) { showStatus("Extracting brightness"); ImageProcessor ip2 = ((ColorProcessor)ip).getBrightness(); fht = new FHT(fftFilter.tileMirror(ip2, size, size, rect.x, rect.y)); fht.rgb = (ColorProcessor)ip.duplicate(); // save so we can later update the brightness } else fht = new FHT(fftFilter.tileMirror(ip, size, size, rect.x, rect.y)); fht.originalWidth = originalWidth; fht.originalHeight = originalHeight; fht.originalBitDepth = imp.getBitDepth(); return fht; }
public int setup(String arg, ImagePlus imp) { this.arg = arg; this.imp = imp; if (imp==null) {IJ.noImage(); return DONE;} stackSize = imp.getStackSize(); fht = (FHT)imp.getProperty("FHT"); if (fht!=null) { IJ.error("FFT Filter", "Spatial domain image required"); return DONE; } if (!showBandpassDialog(imp)) return DONE; else return processStack?DOES_ALL+DOES_STACKS+PARALLELIZE_STACKS:DOES_ALL; }
void filter(ImageProcessor ip) { ImageProcessor ip2 = ip; if (ip2 instanceof ColorProcessor) { showStatus("Extracting brightness"); ip2 = ((ColorProcessor)ip2).getBrightness(); showStatus("Pad to "+i+"x"+i); ip2 = tileMirror(ip2, i, i, fitRect.x, fitRect.y); IJ.showProgress(2,20); showStatus(i+"x"+i+" forward transform"); FHT fht = new FHT(ip2); fht.setShowProgress(false); showStatus("Filter in frequency domain"); filterLargeSmall(fht, filterLarge, filterSmall, choiceIndex, sharpness); showStatus("Inverse transform"); fht.inverseTransform(); IJ.showProgress(19,20); showStatus("Crop and convert to original type"); fht.setRoi(fitRect); ip2 = fht.crop(); case 24: ip.snapshot(); showStatus("Setting brightness"); ((ColorProcessor)ip).setBrightness((FloatProcessor)ip2); break;
FHT newFHT(ImageProcessor ip) { FHT fht; int width = ip.getWidth(); int height = ip.getHeight(); int maxN = Math.max(width, height); int size = 2; while (size<1.5*maxN) size *= 2; rect.x = (int)Math.round((size-width)/2.0); rect.y = (int)Math.round((size-height)/2.0); rect.width = width; rect.height = height; FFTFilter fftFilter = new FFTFilter(); if (ip instanceof ColorProcessor) { showStatus("Extracting brightness"); ImageProcessor ip2 = ((ColorProcessor)ip).getBrightness(); fht = new FHT(fftFilter.tileMirror(ip2, size, size, rect.x, rect.y)); fht.rgb = (ColorProcessor)ip.duplicate(); // save so we can later update the brightness } else fht = new FHT(fftFilter.tileMirror(ip, size, size, rect.x, rect.y)); fht.originalWidth = originalWidth; fht.originalHeight = originalHeight; fht.originalBitDepth = imp.getBitDepth(); return fht; }
public int setup(String arg, ImagePlus imp) { this.arg = arg; this.imp = imp; if (imp==null) {IJ.noImage(); return DONE;} stackSize = imp.getStackSize(); fht = (FHT)imp.getProperty("FHT"); if (fht!=null) { IJ.error("FFT Filter", "Spatial domain image required"); return DONE; } if (!showBandpassDialog(imp)) return DONE; else return processStack?DOES_ALL+DOES_STACKS+PARALLELIZE_STACKS:DOES_ALL; }
public void run(ImageProcessor ip) { slice++; filter(ip); }