Пример #1
0
    public void actionPerformed(ActionEvent e) {
      if (DBRecordStat.totalVar > 0.0) {
        JFrame JFrameAUC = new JFrame("AUCs for each reader and modality");
        RefineryUtilities.centerFrameOnScreen(JFrameAUC);
        JFrameAUC.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);

        Object[] colNames = {
          "ReaderID", "AUC " + DBRecordStat.modalityA, "AUC " + DBRecordStat.modalityB
        };
        Object[][] rowContent = new String[(int) DBRecordStat.Nreader][3];
        int i = 0;
        for (String desc_temp : InputFile1.readerIDs.keySet()) {
          rowContent[i][0] = desc_temp;
          rowContent[i][1] = Double.toString(DBRecordStat.AUCs[i][0]);
          rowContent[i][2] = Double.toString(DBRecordStat.AUCs[i][1]);
          i++;
        }

        JTable tableAUC = new JTable(rowContent, colNames);
        JScrollPane scrollPaneAUC = new JScrollPane(tableAUC);
        JFrameAUC.add(scrollPaneAUC, BorderLayout.CENTER);
        JFrameAUC.setSize(600, 300);
        JFrameAUC.setVisible(true);
      } else {
        JOptionPane.showMessageDialog(
            GUI.MRMCobject.getFrame(),
            "Pilot study data has not yet been analyzed.",
            "Error",
            JOptionPane.ERROR_MESSAGE);
      }
    }
Пример #2
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);
      }
    }
Пример #3
0
    public void actionPerformed(ActionEvent e) {
      // System.out.println("graph button pressed");
      if (InputFile1 != null && InputFile1.isLoaded()) {
        final BarGraph cpr =
            new BarGraph("Cases per Reader", "Readers", "Cases", InputFile1.casesPerReader());
        cpr.pack();
        RefineryUtilities.centerFrameOnScreen(cpr);
        cpr.setVisible(true);

        final BarGraph rpc =
            new BarGraph("Readers per Case", "Cases", "Readers", InputFile1.readersPerCase());
        rpc.pack();
        RefineryUtilities.centerFrameOnScreen(rpc);
        RefineryUtilities.positionFrameOnScreen(rpc, 0.6, 0.6);
        rpc.setVisible(true);
      } else {
        JOptionPane.showMessageDialog(
            GUI.MRMCobject.getFrame(),
            "Pilot study data has not yet been input.",
            "Error",
            JOptionPane.ERROR_MESSAGE);
      }
    }
Пример #4
0
    public void actionPerformed(ActionEvent e) {
      System.out.println("MRMC Variance analysis button clicked. RawStudyCard.varAnalysisListener");
      // Check that .imrmc input file has been read
      // If there is no JTextFilename, then reader scores have not been read
      String name = JTextFilename.getText();
      System.out.println("name=" + name);
      if (name.equals(null) || name.equals("")) {
        JFrame frame = GUI.MRMCobject.getFrame();
        JOptionPane.showMessageDialog(
            frame,
            "Please browse for .imrmc or.csv input file",
            " Error",
            JOptionPane.ERROR_MESSAGE);
        return;
      }

      // Check that a modality has been selected
      if (DBRecordStat.modalityA == GUInterface.NO_MOD
          && DBRecordStat.modalityB == GUInterface.NO_MOD) {
        JFrame frame = GUI.MRMCobject.getFrame();
        JOptionPane.showMessageDialog(
            frame, "You must select at least one modality", "Error", JOptionPane.ERROR_MESSAGE);
        return;
      }

      // Don't allow both modalities to be the same
      if (DBRecordStat.modalityA.compareTo(DBRecordStat.modalityB) == 0) {
        JFrame frame = GUI.MRMCobject.getFrame();
        JOptionPane.showMessageDialog(
            frame, "Modalities must be different", " Error", JOptionPane.ERROR_MESSAGE);
        return;
      }
      // Analyze observerData
      DBRecordStat.DBRecordStatFill(InputFile1, DBRecordStat);
      // Check if variance estimate is negative
      if (DBRecordStat.totalVar > 0) GUI.hasNegative = false;
      else GUI.hasNegative = true;

      if (GUI.hasNegative && FlagMLE == NO_MLE) {
        JFrame frame = GUI.MRMCobject.getFrame();
        int result =
            JOptionPane.showConfirmDialog(
                frame,
                "The total variance estimate is negative.\n"
                    + "Please report to the program developers. This is not expected.\n"
                    + "Do you want to proceed with MLE estimates to avoid negatives?");
        if (JOptionPane.CANCEL_OPTION == result) {
          System.out.println("cancel");
        } else if (JOptionPane.YES_OPTION == result) {
          FlagMLE = USE_MLE;
          DBRecordStat.flagMLE = FlagMLE;
          mleCheckBox.setSelected(true);
          DBRecordStat.totalVar = DBRecordStat.totalVarMLE;
          DBRecordStat.totalVarSingle = DBRecordStat.totalVarMLESingle;
          DBRecordStat.testStat = new StatTest(DBRecordStat);
        } else if (JOptionPane.NO_OPTION == result) {
          FlagMLE = NO_MLE;
        }
      }
      // Update GUI
      DBRecordStat.flagMLE = FlagMLE;
      DBRecordSize.flagMLE = FlagMLE;

      GUI.StatPanel1.setStatPanel();
      GUI.StatPanel1.setTable1();
      DBRecordSize.Nreader = DBRecordStat.Nreader;
      DBRecordSize.Nnormal = DBRecordStat.Nnormal;
      DBRecordSize.Ndisease = DBRecordStat.Ndisease;
      GUI.SizePanel1.NreaderJTextField.setText(Long.toString(DBRecordStat.Nreader));
      GUI.SizePanel1.NnormalJTextField.setText(Long.toString(DBRecordStat.Nnormal));
      GUI.SizePanel1.NdiseaseJTextField.setText(Long.toString(DBRecordStat.Ndisease));
    }
Пример #5
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);
   }
 }
Пример #6
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;
    }