Esempio n. 1
0
    public void actionPerformed(ActionEvent e) {
      // System.out.println("study design button pressed");
      if (InputFile1.isLoaded()) {
        JComboBox<String> choose1 = new JComboBox<String>();

        for (String Modality : InputFile1.getModalityIDs()) {
          choose1.addItem(Modality);
        }
        choose1.setSelectedIndex(0);
        Object[] message = {"Which modality would you like view?\n", choose1};
        JOptionPane.showMessageDialog(
            GUI.MRMCobject.getFrame(),
            message,
            "Choose Modality",
            JOptionPane.INFORMATION_MESSAGE,
            null);
        designMod1 = (String) choose1.getSelectedItem();
        TreeMap<String, String[][]> StudyDesignData =
            InputFile1.getStudyDesign((String) choose1.getSelectedItem());
        final StudyDesignPlot chart =
            new StudyDesignPlot(
                "Study Design: Modality " + designMod1,
                designMod1,
                "Case Index",
                "Reader",
                StudyDesignData,
                InputFile1.filename);
        chart.pack();
        RefineryUtilities.centerFrameOnScreen(chart);
        chart.setVisible(true);

      } else {
        JOptionPane.showMessageDialog(
            GUI.MRMCobject.getFrame(),
            "Pilot study data has not yet been input.",
            "Error",
            JOptionPane.ERROR_MESSAGE);
      }
    }
Esempio n. 2
0
 public void actionPerformed(ActionEvent e) {
   // If input file is loaded, then show ROC curves
   // Otherwise as for pilot study to be inpu
   if (InputFile1.isLoaded()) {
     JPanel panel = new JPanel();
     int modalitynum = InputFile1.getModalityIDs().size();
     JCheckBox[] jCheckboxArray = new javax.swing.JCheckBox[modalitynum];
     for (int i = 0; i < modalitynum; i++) {
       String modID = InputFile1.getModalityIDs().get(i);
       jCheckboxArray[i] = new JCheckBox("" + modID);
       panel.add(jCheckboxArray[i]);
     }
     Object[] message = {"Which modality would you like view?\n", panel};
     JOptionPane.showMessageDialog(
         GUI.MRMCobject.getFrame(),
         message,
         "Choose Modality",
         JOptionPane.INFORMATION_MESSAGE,
         null);
     int checkedmod = 0;
     for (int i = 0; i < modalitynum; i++) {
       if (jCheckboxArray[i].isSelected()) {
         checkedmod++;
       }
     }
     String[] rocMod = new String[checkedmod];
     String roctitle = "";
     int selectmod = 0;
     for (int i = 0; i < modalitynum; i++) {
       if (jCheckboxArray[i].isSelected()) {
         String modID = InputFile1.getModalityIDs().get(i);
         rocMod[selectmod] = modID;
         roctitle = roctitle + modID + " ";
         selectmod++;
       }
     }
     if (selectmod > 0) {
       final ROCCurvePlot roc =
           new ROCCurvePlot(
               "ROC Curve: Modality " + roctitle,
               "FPF (1 - Specificity), legend shows symbols for each modalityID:readerID",
               "TPF (Sensitivity)",
               InputFile1.generateROCpoints(rocMod),
               InputFile1.filename);
       roc.addData(InputFile1.generatePooledROC(rocMod), "Pooled Average");
       roc.pack();
       RefineryUtilities.centerFrameOnScreen(roc);
       roc.setVisible(true);
     } else {
       JOptionPane.showMessageDialog(
           GUI.MRMCobject.getFrame(),
           "Please choose at list one Modality.",
           "Error",
           JOptionPane.ERROR_MESSAGE);
     }
   } else {
     JOptionPane.showMessageDialog(
         GUI.MRMCobject.getFrame(),
         "Pilot study data has not yet been input.",
         "Error",
         JOptionPane.ERROR_MESSAGE);
   }
 }
Esempio n. 3
0
    public void actionPerformed(ActionEvent e) {

      GUI.resetGUI();
      if (GUInterface.selectedInput == GUInterface.DescInputChooseMode) {
        JOptionPane.showMessageDialog(
            GUI.MRMCobject.getFrame(),
            "Please choose one kind of input file.",
            "Error",
            JOptionPane.ERROR_MESSAGE);
        return;
      }
      JFileChooser fc = new JFileChooser();
      FileNameExtensionFilter filter =
          new FileNameExtensionFilter("iMRMC Input Files (.imrmc or csv)", "csv", "imrmc");

      if (GUI.inputfileDirectory != null) fc.setCurrentDirectory(GUI.inputfileDirectory);

      fc.setFileFilter(filter);
      int returnVal = fc.showOpenDialog((Component) e.getSource());
      if (returnVal == JFileChooser.CANCEL_OPTION || returnVal == JFileChooser.ERROR_OPTION) return;
      GUI.inputfileDirectory = fc.getCurrentDirectory(); // save last time visit directory
      /*
       *  Get a pointer to the input file and the filename
       */
      File f = fc.getSelectedFile();
      if (f == null) return;
      InputFile1.filename = f.getPath();
      JTextFilename.setText(f.getPath());
      //			GUI.inputfileDirectory = f.getPath();
      /*
       *  Read the .imrmc input file, check for exceptions
       */
      try {
        InputFile1.ReadInputFile(GUI);
      } catch (IOException except) {
        except.printStackTrace();
        JOptionPane.showMessageDialog(
            GUI.MRMCobject.getFrame(), except.getMessage(), "Error", JOptionPane.ERROR_MESSAGE);
        GUI.resetGUI();
        JTextFilename.setText("");
        return;
      }

      /*
       * Compare the experimental design as determined from fields in the header vs. the data
       */
      if (!InputFile1.dataCheckResults.isEmpty()) {
        JOptionPane.showMessageDialog(
            GUI.MRMCobject.getFrame(),
            InputFile1.dataCheckResults,
            "Warning: Input Header Values Do Not Match Actual Values",
            JOptionPane.WARNING_MESSAGE);
      } else {
        JOptionPane.showMessageDialog(
            GUI.MRMCobject.getFrame(),
            "NR = "
                + InputFile1.Nreader
                + " N0 = "
                + InputFile1.Nnormal
                + " N1 = "
                + InputFile1.Ndisease
                + " NM = "
                + InputFile1.Nmodality,
            "Study Info",
            JOptionPane.INFORMATION_MESSAGE);
      }

      /*
       * Initialze modality pulldown menus
       */
      for (String ModalityID : InputFile1.getModalityIDs()) {
        chooseA.addItem(ModalityID);
        chooseB.addItem(ModalityID);
      }
      DBRecordStat.modalityA = GUInterface.NO_MOD;
      DBRecordStat.modalityB = GUInterface.NO_MOD;
    }