@Override public void setAlgorithm(Expression name) { if (name != null) { String algorithm = name.evaluate(null, String.class); if (algorithm != null && !ALGORITHM_NAMES.contains(algorithm)) { throw new IllegalArgumentException( "Unsupported Algorithm has been specified: " + algorithm); } } super.setAlgorithm(name); } }
public void addParameter(String key, Expression value) { if (!PARAM_NAMES.contains(key)) { LOGGER.log( Level.WARNING, "Adding unexpected parameter {0} to {1} Contrast Enhancer", new Object[] {key, method.name()}); } super.addParameter(key, value); } }
/** * The algorithm to be used by this method. Subclasses can implement checks for valid algorithms * by overriding this method. * * @param name the expression that evaluates to the algorithm name. */ public void setAlgorithm(Expression name) { addOption(ALGORITHM, name); }
method_6.setAlgorithm( sldBuilder.literalExpression(ContrastEnhancementType.NORMALIZE_CLIP_TO_ZERO_NAME)); method_6.addOption("minValue", sldBuilder.literalExpression(50)); method_6.addOption("maxValue", sldBuilder.literalExpression(100)); cntEnh_6.setMethod(method_6); final AbstractContrastMethodStrategy method_7 = new NormalizeContrastMethodStrategy(); method_7.setAlgorithm( sldBuilder.literalExpression(ContrastEnhancementType.NORMALIZE_CLIP_TO_ZERO_NAME)); method_7.addParameter("minValue", sldBuilder.literalExpression(50)); method_7.addParameter("maxValue", sldBuilder.literalExpression(18000)); cntEnh_7.setMethod(method_7); final AbstractContrastMethodStrategy method_7f = new NormalizeContrastMethodStrategy(); method_7f.setAlgorithm( sldBuilder.literalExpression(ContrastEnhancementType.NORMALIZE_CLIP_TO_ZERO_NAME)); method_7f.addParameter("minValue", sldBuilder.literalExpression(50)); method_7f.addParameter("maxValue", sldBuilder.literalExpression(200)); cntEnh_7f.setMethod(method_7f); method_7g.setAlgorithm( sldBuilder.literalExpression(ContrastEnhancementType.NORMALIZE_CLIP_TO_ZERO_NAME)); method_7g.addParameter("minValue", sldBuilder.literalExpression(50)); method_7g.addParameter("maxValue", sldBuilder.literalExpression(1200)); cntEnh_7g.setMethod(method_7g);
/** * * <!-- begin-user-doc --> * <!-- end-user-doc --> * * @generated modifiable */ public Object parse(ElementInstance instance, Node node, Object value) throws Exception { AbstractContrastMethodStrategy ret = new HistogramContrastMethodStrategy(); if (node.getChildValue("Algorithm") != null) { Expression algor = (Expression) node.getChildValue("Algorithm"); ret.setAlgorithm(algor); } List<Node> params = node.getChildren("Parameter"); for (Node param : params) { String key = (String) param.getAttributeValue("name"); ret.addParameter(key, (Expression) param.getValue()); } return ret; } }
private AbstractContrastMethodStrategy parseContrastEnhancementMethod( ContrastMethod method, Map<String, Expression> options) { String name = method.name().toUpperCase(); AbstractContrastMethodStrategy ceMethod = null; if ("NORMALIZE".equals(name)) { Expression algorithm = options.get(AbstractContrastMethodStrategy.ALGORITHM); ceMethod = new NormalizeContrastMethodStrategy(); if (algorithm != null) { ceMethod.setAlgorithm(algorithm); } } else if ("LOGARITHMIC".equalsIgnoreCase(name)) { ceMethod = new LogarithmicContrastMethodStrategy(); } else if ("EXPONENTIAL".equalsIgnoreCase(name)) { ceMethod = new ExponentialContrastMethodStrategy(); } else if ("HISTOGRAM".equalsIgnoreCase(name)) { ceMethod = new HistogramContrastMethodStrategy(); } else { throw new IllegalArgumentException( Errors.format(ErrorKeys.UNSUPPORTED_METHOD_$1, method)); } ceMethod.setOptions(options); return ceMethod; }
/** * Fetch any parameters which control the method. * * <p><strong>Note this does not contain the algorithm value</strong>. * * @return a map of Expressions keyed by parameter name. */ public Map<String, Expression> getParameters() { HashMap<String, Expression> parameters = new HashMap<>(getOptions()); if (parameters.containsKey(ALGORITHM)) { parameters.remove(ALGORITHM); } return parameters; }
String algorithmType = parseAlgorithm(method.getAlgorithm()); if (algorithmType == null) { return NORMALIZE_DEFAULT;
/** * Performs a contrast enhancement operation on the input image. Note that not all the contrast * enhancement operations have been implemented in a way that is generic enough o handle all * data types. * * @param inputImage the input {@link RenderedImage} to work on. * @param hints {@link Hints} to control the contrast enhancement process. * @return a {@link RenderedImage} on which a contrast enhancement has been performed. */ private RenderedImage performContrastEnhancement(ImageWorker inputWorker, final Hints hints) { inputWorker.setRenderingHints(hints); if (contrastEnhancementMethod != null) { RenderedImage inputImage = inputWorker.getRenderedImage(); assert inputImage.getSampleModel().getNumBands() == 1 : inputImage; ContrastEnhancementType ceType = ContrastEnhancementType.getType(contrastEnhancementMethod); return ceType.process(inputWorker, hints, contrastEnhancementMethod.getParameters()); } return inputWorker.getRenderedImage(); }
public void addParameter(String key, Expression value) { if (!PARAM_NAMES.contains(key)) { LOGGER.log( Level.WARNING, "Adding unexpected parameter {0} to {1} Contrast Enhancer", new Object[] {key, method.name()}); } super.addParameter(key, value); } }
/** * A parameter to be used by this method. Subclasses can implement checks for valid parameter * names by overriding this method. * * @param key the name of the parameter * @param value the expression that is it's value. */ public void addParameter(String key, Expression value) { addOption(key, value); }