Statistics
| Revision:

svn-gvsig-desktop / branches / v2_0_0_prep / libraries / libRaster / src / org / gvsig / raster / grid / filter / enhancement / EnhancementStretchListManager.java @ 29786

History | View | Annotate | Download (18.7 KB)

1 29786 maquerol
/* gvSIG. Sistema de Informaci�n Geogr�fica de la Generalitat Valenciana
2 19338 nbrodin
 *
3
 * Copyright (C) 2006 IVER T.I. and Generalitat Valenciana.
4
 *
5
 * This program is free software; you can redistribute it and/or
6
 * modify it under the terms of the GNU General Public License
7
 * as published by the Free Software Foundation; either version 2
8
 * of the License, or (at your option) any later version.
9
 *
10
 * This program is distributed in the hope that it will be useful,
11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
 * GNU General Public License for more details.
14
 *
15
 * You should have received a copy of the GNU General Public License
16
 * along with this program; if not, write to the Free Software
17
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
18
 */
19
package org.gvsig.raster.grid.filter.enhancement;
20
21
import java.util.ArrayList;
22
23
import org.gvsig.raster.dataset.FileNotOpenException;
24
import org.gvsig.raster.dataset.Params;
25 28498 nbrodin
import org.gvsig.raster.dataset.RasterDriverException;
26 19338 nbrodin
import org.gvsig.raster.grid.filter.FilterTypeException;
27
import org.gvsig.raster.grid.filter.IRasterFilterListManager;
28
import org.gvsig.raster.grid.filter.RasterFilter;
29
import org.gvsig.raster.grid.filter.RasterFilterList;
30
import org.gvsig.raster.grid.filter.RasterFilterListManager;
31 20059 bsanchez
import org.gvsig.raster.grid.filter.enhancement.LinearStretchParams.Stretch;
32 19338 nbrodin
import org.gvsig.raster.grid.filter.statistics.StatisticsListManager;
33
import org.gvsig.raster.hierarchy.IStatistics;
34 26873 vcaballero
import org.gvsig.tools.ToolsLocator;
35
import org.gvsig.tools.extensionpoint.ExtensionPoint;
36
import org.gvsig.tools.extensionpoint.ExtensionPointManager;
37 19338 nbrodin
/**
38
 * Gestor de la pila de filtros para el filtro de realce por intervalos.
39 26873 vcaballero
 *
40 19338 nbrodin
 * @author Nacho Brodin (nachobrodin@gmail.com)
41
 */
