protected void applySmoothingFilter(double rad) { float[] pixels = new float[gridHeight*gridWidth]; for (int i=0; i < gridHeight*gridWidth; i++) { pixels[i] = (float) plotList[i].lum; } ImageProcessor ip = new FloatProcessor(gridWidth, gridHeight, pixels, null); new GaussianBlur().blur(ip, rad); // reset progress bar (which was set by gaussian blur) IJ.showProgress( 1.); // ImagePlus imp2 = new ImagePlus("test", ip); // imp2.show(); // imp2.updateAndDraw(); pixels = (float[] )ip.getPixels(); for (int i=0; i < gridHeight*gridWidth; i++) { plotList[i].z = plotList[i].zf = pixels[i]; } applyMinMax(); }
blurImage.blur(imProcBGR[channel],(double)RetinexScales[scale]*2.5); //2.5 is the difference between IJ blur and photoshop's see ImageJ API out=(float[]) imProcBGR[channel].getPixelsCopy();
public static FloatProcessor focus(FloatProcessor[] slices, double radius) { boolean wasBatchMode = Interpreter.batchMode; Interpreter.batchMode = true; // calculate weights GaussianBlur blur = new GaussianBlur(); int pixelCount = slices[0].getWidth() * slices[0].getHeight(); FloatProcessor[] weights = new FloatProcessor[slices.length]; for (int i = 0; i < slices.length; i++) { weights[i] = (FloatProcessor)slices[i].duplicate(); blur.blur(weights[i], radius); float[] pixels1 = (float[])slices[i].getPixels(); float[] pixels2 = (float[])weights[i].getPixels(); for (int j = 0; j < pixelCount; j++) pixels2[j] = Math.abs(pixels2[j] - pixels1[j]); } FloatProcessor result = (FloatProcessor)slices[0].duplicate(); for (int j = 0; j < pixelCount; j++) { float cumul = 0, totalWeight = 0; for (int i = 0; i < slices.length; i++) { float value = slices[i].getf(j); float weight = weights[i].getf(j); cumul += value * weight; totalWeight += weight; } if (totalWeight != 0) result.setf(j, cumul / totalWeight); } Interpreter.batchMode = wasBatchMode; return result; }
for (int i = 0; i < slices.length; i++) { weights[i] = (FloatProcessor)slices[i].duplicate(); blur.blur(weights[i], radius); float[] pixels1 = (float[])slices[i].getPixels(); float[] pixels2 = (float[])weights[i].getPixels();
if (Costes) gb.blur(ipRand, psf); stackRand.addSlice("Correlation Plot", ipRand);