private FloatProcessor createBackgroundIntensityImage() { FloatProcessor backgroundMeanIntensity; if(backgroundMask == null) { float[] data = new float[width * height]; Arrays.fill(data, add_poisson_var > 0 ? (float) add_poisson_var : 0f); backgroundMeanIntensity = new FloatProcessor(width, height, data, null); return backgroundMeanIntensity; } else { backgroundMeanIntensity = (FloatProcessor) backgroundMask.resize(width, height); return ImageMath.multiply((float) (add_poisson_var), backgroundMeanIntensity); } }
public final void resizeInPlace(final int w, final int h) { double min = getMin(); double max = getMax(); this.setPixels(w, h, (float[])super.resize(w, h).getPixels()); // set min,max again, since super.getPixels removes them setMinMax(min, max); }
/** * Gaussian-downsample to the target dimensions * @param ip * @return */ protected FloatProcessor gaussianDownsampled( final FloatProcessor ip ) { loader.releaseToFit( ( (float[])ip.getPixels() ).length * 2 ); // Gaussian-downsample final double sigma = computeSigma( ip.getWidth(), ip.getHeight() ); Utils.log("Gaussian downsampling. If this is slow, check the number of threads in the plugin preferences."); new GaussianBlur().blurFloat( ip, sigma, sigma, 0.0002 ); ip.setInterpolationMethod( ImageProcessor.NEAREST_NEIGHBOR ); return (FloatProcessor) ip.resize( ( int ) Math.ceil( finalBox.width * scale ) ); }
FloatProcessor downsize(int dstWidth, int dstHeight, String msg) { FloatProcessor ip2 = this; if (msg!=null) ij.IJ.showStatus("downsizing in x"+msg); if (dstWidth<roiWidth) { //downsizing in x ip2 = ip2.downsize1D(dstWidth, roiHeight, true); ip2.setRoi(0, 0, dstWidth, roiHeight); //prepare roi for resizing in y } if (msg!=null) ij.IJ.showStatus("downsizing in y"+msg); if (dstHeight<roiHeight) //downsizing in y ip2 = ip2.downsize1D(ip2.getRoi().width, dstHeight, false); if (ip2.getWidth()!=dstWidth || ip2.getHeight()!=dstHeight) ip2 = (FloatProcessor)ip2.resize(dstWidth, dstHeight); //do any upsizing if required return ip2; }
FloatProcessor downsize(int dstWidth, int dstHeight, String msg) { FloatProcessor ip2 = this; if (msg!=null) ij.IJ.showStatus("downsizing in x"+msg); if (dstWidth<roiWidth) { //downsizing in x ip2 = ip2.downsize1D(dstWidth, roiHeight, true); ip2.setRoi(0, 0, dstWidth, roiHeight); //prepare roi for resizing in y } if (msg!=null) ij.IJ.showStatus("downsizing in y"+msg); if (dstHeight<roiHeight) //downsizing in y ip2 = ip2.downsize1D(ip2.getRoi().width, dstHeight, false); if (ip2.getWidth()!=dstWidth || ip2.getHeight()!=dstHeight) ip2 = (FloatProcessor)ip2.resize(dstWidth, dstHeight); //do any upsizing if required return ip2; }