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)); }
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; }