/** Aplica el eliminado de extremos. Para ello utiliza el segundo máximo y mínimo de entrada. */
 public void applyRemoveEndsToStretchs(DatasetListStatistics stats, boolean rgb, int band) {
   if (stretchIn == null) return;
   try {
     if (rgb) {
       if (stats.getSecondMinByteUnsigned() != null)
         stretchIn[0] = minValue = stats.getSecondMinByteUnsigned()[band];
       if (stats.getSecondMaxByteUnsigned() != null)
         stretchIn[stretchIn.length - 1] = maxValue = stats.getSecondMaxByteUnsigned()[band];
     } else {
       if (stats.getSecondMin() != null) stretchIn[0] = minValue = stats.getSecondMin()[band];
       if (stats.getMax() != null)
         stretchIn[stretchIn.length - 1] = maxValue = stats.getSecondMax()[band];
     }
   } catch (ArrayIndexOutOfBoundsException ex) {
     // No se asigna el máximo o mínimo
   }
 }
 /**
  * Carga los valores de recorte calculados por el filtro TailTrim que ya debería haber sido
  * aplicado. Estos valores estarán salvados en DatasetListStatistics.
  *
  * @param stats
  */
 public void loadTailTrimValues(DatasetListStatistics stats) {
   double[][] result;
   result = (double[][]) stats.getTailTrimValue(red.tailTrimMin);
   if (result != null) red.tailTrimValueMin = result[0][0];
   result = (double[][]) stats.getTailTrimValue(red.tailTrimMax);
   if (result != null) red.tailTrimValueMax = result[0][1];
   result = (double[][]) stats.getTailTrimValue(green.tailTrimMin);
   if (result != null && result.length >= 2) green.tailTrimValueMin = result[1][0];
   result = (double[][]) stats.getTailTrimValue(green.tailTrimMax);
   if (result != null && result.length >= 2) green.tailTrimValueMax = result[1][1];
   result = (double[][]) stats.getTailTrimValue(blue.tailTrimMin);
   if (result != null && result.length >= 3) blue.tailTrimValueMin = result[2][0];
   result = (double[][]) stats.getTailTrimValue(blue.tailTrimMax);
   if (result != null && result.length >= 3) blue.tailTrimValueMax = result[2][1];
 }
 /**
  * Asigna el máximo y el mínimo
  *
  * @param stats
  * @param type
  * @param band
  */
 public void setMaxMin(DatasetListStatistics stats, int band, boolean rgb) {
   try {
     if (rgb) {
       if (stats.getMinByteUnsigned() != null) minValue = stats.getMinByteUnsigned()[band];
       if (stats.getMaxByteUnsigned() != null) maxValue = stats.getMaxByteUnsigned()[band];
     } else {
       if (stats.getMin() != null) {
         minValue = stats.getMin()[band];
       }
       if (stats.getMax() != null) {
         maxValue = stats.getMax()[band];
       }
     }
     if (stretchIn == null) {
       stretchIn = new double[] {minValue, maxValue};
     } else {
       stretchIn[0] = minValue;
       stretchIn[stretchIn.length - 1] = maxValue;
     }
   } catch (ArrayIndexOutOfBoundsException ex) {
     // No se asigna el máximo o mínimo
   }
 }