42
public class EnhancementStretchListManager implements IRasterFilterListManager {
43 20059 bsanchez
        protected RasterFilterList      filterList        = null;
44
        private RasterFilterListManager filterListManager = null;
45
        private IStatistics             stats             = null;
46 19338 nbrodin
47
        /**
48
         * Constructor
49
         * @param filterListManager
50
         */
51
        public EnhancementStretchListManager(RasterFilterListManager filterListManager) {
52
                this.filterListManager = filterListManager;
53
                this.filterList = filterListManager.getFilterList();
54
                stats = (IStatistics)filterList.getEnvParam("IStatistics");
55
        }
56 26873 vcaballero
57 19363 nbrodin
        /**
58 19338 nbrodin
         * Asigna el objeto con las estadisticas.
59
         * @param stats
60
         */
61
        public void setStatistics(IStatistics stats) {
62
                this.stats = stats;
63
        }
64
65 22294 bsanchez
        /**
66
         * Registra EnhancementStretchListManager en los puntos de extension de RasterFilter
67
         */
68 19338 nbrodin
        public static void register() {
69 26873 vcaballero
                ExtensionPointManager extensionPoints =ToolsLocator.getExtensionPointManager();
70
                ExtensionPoint point=extensionPoints.get("RasterFilter");
71
                point.append("EnhancementStretch", "", EnhancementStretchListManager.class);
72 19338 nbrodin
        }
73
74
        /**
75 29786 maquerol
         * A�ade un filtro de realce.
76
         * La forma de inserci�n del filtro es fija ya que la inserci�n de un realce lleva implicita
77
         * la inserci�n de un filtro de recorte de colas (tailtrim), aunque no en todos los casos.
78
         * Si ya existe un filtro de realce en la lista se obtiene la posici�n de este.
79 19338 nbrodin
         * Si es necesario un recorte de colas entonces se comprueba si existe un uno reemplazandose
80 29786 maquerol
         * por el nuevo y sino se insertar� uno. Al final reemplazamos el realce que existia.
81 19338 nbrodin
         *
82 29786 maquerol
         * Si por el contrario no existen realce ni trim se a�aden ambos al final de la lista.
83 19338 nbrodin
         * @param stats Objeto de estadisticas asociado
84 29786 maquerol
         * @param tailTrim porcentaje de recorte de colas. Ser� un valor entre 0 y 1.
85
         * @param insertionMode Modo de inserci�n
86
         * @param renderBands bandas RGB mostradas en la visualizaci�n.
87 26873 vcaballero
         * @throws FilterTypeException
88 19338 nbrodin
         */
89 19377 nbrodin
        public void addEnhancedStretchFilter(LinearStretchParams leParams, IStatistics stats, int[] renderBands, boolean removeEnds) throws FilterTypeException {
90 19338 nbrodin
                try {
91 29786 maquerol
                        if (!leParams.hasTailTrim()) { // En este caso siempre es necesario el m�ximo y
92
                                // m�nimo
93 28202 nbrodin
                                if (!stats.isCalculated())
94 19338 nbrodin
                                        try {
95
                                                stats.calcFullStatistics();
96
                                        } catch (FileNotOpenException e) {
97
                                                // No podemos aplicar el filtro
98
                                                return;
99
                                        } catch (RasterDriverException e) {
100
                                                // No podemos aplicar el filtro
101
                                                return;
102
                                        }
103
                        } else {
104
                                StatisticsListManager slm = new StatisticsListManager(filterListManager, stats);
105 19377 nbrodin
                                slm.addTailFilter(leParams.getTailTrimList(), 0D, removeEnds, stats);
106 19338 nbrodin
                        }
107
108 19377 nbrodin
                        RasterFilter filter = createEnhancedFilter(leParams, stats, renderBands, removeEnds);
109 19338 nbrodin
                        if (filter != null)
110
                                filterList.add(filter);
111
                } catch (InterruptedException e) {
112 29786 maquerol
                        //Si se ha interrumpido no a�adimos el filtro
113 19338 nbrodin
                }
114
        }
115
116 19363 nbrodin
        /**
117 29786 maquerol
         * Crea un filtro de realce por tramos de forma est�tica
118
         * @param leParams Par�metros del filtro
119 19363 nbrodin
         * @param stats
120
         * @param renderBands
121
         * @return
122
         */
123 19377 nbrodin
        public static RasterFilter createEnhancedFilter(LinearStretchParams leParams, IStatistics stats, int[] renderBands, boolean removeEnds) {
124 19338 nbrodin
                RasterFilter filter = new LinearStretchEnhancementFloatFilter();
125
                if (filter != null) {
126
                        filter.addParam("stats", stats);
127 19363 nbrodin
                        filter.addParam("remove", new Boolean(false));
128 19338 nbrodin
                        filter.addParam("renderBands", renderBands);
129 19363 nbrodin
                        filter.addParam("stretchs", leParams);
130 19377 nbrodin
                        filter.addParam("remove", new Boolean(removeEnds));
131 19338 nbrodin
                }
132
133
                return filter;
134
        }
135
136
        /**
137 20059 bsanchez
         * Convierte un array de dobles a una cadena
138
         * @param values
139
         * @return
140
         */
141
        private String convertArrayToString(double[] values) {
142
                StringBuffer buffer = new StringBuffer();
143
                for (int i = 0; i < values.length; i++) {
144
                        buffer.append(values[i]);
145
                        if (i < (values.length - 1))
146
                                buffer.append(",");
147
                }
148
                return buffer.toString();
149
        }
150
151
        /**
152
         * Convierte una array de enteros a una cadena
153
         * @param values
154
         * @return
155
         */
156
        private String convertArrayToString(int[] values) {
157
                StringBuffer buffer = new StringBuffer();
158
                for (int i = 0; i < values.length; i++) {
159
                        buffer.append(values[i]);
160
                        if (i < (values.length - 1))
161
                                buffer.append(",");
162
                }
163
                return buffer.toString();
164
        }
165 26873 vcaballero
166 20059 bsanchez
        /**
167
         * Convierte una cadena a un array de enteros
168
         * @param from
169
         * @return
170
         */
171
        private int[] StringToIntegerArray(String from) {
172
                String[] valueList = from.split(",");
173
                int[] values = new int[valueList.length];
174 28202 nbrodin
                for (int i = 0; i < values.length; i++)
175 20059 bsanchez
                        try {
176
                                values[i] = Integer.parseInt(valueList[i]);
177
                        } catch (NumberFormatException e) {
178
                        }
179
                return values;
180
        }
181
182
        /**
183
         * Convierte una cadena a un array de dobles
184
         * @param from
185
         * @return
186
         */
187
        private double[] StringToDoubleArray(String from) {
188
                String[] valueList = from.split(",");
189
                double[] values = new double[valueList.length];
190 28202 nbrodin
                for (int i = 0; i < values.length; i++)
191 20059 bsanchez
                        try {
192
                                values[i] = Double.parseDouble(valueList[i]);
193
                        } catch (NumberFormatException e) {
194
                        }
195
                return values;
196
        }
197
198
        /**
199
         * Guarda en el array de valores, todos los valores del objeto Strech para ser
200 26873 vcaballero
         * almacenado en el
201 20059 bsanchez
         * @param filterList
202
         * @param band
203
         * @param stretch
204
         */
205
        private void putStretchBand(ArrayList filterList, String band, Stretch stretch) {
206
                filterList.add("filter.linearstretchenhancement." + band + ".maxValue=" + stretch.maxValue);
207
                filterList.add("filter.linearstretchenhancement." + band + ".minValue=" + stretch.minValue);
208
                if (stretch.offset != null)
209
                        filterList.add("filter.linearstretchenhancement." + band + ".offset=" + convertArrayToString(stretch.offset));
210
                if (stretch.scale != null)
211
                        filterList.add("filter.linearstretchenhancement." + band + ".scale=" + convertArrayToString(stretch.scale));
212
                if (stretch.stretchIn != null)
213
                        filterList.add("filter.linearstretchenhancement." + band + ".stretchIn=" + convertArrayToString(stretch.stretchIn));
214
                if (stretch.stretchOut != null)
215
                        filterList.add("filter.linearstretchenhancement." + band + ".stretchOut=" + convertArrayToString(stretch.stretchOut));
216
                filterList.add("filter.linearstretchenhancement." + band + ".tailTrimMax=" + stretch.tailTrimMax);
217
                filterList.add("filter.linearstretchenhancement." + band + ".tailTrimMin=" + stretch.tailTrimMin);
218
                filterList.add("filter.linearstretchenhancement." + band + ".tailTrimValueMax=" + stretch.tailTrimValueMax);
219
                filterList.add("filter.linearstretchenhancement." + band + ".tailTrimValueMin=" + stretch.tailTrimValueMin);
220
                filterList.add("filter.linearstretchenhancement." + band + ".functionType=" + stretch.functionType);
221
                filterList.add("filter.linearstretchenhancement." + band + ".valueFunction=" + stretch.valueFunction);
222
        }
223
224
        /**
225 19338 nbrodin
         * Obtiene un Array de Strings a partir de una pila de filtros. Cada elemento
226 29786 maquerol
         * del array tendr� la forma de elemento=valor.
227 19338 nbrodin
         */
228
        public ArrayList getStringsFromFilterList(ArrayList filterList, RasterFilter rf) {
229
                if (rf instanceof LinearStretchEnhancementFilter) {
230 20059 bsanchez
                        LinearStretchEnhancementFilter filter = (LinearStretchEnhancementFilter) rf;
231 29786 maquerol
                        LinearStretchParams stretchs = (LinearStretchParams) filter.getParam("stretchs");
232
                        int [] renderBands = (int[]) filter.getParam("renderBands");
233
234 20059 bsanchez
                        filterList.add("filter.linearstretchenhancement.active=true");
235 28202 nbrodin
                        filterList.add("filter.linearstretchenhancement.removeends=" + filter.getRemoveEnds());
236 29786 maquerol
                        putStretchBand(filterList, "red", stretchs.red);
237
                        putStretchBand(filterList, "green", stretchs.green);
238
                        putStretchBand(filterList, "blue", stretchs.blue);
239
                        filterList.add("filter.linearstretchenhancement.renderbands=" + convertArrayToString(renderBands));
240
                        filterList.add("filter.linearstretchenhancement.RGB=" + Boolean.valueOf(stretchs.rgb).toString());
241 19338 nbrodin
                }
242
243
                return filterList;
244
        }
245
246 20059 bsanchez
        /**
247
         * Configura algun parametro del objeto Stretch, respecto a una banda, su
248
         * propiedad y el valor, en caso de no encontrar la propiedad o no ser dicha
249
         * banda, devuelve false. Es util para usarlo para extraer los valores de
250
         * createFilterListFromStrings
251
         * @param band
252
         * @param property
253
         * @param value
254
         * @param stretch
255
         * @return
256
         */
257
        public boolean getStretchBand(String band, String property, String value, Stretch stretch) {
258
                if (property.startsWith("filter.linearstretchenhancement." + band)) {
259
                        if (property.startsWith("filter.linearstretchenhancement." + band + ".maxValue")) {
260
                                stretch.maxValue = Double.parseDouble(value);
261
                                return true;
262
                        }
263
                        if (property.startsWith("filter.linearstretchenhancement." + band + ".minValue")) {
264
                                stretch.minValue = Double.parseDouble(value);
265
                                return true;
266
                        }
267
                        if (property.startsWith("filter.linearstretchenhancement." + band + ".offset")) {
268
                                stretch.offset = StringToDoubleArray(value);
269
                                return true;
270
                        }
271
                        if (property.startsWith("filter.linearstretchenhancement." + band + ".scale")) {
272
                                stretch.scale = StringToDoubleArray(value);
273
                                return true;
274
                        }
275
                        if (property.startsWith("filter.linearstretchenhancement." + band + ".stretchIn")) {
276
                                stretch.stretchIn = StringToDoubleArray(value);
277
                                return true;
278
                        }
279
                        if (property.startsWith("filter.linearstretchenhancement." + band + ".stretchOut")) {
280
                                stretch.stretchOut = StringToIntegerArray(value);
281
                                return true;
282
                        }
283
                        if (property.startsWith("filter.linearstretchenhancement." + band + ".tailTrimMax")) {
284
                                stretch.tailTrimMax = Double.parseDouble(value);
285
                                return true;
286
                        }
287
                        if (property.startsWith("filter.linearstretchenhancement." + band + ".tailTrimMin")) {
288
                                stretch.tailTrimMin = Double.parseDouble(value);
289
                                return true;
290
                        }
291
                        if (property.startsWith("filter.linearstretchenhancement." + band + ".tailTrimValueMax")) {
292
                                stretch.tailTrimValueMax = Double.parseDouble(value);
293
                                return true;
294
                        }
295
                        if (property.startsWith("filter.linearstretchenhancement." + band + ".tailTrimValueMin")) {
296
                                stretch.tailTrimValueMin = Double.parseDouble(value);
297
                                return true;
298
                        }
299
                        if (property.startsWith("filter.linearstretchenhancement." + band + ".functionType")) {
300
                                stretch.functionType = Integer.parseInt(value);
301
                                return true;
302
                        }
303
                        if (property.startsWith("filter.linearstretchenhancement." + band + ".valueFunction")) {
304
                                stretch.valueFunction = Double.parseDouble(value);
305
                                return true;
306
                        }
307
                }
308
                return false;
309
        }
310 26873 vcaballero
311 19338 nbrodin
        /*
312
         * (non-Javadoc)
313
         * @see org.gvsig.raster.grid.filter.IRasterFilterListManager#createFilterListFromStrings(java.util.ArrayList, java.lang.String, int)
314
         */
315
        public int createFilterListFromStrings(ArrayList filters, String fil, int filteri) throws FilterTypeException {
316 20059 bsanchez
                String pkgBase = "filter.linearstretchenhancement.";
317 28202 nbrodin
                if (fil.startsWith(pkgBase + "active")) {
318 20059 bsanchez
                        boolean exec = true;
319 28202 nbrodin
                        boolean removeEnds = false;
320 20059 bsanchez
                        if ((RasterFilterListManager.getValue(fil).equals("false")))
321
                                exec = false;
322
                        filters.remove(0);
323 19338 nbrodin
                        int[] renderBands = new int[] { 0, 0, 0 };
324 20059 bsanchez
                        LinearStretchParams stretchParams = new LinearStretchParams();
325 26873 vcaballero
326 19338 nbrodin
                        for (int propFilter = 0; propFilter < filters.size(); propFilter++) {
327
                                String elem = (String) filters.get(propFilter);
328 20059 bsanchez
                                String value = RasterFilterListManager.getValue(elem);
329 19338 nbrodin
330 20059 bsanchez
                                if (elem.startsWith("filter.linearstretchenhancement.renderbands")) {
331
                                        renderBands = StringToIntegerArray(value);
332
                                        continue;
333 19338 nbrodin
                                }
334 21134 bsanchez
335 20059 bsanchez
                                if (elem.startsWith("filter.linearstretchenhancement.RGB")) {
336
                                        stretchParams.rgb = Boolean.parseBoolean(value);
337
                                        continue;
338 19338 nbrodin
                                }
339 21134 bsanchez
340 28202 nbrodin
                                if (elem
341
                                                .startsWith("filter.linearstretchenhancement.removeends")) {
342
                                        removeEnds = Boolean.parseBoolean(value);
343
                                        continue;
344
                                }
345
346 21134 bsanchez
                                if (getStretchBand("red", elem, value, stretchParams.red))
347
                                        continue;
348
                                if (getStretchBand("green", elem, value, stretchParams.green))
349
                                        continue;
350
                                if (getStretchBand("blue", elem, value, stretchParams.blue))
351
                                        continue;
352 19338 nbrodin
                        }
353 26873 vcaballero
354 20059 bsanchez
                        filterList.remove(LinearStretchEnhancementFilter.class);
355 28202 nbrodin
                        addEnhancedStretchFilter(stretchParams, stats, renderBands,
356
                                        removeEnds);
357 26873 vcaballero
358 20059 bsanchez
                        LinearStretchEnhancementFilter lsef = (LinearStretchEnhancementFilter) filterList.getFilterByBaseClass(LinearStretchEnhancementFilter.class);
359
                        lsef.setExec(exec);
360 19338 nbrodin
                }
361
                return filteri;
362
        }
363
364
        /*
365
         * (non-Javadoc)
366
         * @see org.gvsig.raster.grid.filter.IRasterFilterListManager#getRasterFilterList()
367
         */
368
        public ArrayList getRasterFilterList() {
369
                ArrayList filters = new ArrayList();
370
                filters.add(LinearStretchEnhancementFilter.class);
371
                return filters;
372
        }
373
374 19363 nbrodin
        /*
375
         * (non-Javadoc)
376
         * @see org.gvsig.raster.grid.filter.IRasterFilterListManager#addFilter(java.lang.Class, org.gvsig.raster.dataset.Params)
377
         */
378 19338 nbrodin
        public void addFilter(Class classFilter, Params params) throws FilterTypeException {
379
                if (classFilter.equals(LinearStretchEnhancementFilter.class)) {
380
                        int[] renderBands = { 0, 1, 2 };
381 19377 nbrodin
                        boolean removeEnds = false;
382 19338 nbrodin
383 20059 bsanchez
                        LinearStretchParams leParams = new LinearStretchParams();
384 26873 vcaballero
385 19338 nbrodin
                        for (int i = 0; i < params.getNumParams(); i++) {
386 26873 vcaballero
                                if (params.getParam(i).id.equals("RenderBands") &&
387 19338 nbrodin
                                        params.getParam(i).defaultValue instanceof String) {
388
                                        String[] bands = new String((String) params.getParam(i).defaultValue).split(" ");
389
                                        renderBands[0] = new Integer(bands[0]).intValue();
390
                                        renderBands[1] = new Integer(bands[1]).intValue();
391
                                        renderBands[2] = new Integer(bands[2]).intValue();
392
                                        continue;
393
                                }
394 26873 vcaballero
395 19377 nbrodin
                                if (params.getParam(i).id.equals("Remove"))
396
                                        removeEnds = ((Boolean) params.getParam(i).defaultValue).booleanValue();
397 26873 vcaballero
398 19494 nbrodin
                                if (params.getParam(i).id.equals("RGB"))
399 20059 bsanchez
                                        leParams.rgb = ((Boolean) params.getParam(i).defaultValue).booleanValue();
400 26873 vcaballero
401 19363 nbrodin
                                if (params.getParam(i).id.equals("StretchInRed") &&
402
                                        params.getParam(i).defaultValue instanceof double[])
403 20059 bsanchez
                                        leParams.red.stretchIn = ((double[]) params.getParam(i).defaultValue);
404 26873 vcaballero
405 19363 nbrodin
                                if (params.getParam(i).id.equals("StretchInGreen") &&
406
                                        params.getParam(i).defaultValue instanceof double[])
407 20059 bsanchez
                                        leParams.green.stretchIn = ((double[]) params.getParam(i).defaultValue);
408 26873 vcaballero
409 19363 nbrodin
                                if (params.getParam(i).id.equals("StretchInBlue") &&
410
                                                params.getParam(i).defaultValue instanceof double[])
411 20059 bsanchez
                                        leParams.blue.stretchIn = ((double[]) params.getParam(i).defaultValue);
412 21134 bsanchez
413 19363 nbrodin
                                if (params.getParam(i).id.equals("StretchOutRed") &&
414
                                        params.getParam(i).defaultValue instanceof int[])
415 20059 bsanchez
                                        leParams.red.stretchOut = ((int[]) params.getParam(i).defaultValue);
416 19338 nbrodin
417 19363 nbrodin
                                if (params.getParam(i).id.equals("StretchOutGreen") &&
418
                                        params.getParam(i).defaultValue instanceof int[])
419 20059 bsanchez
                                        leParams.green.stretchOut = ((int[]) params.getParam(i).defaultValue);
420 19363 nbrodin
421
                                if (params.getParam(i).id.equals("StretchOutBlue") &&
422
                                        params.getParam(i).defaultValue instanceof int[])
423 20059 bsanchez
                                        leParams.blue.stretchOut = ((int[]) params.getParam(i).defaultValue);
424 19363 nbrodin
425
                                if (params.getParam(i).id.equals("TailTrimRedMin") &&
426 19338 nbrodin
                                        params.getParam(i).defaultValue instanceof Double)
427 20059 bsanchez
                                        leParams.red.tailTrimMin = ((Double) params.getParam(i).defaultValue).doubleValue();
428 26873 vcaballero
429 19363 nbrodin
                                if (params.getParam(i).id.equals("TailTrimRedMax") &&
430 19377 nbrodin
                                        params.getParam(i).defaultValue instanceof Double)
431 20059 bsanchez
                                        leParams.red.tailTrimMax = ((Double) params.getParam(i).defaultValue).doubleValue();
432 26873 vcaballero
433 19363 nbrodin
                                if (params.getParam(i).id.equals("TailTrimGreenMin") &&
434 19377 nbrodin
                                        params.getParam(i).defaultValue instanceof Double)
435 20059 bsanchez
                                        leParams.green.tailTrimMin = ((Double) params.getParam(i).defaultValue).doubleValue();
436 26873 vcaballero
437 19363 nbrodin
                                if (params.getParam(i).id.equals("TailTrimGreenMax") &&
438 19377 nbrodin
                                        params.getParam(i).defaultValue instanceof Double)
439 20059 bsanchez
                                        leParams.green.tailTrimMax = ((Double) params.getParam(i).defaultValue).doubleValue();
440 26873 vcaballero
441 19363 nbrodin
                                if (params.getParam(i).id.equals("TailTrimBlueMin") &&
442 19377 nbrodin
                                        params.getParam(i).defaultValue instanceof Double)
443 20059 bsanchez
                                        leParams.blue.tailTrimMin = ((Double) params.getParam(i).defaultValue).doubleValue();
444 26873 vcaballero
445 19363 nbrodin
                                if (params.getParam(i).id.equals("TailTrimBlueMax") &&
446 19377 nbrodin
                                        params.getParam(i).defaultValue instanceof Double)
447 20059 bsanchez
                                        leParams.blue.tailTrimMax = ((Double) params.getParam(i).defaultValue).doubleValue();
448
449
                                if (params.getParam(i).id.equals("StretchRedFunctionType") &&
450
                                                params.getParam(i).defaultValue instanceof Integer)
451
                                                leParams.red.functionType = ((Integer) params.getParam(i).defaultValue).intValue();
452
453
                                if (params.getParam(i).id.equals("StretchRedValueFunction") &&
454
                                                params.getParam(i).defaultValue instanceof Double)
455
                                                leParams.red.valueFunction = ((Double) params.getParam(i).defaultValue).doubleValue();
456
457
                                if (params.getParam(i).id.equals("StretchGreenFunctionType") &&
458
                                                params.getParam(i).defaultValue instanceof Integer)
459
                                                leParams.green.functionType = ((Integer) params.getParam(i).defaultValue).intValue();
460
461
                                if (params.getParam(i).id.equals("StretchGreenValueFunction") &&
462
                                                params.getParam(i).defaultValue instanceof Double)
463
                                                leParams.green.valueFunction = ((Double) params.getParam(i).defaultValue).doubleValue();
464
465
                                if (params.getParam(i).id.equals("StretchBlueFunctionType") &&
466
                                                params.getParam(i).defaultValue instanceof Integer)
467
                                                leParams.blue.functionType = ((Integer) params.getParam(i).defaultValue).intValue();
468
469
                                if (params.getParam(i).id.equals("StretchBlueValueFunction") &&
470
                                                params.getParam(i).defaultValue instanceof Double)
471
                                                leParams.blue.valueFunction = ((Double) params.getParam(i).defaultValue).doubleValue();
472 19338 nbrodin
                        }
473 20059 bsanchez
474 19377 nbrodin
                        addEnhancedStretchFilter(leParams, (IStatistics) filterList.getEnvParam("IStatistics"), renderBands, removeEnds);
475 19338 nbrodin
                }
476
        }
477
}