public void process(final BufferedImage input) { setInputImage(input); this.input = input; workImage = ConvertBufferedImage.convertFromSingle(input, null, imageType); scaledIntensity = new ImageFloat32(workImage.width, workImage.height); pyramid.setImage(workImage); SwingUtilities.invokeLater( new Runnable() { public void run() { setPreferredSize(new Dimension(input.getWidth(), input.getHeight())); processedImage = true; } }); doRefreshAll(); }
@Override public void setActiveAlgorithm(int indexFamily, String name, Object cookie) { if (input == null) { return; } GeneralFeatureIntensity<T, D> intensity = (GeneralFeatureIntensity<T, D>) cookie; gui.reset(); BufferedImage b = VisualizeImageData.grayMagnitude(workImage, null, 255); gui.addImage(b, "Gray Image"); final ProgressMonitor progressMonitor = new ProgressMonitor( this, "Computing Scale Space Pyramid Response", "", 0, pyramid.getNumLayers()); for (int i = 0; i < pyramid.getNumLayers() && !progressMonitor.isCanceled(); i++) { double scale = pyramid.getScale(i); T scaledImage = pyramid.getLayer(i); anyDerivative.setInput(scaledImage); D derivX = anyDerivative.getDerivative(true); D derivY = anyDerivative.getDerivative(false); D derivXX = anyDerivative.getDerivative(true, true); D derivYY = anyDerivative.getDerivative(false, false); D derivXY = anyDerivative.getDerivative(true, false); intensity.process(scaledImage, derivX, derivY, derivXX, derivYY, derivXY); ImageFloat32 featureImg = intensity.getIntensity(); // scale it up to full resolution DistortImageOps.scale(featureImg, scaledIntensity, TypeInterpolate.NEAREST_NEIGHBOR); // visualize the rescaled intensity b = VisualizeImageData.colorizeSign(scaledIntensity, null, PixelMath.maxAbs(scaledIntensity)); gui.addImage(b, String.format("Scale %6.2f", scale)); final int progressStatus = i + 1; SwingUtilities.invokeLater( new Runnable() { public void run() { progressMonitor.setProgress(progressStatus); } }); } gui.requestFocusInWindow(); }