Package fr.um2.physique.risa.gui

Source Code of fr.um2.physique.risa.gui.GaussConvolveController

package fr.um2.physique.risa.gui;
import fr.um2.physique.risa.core.process.ConvolveG;
import fr.um2.physique.risa.display.ImageViewer;

/**
* Controller class for the gaussian convolution function.
*
* @author Mathilde Salthun-Lassalle and Ga�l Gonzalez
*/

public class GaussConvolveController {

  GaussConvolveTab view;
  ConvolveG convo;
 

  public GaussConvolveTab getView() {
    return view;
  }

  public void setView(GaussConvolveTab view) {
    this.view = view;
  }

  public ConvolveG getConvo() {
    return convo;
  }

  public void setConvo(ConvolveG convo) {
    this.convo = convo;
  }

  /**
   *
   * asks for the view to display input dialog box for parameters
   * @param String parameter's name
   * @return String its value
   */
  public String askForParameter(String parameter) {
    view = new GaussConvolveTab();
    return (String) view.displayInputForParameter(parameter);

  }

  /**
   * Displays the image with gaussian convolution. Creates an ImageViewer (or
   * view) of the result.
   * @param int radius not equal to 0
   * @param float sigma ( Gaussian width ) positive
   * @see convolveG.createKernel(radius,sigma)
   */
  public void displayGaussianConvolution(int radius, float sigma) {
    if (sigma == 0) {
      throw new IllegalArgumentException("Uncorrect value for sigma");
    }
    if (radius <1) {
      throw new IllegalArgumentException("Uncorrect value for radius");
    }
    convo = new ConvolveG();
    convo.CreateKernel(radius, sigma);
   
    new ImageViewer(convo.getConvolvedImage(), convo.getType());
   
  }

}
TOP

Related Classes of fr.um2.physique.risa.gui.GaussConvolveController

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.