Advertisement
Guest User

Untitled

a guest
Jul 20th, 2017
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.39 KB | None | 0 0
  1. private boolean showDialog(ImageProcessor ip1) {
  2.         float threshold=1, iMin=0, iMax=1;
  3.         GenericDialog inputParameters;
  4.         do {
  5.             inputParameters = new GenericDialog("Paramentri di input"); //Dichiarazione pannello parametri di input
  6.            
  7.             //Prende input il valore di soglia e lo inserisce in threshold. Fa lo stesso con l'intervallo di illuminazione.
  8.             inputParameters.addNumericField("Soglia S (saturazione):", threshold, 0);
  9.             inputParameters.addNumericField("Valore min di I (illuminazione):", iMin, 0);
  10.             inputParameters.addNumericField("Valore max di I (illuminazione):", iMax, 0);
  11.            
  12.             inputParameters.showDialog();
  13.             if (inputParameters.wasCanceled())  {
  14.                 IJ.error("Error", "Plugin annullato dall'utente");
  15.                 return false;
  16.             }
  17.            
  18.             threshold = (float) inputParameters.getNextNumber();
  19.             iMin = (float) inputParameters.getNextNumber();
  20.             iMax = (float) inputParameters.getNextNumber();
  21.  
  22.             if (threshold<0 || threshold>1)
  23.                 JOptionPane.showMessageDialog(null,"Errore: La soglia deve essere tra [0,1]");
  24.             if (iMin<0 || iMin>1)
  25.                 JOptionPane.showMessageDialog(null,"Errore: Imin deve essere tra [0,1]");
  26.             if (iMax<0 || iMax>1)
  27.                 JOptionPane.showMessageDialog(null,"Errore: Imax deve essere tra [0,1]");
  28.         } while (threshold<0 || threshold>1 || iMin<0 || iMin>1 || iMax<0 || iMax>1);
  29.         return true;
  30.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement