/** * This method is *only* compatible with color transforms that do not require a ColorDeconvolutionStains object - * other transforms will throw an illegal argument exception. * * @param buf * @param method * @param pixels * @return */ public static float[] getSimpleTransformedPixels(final int[] buf, final ColorTransformMethod method, float[] pixels) { return getTransformedPixels(buf, method, pixels, null); }
return ColorTransformer.getTransformedPixels(buf, ColorTransformMethod.Brightness, pixels, stains); case HUE: return ColorTransformer.getTransformedPixels(buf, ColorTransformMethod.Hue, pixels, stains); case OD: return ColorTransformer.getTransformedPixels(buf, ColorTransformMethod.Optical_density_sum, pixels, stains); case RED: return ColorTransformer.getTransformedPixels(buf, ColorTransformMethod.Red, pixels, stains); case GREEN: return ColorTransformer.getTransformedPixels(buf, ColorTransformMethod.Green, pixels, stains); case BLUE: return ColorTransformer.getTransformedPixels(buf, ColorTransformMethod.Blue, pixels, stains); case SATURATION: return ColorTransformer.getTransformedPixels(buf, ColorTransformMethod.Saturation, pixels, stains); case STAIN_1: return ColorTransformer.getTransformedPixels(buf, ColorTransformMethod.Stain_1, pixels, stains); case STAIN_2: return ColorTransformer.getTransformedPixels(buf, ColorTransformMethod.Stain_2, pixels, stains); case STAIN_3: return ColorTransformer.getTransformedPixels(buf, ColorTransformMethod.Stain_3, pixels, stains);
@Override public synchronized float[] getValues(BufferedImage img, int x, int y, int w, int h, float[] array) { ensureStainsUpdated(); if (stains == null) { if (array == null) return new float[w * h]; return array; } int[] buffer = RGBDirectChannelInfo.getRGBIntBuffer(img); if (buffer == null) buffer = img.getRGB(x, y, w, h, null, 0, w); if (method == null) return ColorDeconvolution.colorDeconvolveRGBArray(buffer, stains, stainNumber-1, array); else return ColorTransformer.getTransformedPixels(buffer, method, array, stains); }
static void processTransformedImage(SimpleModifiableImage pxImg, int[] buf, float[] pixels, MeasurementList measurementList, String name, ColorTransformer.ColorTransformMethod method, ColorDeconvolutionStains stains, boolean includeStats, boolean doCircular) { ColorTransformer.getTransformedPixels(buf, method, pixels, stains); if (doCircular) { double w = pxImg.getWidth(); double h = pxImg.getHeight(); double cx = (w-1) / 2; double cy = (h-1) / 2; double radius = Math.max(w, h) * .5; double distThreshold = radius * radius; // int count = 0; for (int y = 0; y < h; y++) { for (int x = 0; x < w; x++) { if ((cx - x)*(cx - x) + (cy - y)*(cy - y) > distThreshold) pxImg.setValue(x, y, Float.NaN); // else // count++; } } // System.out.println("Masked count: " + count + " for dimension " + w + ", " + h); } if (includeStats) addBasicStatistics(pxImg, measurementList, name); addLocalBinaryFeatures(LocalBinaryPatterns.computeLocalBinaryPatterns16(pxImg, 2), measurementList, name); // addLocalBinaryFeatures(LocalBinaryPatterns.computeLocalBinaryPatterns(pxImg), measurementList, name); }
static void processTransformedImage(SimpleModifiableImage pxImg, int[] buf, float[] pixels, MeasurementList measurementList, String name, ColorTransformer.ColorTransformMethod method, ColorDeconvolutionStains stains, boolean includeStats, boolean doCircular) { ColorTransformer.getTransformedPixels(buf, method, pixels, stains); if (doCircular) { double w = pxImg.getWidth(); double h = pxImg.getHeight(); double cx = (w-1) / 2; double cy = (h-1) / 2; double radius = Math.max(w, h) * .5; double distThreshold = radius * radius; // int count = 0; for (int y = 0; y < h; y++) { for (int x = 0; x < w; x++) { if ((cx - x)*(cx - x) + (cy - y)*(cy - y) > distThreshold) pxImg.setValue(x, y, Float.NaN); // else // count++; } } // System.out.println("Masked count: " + count + " for dimension " + w + ", " + h); } if (includeStats) addBasicStatistics(pxImg, measurementList, name); addCoherenceFeature(computeCoherence(pxImg), measurementList, name); }
static void processTransformedImage(SimpleModifiableImage pxImg, int[] buf, float[] pixels, MeasurementList measurementList, String name, ColorTransformer.ColorTransformMethod method, double minValue, double maxValue, int d, int nBins, ColorDeconvolutionStains stains, byte[] maskBytes, boolean includeStats, boolean doCircular) { ColorTransformer.getTransformedPixels(buf, method, pixels, stains);