//Source file: D:\\Projects\\src\\yi\\iu\\processor\\texture\\reg\\TextureLabeledRgnFts.java

package yi.iu.processor.texture.reg;

import yi.iu.region.LabeledRegionFeatures;
import yi.util.config.*;
import yi.util.io.input.*;
import yi.iu.imgdb.learn.*;
import yi.iu.processor.texture.gabor.*;

public class TextureLabeledRgnFts extends LabeledRegionFeatures
{
  static final long serialVersionUID =  2785806791878576850L;

  public TextureLabeledRgnFts(){};

  /**
   * Given the gabor parameterss of each pixel and the labels, contruct the
   * texture features with labeled region.
   * @param pixels
   * @param labels
   * @param w
   * @param h
   */
  public TextureLabeledRgnFts(double[][] gabors, int[] labels, int w, int h, int old_w, int old_h, boolean zeroAsBg, int ft_vect_dim)
  {
    super(gabors, labels, w, h, old_w, old_h, zeroAsBg, ft_vect_dim);
  }

  public LabeledRegionFeatures createFromFile(String processor_name, int scale, int rst_scale, String img) throws Exception {
    String scaled_img_name = img;
    if (scale != 0)
      scaled_img_name = img +
          yi.iu.processor.resample.Resampler.RESIZED_FILE_SUFFIX + scale;
    if (rst_scale != 0)
      scaled_img_name = scaled_img_name +
          ".r" + rst_scale;
    Configuration.setParameter("SOURCE_NAME", scaled_img_name);

    ColorGuidedTextureSeg dp = (ColorGuidedTextureSeg) Class.forName(processor_name).newInstance();

    TextureLabeledRgnFts ds = (TextureLabeledRgnFts) dp.reuseTextureLabeledRgnFts(DIU.
        INPUT_SER);

    return ds;
  }
//
//  public FeatureRepresentable createFeatureFromFile(String processor_name,
//      int scale,
//      String img) throws Exception {
//    return createFromFile(processor_name, scale, 0, img);
//  }
//
//  public FeatureRepresentable createFeatureFromFile(String processor_name,
//      int scale, int rst_scale,
//      String img) throws Exception {
//    return createFromFile(processor_name, scale, rst_scale, img);
//  }
}
