Example #1
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));
    }