|| !rendering.getInputTransform().equals(lastTransform)
|| (blender != null && blender.getParameters().get(3) != colorSelectionMask))) {
PlanarImage labImage = Functions.toColorSpace(back, new LCMS_ColorSpace(new LCMS.LABProfile()),
LCMSColorConvertDescriptor.RELATIVE_COLORIMETRIC, null);
ParameterBlock pb = new ParameterBlock();
pb.addSource(labImage);
pb.add(new int[]{1, 2});
RenderedOp abImage = JAI.create("bandselect", pb, null);
pb = new ParameterBlock();
pb.addSource(back);
pb.add(new double[][]{{ColorScience.Wr, ColorScience.Wg, ColorScience.Wb, 0}});
PlanarImage monochrome = JAI.create("BandCombine", pb, null);
RenderingHints layoutHints = new RenderingHints(JAI.KEY_IMAGE_LAYOUT, Functions.getImageLayout(labImage));
// layoutHints.add(JAIContext.noCacheHint);
pb = new ParameterBlock();
pb.addSource(monochrome);
pb.addSource(abImage);
PlanarImage maskImage = JAI.create("BandMerge", pb, layoutHints);
colorSelectionMask = new RGBColorSelectionMaskOpImage(maskImage, getColorSelection(), null);
ParameterBlock maskPB;
// KernelJAI morph = new KernelJAI(3, 3, new float[]{1, 1, 1, 1, 1, 1, 1, 1, 1});
//
// maskPB = new ParameterBlock();
// maskPB.addSource(colorSelectionMask);
// maskPB.add(morph);
// colorSelectionMask = JAI.create("Erode", maskPB, null);
//
// maskPB = new ParameterBlock();
// maskPB.addSource(colorSelectionMask);
// maskPB.add(morph);
// colorSelectionMask = JAI.create("Dilate", maskPB, null);
RenderingHints extenderHints = new RenderingHints(JAI.KEY_BORDER_EXTENDER,
BorderExtender.createInstance(BorderExtender.BORDER_COPY));
KernelJAI kernel = Functions.getGaussKernel(0.5 * scale);
maskPB = new ParameterBlock();
maskPB.addSource(colorSelectionMask);
maskPB.add(kernel);
colorSelectionMask = JAI.create("Convolve", maskPB, extenderHints);
lastColorSelection = colorSelection;
} else if (colorSelection == null || colorSelection.isAllSelected())
colorSelectionMask = null;