public void extractFeatures(List regions) throws FeatureExtractorException {
    List<Region> van_subregions;
    List<Region> trail_subregions;

    String destination_feature = feature_name + "_reset";
    if (subregion_name != null && !subregion_name.equals("")) {
      destination_feature = feature_name + "_" + subregion_name + "_reset";

      van_subregions = new ArrayList<Region>();
      trail_subregions = new ArrayList<Region>();
      for (Region r : (List<Region>) regions) {
        String van_subregion_name = "van_" + subregion_name;
        String trail_subregion_name = "trail_" + subregion_name;
        if (r.hasAttribute(van_subregion_name)) {
          van_subregions.add((Region) r.getAttribute(van_subregion_name));
        } else {
          throw new FeatureExtractorException("Region, " + r + ", has no subregion: " + van_subregion_name);
        }

        if (r.hasAttribute(trail_subregion_name)) {
          trail_subregions.add((Region) r.getAttribute(trail_subregion_name));
        } else {
          throw new FeatureExtractorException("Region, " + r + ", has no subregion: " + trail_subregion_name);
        }
      }

      try {
        ContourUtils.assignValuesToSubregions(van_subregions, regions, feature_name);
        ContourUtils.assignValuesToSubregions(trail_subregions, regions, feature_name);
      } catch (AuToBIException e) {
        e.printStackTrace();
        return;
      }
    } else {
      van_subregions = regions;
      trail_subregions = regions;
    }

    for (int i = 0; i < regions.size() - 1; ++i) {
      Region van = van_subregions.get(i);
      Region trail = trail_subregions.get(i + 1);

      Aggregation van_agg = new Aggregation();
      Aggregation trail_agg = new Aggregation();

      for (Pair<Double, Double> tvp : (Contour) van.getAttribute(feature_name)) {
        van_agg.insert(tvp.second);
      }
      for (Pair<Double, Double> tvp : (Contour) trail.getAttribute(feature_name)) {
        trail_agg.insert(tvp.second);
      }

      ((Region) regions.get(i))
          .setAttribute(destination_feature, trail_agg.getMean() - van_agg.getMean());
    }
  }