Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Numerical button: calculate signal-reader AUC and STD.
Hide variance component table by a button
Solve NaN number display problem
  • Loading branch information
qigongFDA committed Feb 3, 2017
1 parent 2d8a245 commit 5df4570
Show file tree
Hide file tree
Showing 26 changed files with 81 additions and 167 deletions.
1 change: 0 additions & 1 deletion .classpath
Expand Up @@ -2,7 +2,6 @@
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="lib" path="lib/jcommon-1.0.18.jar"/>
<classpathentry kind="lib" path="lib/commons-math3-3.2.jar"/>
<classpathentry kind="lib" path="lib/uncommons-maths-1.2.3.jar"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"/>
<classpathentry kind="lib" path="lib/jfreechart-1.0.14.jar"/>
Expand Down
Binary file modified bin/mrmc/chart/exportToFile.class
Binary file not shown.
Binary file modified bin/mrmc/core/DBRecord.class
Binary file not shown.
Binary file modified bin/mrmc/core/MRMC.class
Binary file not shown.
Binary file modified bin/mrmc/gui/StatPanel$DecimalFormatRenderer.class
Binary file not shown.
Binary file modified bin/mrmc/gui/StatPanel$StatHillisButtonListener.class
Binary file not shown.
Binary file added bin/mrmc/gui/StatPanel$showVarComponent.class
Binary file not shown.
Binary file modified bin/mrmc/gui/StatPanel.class
Binary file not shown.
Binary file modified bin/roemetz/core/CalcGenRoeMetz.class
Binary file not shown.
Binary file modified bin/roemetz/gui/RMGUInterface$CalculateCofV.class
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file modified bin/roemetz/gui/RMGUInterface$DoSimBtnListener.class
Binary file not shown.
Binary file modified bin/roemetz/gui/RMGUInterface$SeedInputListener.class
Binary file not shown.
Binary file modified bin/roemetz/gui/RMGUInterface$SimExperiments_thread.class
Binary file not shown.
Binary file modified bin/roemetz/gui/RMGUInterface$analysisExportListener.class
Binary file not shown.
Binary file modified bin/roemetz/gui/RMGUInterface.class
Binary file not shown.
Binary file removed lib/commons-math3-3.2.jar
Binary file not shown.
161 changes: 16 additions & 145 deletions src/mrmc/chart/exportToFile.java
Expand Up @@ -539,48 +539,6 @@ public static String exportSummary(String oldReport, DBRecord SummaryDBRecord) {
for(String desc_temp : SummaryDBRecord.InputFile1.readerIDs.keySet() ) {
IDlength = Math.max(IDlength,desc_temp.length());
}
/* old function
if (IDlength>9){
for (int i=0; i<IDlength-9; i++){
str = str + " ";
}
str = str + "Reader ID";
str = str+SEPA + " AUC_A" + SEPA + " AUCs_B" + SEPA + " AUC_A - AUCs_B";
} else{
str = str + "Reader ID" +SEPA + " AUC_A" + SEPA + " AUCs_B" + SEPA + " AUC_A - AUCs_B";
}
k=1;
for(String desc_temp : SummaryDBRecord.InputFile1.readerIDs.keySet() ) {
str = str + "\r\n";
for (int i=0; i<Math.max(IDlength,9) - desc_temp.length(); i++){
str = str + " ";
}
str = str + desc_temp;
if (SummaryDBRecord.selectedMod==0){
str = str+ SEPA + " " +
fiveDecE.format(SummaryDBRecord.AUCs[k-1][0]) + SEPA + " " +
" 0" + SEPA + " 0";
}else if (SummaryDBRecord.selectedMod==1){
str = str+ SEPA + " " +
" 0" + SEPA + " " +
fiveDecE.format(SummaryDBRecord.AUCs[k-1][1]) + SEPA +
" 0";
}else{
str = str+ SEPA + " " +
fiveDecE.format(SummaryDBRecord.AUCs[k-1][0]) + SEPA + " " +
fiveDecE.format(SummaryDBRecord.AUCs[k-1][1]) + SEPA;
double AUC_dif = SummaryDBRecord.AUCs[k-1][0]-SummaryDBRecord.AUCs[k-1][1];
if(AUC_dif<0)
str = str + " " + fiveDecE.format(AUC_dif);
else if (AUC_dif>0)
str = str + " " + fiveDecE.format(AUC_dif);
else
str = str + " " + fiveDecE.format(AUC_dif);
}
k=k+1;
}*/
if (SummaryDBRecord.selectedMod == 0 ||SummaryDBRecord.selectedMod == 3){
str = str + "MOD A" +"\r\n";
if (IDlength>9){
Expand Down Expand Up @@ -611,8 +569,11 @@ else if (AUC_dif>0)
}
str = str + Rdisease;
str = str+ SEPA + " " +
fiveDecE.format(SummaryDBRecord.AUCs[k][0]) + SEPA + " " +
fiveDecE.format(SummaryDBRecord.readerVarA[k]);
((Double.isNaN(SummaryDBRecord.AUCs[k][0])||SummaryDBRecord.AUCs[k][0]<0) ? " NaN" : fiveDecE.format(SummaryDBRecord.AUCs[k][0])) + SEPA + " " +
(Double.isNaN(SummaryDBRecord.readerVarA[k]) ? " NaN" : fiveDecE.format(Math.sqrt(SummaryDBRecord.readerVarA[k])));
//str = str+ SEPA + " " +
// fiveDecE.format(SummaryDBRecord.AUCs[k][0]) + SEPA + " " +
// fiveDecE.format(SummaryDBRecord.readerVarA[k]);
k=k+1;
}
str = str + "\r\n";
Expand Down Expand Up @@ -648,8 +609,8 @@ else if (AUC_dif>0)
}
str = str + Rdisease;
str = str+ SEPA + " " +
fiveDecE.format(SummaryDBRecord.AUCs[k][1]) + SEPA + " " +
fiveDecE.format(SummaryDBRecord.readerVarB[k]);
((Double.isNaN(SummaryDBRecord.AUCs[k][1])||SummaryDBRecord.AUCs[k][1]<0) ? " NaN" : fiveDecE.format(SummaryDBRecord.AUCs[k][1])) + SEPA + " " + //fiveDecE.format(SummaryDBRecord.AUCs[k][1]) + SEPA + " " +
(Double.isNaN(SummaryDBRecord.readerVarB[k]) ? " NaN" : fiveDecE.format(Math.sqrt(SummaryDBRecord.readerVarB[k])));//fiveDecE.format(SummaryDBRecord.readerVarB[k]);
k=k+1;
}
str = str + "\r\n";
Expand Down Expand Up @@ -685,16 +646,18 @@ else if (AUC_dif>0)
}
str = str + Rdisease;
double AUC_dif = SummaryDBRecord.AUCs[k][0]-SummaryDBRecord.AUCs[k][1];
if(SummaryDBRecord.AUCs[k][1]<0||SummaryDBRecord.AUCs[k][0]<0)
AUC_dif = Double.NaN;
str = str + SEPA;
if(AUC_dif<0)
str = str + " " + fiveDecE.format(AUC_dif) + SEPA + " " +
fiveDecE.format(SummaryDBRecord.readerTotalVar[k]);
str = str + " " + (Double.isNaN(AUC_dif) ? " NaN" : fiveDecE.format(AUC_dif)) + SEPA + " " + //fiveDecE.format(AUC_dif) + SEPA + " " +
(Double.isNaN(SummaryDBRecord.readerTotalVar[k]) ? " NaN" : fiveDecE.format(Math.sqrt(SummaryDBRecord.readerTotalVar[k])));//fiveDecE.format(SummaryDBRecord.readerTotalVar[k]);
else if (AUC_dif>0)
str = str + " " + fiveDecE.format(AUC_dif) + SEPA + " " +
fiveDecE.format(SummaryDBRecord.readerTotalVar[k]);
str = str + " " + (Double.isNaN(AUC_dif) ? " NaN" : fiveDecE.format(AUC_dif)) + SEPA + " " + // + fiveDecE.format(AUC_dif) + SEPA + " " +
(Double.isNaN(SummaryDBRecord.readerTotalVar[k]) ? " NaN" : fiveDecE.format(Math.sqrt(SummaryDBRecord.readerTotalVar[k])));//fiveDecE.format(SummaryDBRecord.readerTotalVar[k]);
else
str = str + " " + fiveDecE.format(AUC_dif) + SEPA + " " +
fiveDecE.format(SummaryDBRecord.readerTotalVar[k]);
str = str + " " + (Double.isNaN(AUC_dif) ? " NaN" : fiveDecE.format(AUC_dif)) + SEPA + " " + // + fiveDecE.format(AUC_dif) + SEPA + " " +
(Double.isNaN(SummaryDBRecord.readerTotalVar[k]) ? " NaN" : fiveDecE.format(Math.sqrt(SummaryDBRecord.readerTotalVar[k])));//fiveDecE.format(SummaryDBRecord.readerTotalVar[k]);
k=k+1;
}
str = str + "\r\n";
Expand Down Expand Up @@ -842,99 +805,7 @@ public static String pdfResult2(DBRecord SummaryDBRecord) {

return str;
}
/*// ACUs table in pdf result
public static PdfPTable[] pdfTable(PdfPTable AUCtable, DBRecord SummaryDBRecord) {
PdfPCell titlecell = new PdfPCell (new Paragraph("Table 1 "));
titlecell.setColspan(7);
titlecell.setHorizontalAlignment(Element.ALIGN_CENTER);
AUCtable.addCell(titlecell);
AUCtable.addCell("Reader ID");
int count = 1;
if (SummaryDBRecord.selectedMod == 0){
AUCtable.addCell("AUC ModalityA");
AUCtable.addCell("AUC_STD ModalityA");
AUCtable.addCell("None");
AUCtable.addCell("None");
AUCtable.addCell("AUC difference");
AUCtable.addCell("AUC difference STD");
for(String desc_temp : SummaryDBRecord.InputFile1.readerIDs.keySet()){
AUCtable.addCell(desc_temp);
AUCtable.addCell(twoDec.format(SummaryDBRecord.AUCs[count-1][0]));
AUCtable.addCell(twoDecE.format(Math.sqrt(SummaryDBRecord.readerVarA[count-1])));
AUCtable.addCell("N/A");
AUCtable.addCell("N/A");
AUCtable.addCell("N/A");
AUCtable.addCell("N/A");
count =count + 1;
}
for (int i = 0; i<7;i++){
AUCtable.addCell(" ");
}
AUCtable.addCell("Average");
AUCtable.addCell(twoDec.format(SummaryDBRecord.AUCsReaderAvg[0]));
AUCtable.addCell(twoDecE.format(Math.sqrt(SummaryDBRecord.varA)));
AUCtable.addCell("N/A");
AUCtable.addCell("N/A");
AUCtable.addCell("N/A");
AUCtable.addCell("N/A");
}else if (SummaryDBRecord.selectedMod == 1){
AUCtable.addCell("None");
AUCtable.addCell("None");
AUCtable.addCell("AUC ModalityB");
AUCtable.addCell("AUC_STD ModalityB");
AUCtable.addCell("AUC difference");
AUCtable.addCell("AUC difference STD");
for(String desc_temp : SummaryDBRecord.InputFile1.readerIDs.keySet()){
AUCtable.addCell(desc_temp);
AUCtable.addCell("N/A");
AUCtable.addCell("N/A");
AUCtable.addCell(twoDec.format(SummaryDBRecord.AUCs[count-1][1]));
AUCtable.addCell(twoDecE.format(Math.sqrt(SummaryDBRecord.readerVarB[count-1])));
AUCtable.addCell("N/A");
AUCtable.addCell("N/A");
count =count + 1;
}
for (int i = 0; i<7;i++){
AUCtable.addCell(" ");
}
AUCtable.addCell("Average");
AUCtable.addCell("N/A");
AUCtable.addCell("N/A");
AUCtable.addCell(twoDec.format(SummaryDBRecord.AUCsReaderAvg[1]));
AUCtable.addCell(twoDecE.format(Math.sqrt(SummaryDBRecord.varB)));
AUCtable.addCell("N/A");
AUCtable.addCell("N/A");
}else{
AUCtable.addCell("AUC ModalityA");
AUCtable.addCell("AUC_STD ModalityA");
AUCtable.addCell("AUC ModalityB");
AUCtable.addCell("AUC_STD ModalityB");
AUCtable.addCell("AUC difference");
AUCtable.addCell("AUC difference STD");
for(String desc_temp : SummaryDBRecord.InputFile1.readerIDs.keySet()){
AUCtable.addCell(desc_temp);
AUCtable.addCell(twoDec.format(SummaryDBRecord.AUCs[count-1][0]));
AUCtable.addCell(twoDecE.format(Math.sqrt(SummaryDBRecord.readerVarA[count-1])));
AUCtable.addCell(twoDec.format(SummaryDBRecord.AUCs[count-1][1]));
AUCtable.addCell(twoDecE.format(Math.sqrt(SummaryDBRecord.readerVarB[count-1])));
AUCtable.addCell(twoDec.format(SummaryDBRecord.AUCs[count-1][0]-SummaryDBRecord.AUCs[count-1][1]));
AUCtable.addCell(twoDecE.format(Math.sqrt(SummaryDBRecord.readerTotalVar[count-1])));
count =count + 1;
}
for (int i = 0; i<7;i++){
AUCtable.addCell(" ");
}
AUCtable.addCell("Average");
AUCtable.addCell(twoDec.format(SummaryDBRecord.AUCsReaderAvg[0]));
AUCtable.addCell(twoDecE.format(Math.sqrt(SummaryDBRecord.varA)));
AUCtable.addCell(twoDec.format(SummaryDBRecord.AUCsReaderAvg[1]));
AUCtable.addCell(twoDecE.format(Math.sqrt(SummaryDBRecord.varB)));
AUCtable.addCell(twoDec.format(SummaryDBRecord.AUCsReaderAvg[0]-SummaryDBRecord.AUCsReaderAvg[1]));
AUCtable.addCell(twoDecE.format(Math.sqrt(SummaryDBRecord.totalVar)));
}
return AUCtable;
}*/

public static PdfPTable[] pdfTable(PdfPTable[] AUCtable, DBRecord SummaryDBRecord) {
if (SummaryDBRecord.selectedMod == 0||SummaryDBRecord.selectedMod == 3){
PdfPCell titlecell = new PdfPCell (new Paragraph("Modality A"));
Expand Down
25 changes: 14 additions & 11 deletions src/mrmc/core/DBRecord.java
Expand Up @@ -863,7 +863,7 @@ public double[] DBRecordSizeValidation(DBRecord DBRecordTrial,int Nreader,int N
*
*
*
* @param SizePanelTemp
* @param SizePanelTemp for iRoeMetz Numerical Button
*/
public void DBRecordRoeMetzNumericalFill(SizePanel SizePanelRoeMetz) {

Expand All @@ -880,7 +880,6 @@ public void DBRecordRoeMetzNumericalFill(SizePanel SizePanelRoeMetz) {
BDGcoeff[1][i] = covMRMCsize.coefficientsBB[i+1];
BDGcoeff[2][i] = covMRMCsize.coefficientsAB[i+1];
BDGcoeff[3][i] = 1.0;

BDG[3][i] =
+ BDGcoeff[0][i]*BDG[0][i]
+ BDGcoeff[1][i]*BDG[1][i]
Expand Down Expand Up @@ -917,8 +916,7 @@ public void DBRecordRoeMetzNumericalFill(SizePanel SizePanelRoeMetz) {
readerBDG[0][i] = BDG[0][i];
readerBDG[1][i] = BDG[1][i];
readerBDG[2][i] = BDG[2][i];
readerBDG[3][i] = BDG[3][i];


readerBDGcoeff[0][i] = covMRMCsize.readerCoefficientsAA[ir][i + 1];
readerBDGcoeff[1][i] = covMRMCsize.readerCoefficientsBB[ir][i + 1];
readerBDGcoeff[2][i] = covMRMCsize.readerCoefficientsAB[ir][i + 1];
Expand Down Expand Up @@ -1042,12 +1040,18 @@ private void BDGforStatPanel() {
readerTotalVarMLE[ir] += readerBDGcoeff[3][i] * readerBDGbias[3][i];

}
readerVarAnoMLE[ir] = new BigDecimal(readerVarAnoMLE[ir]).setScale(8, RoundingMode.HALF_UP).doubleValue();
readerVarBnoMLE[ir] = new BigDecimal(readerVarBnoMLE[ir]).setScale(8, RoundingMode.HALF_UP).doubleValue();
readerVarAMLE[ir] = new BigDecimal(readerVarAMLE[ir]).setScale(8, RoundingMode.HALF_UP).doubleValue();
readerVarBMLE[ir] = new BigDecimal(readerVarBMLE[ir]).setScale(8, RoundingMode.HALF_UP).doubleValue();
readerTotalVarnoMLE[ir] = new BigDecimal(readerTotalVarnoMLE[ir]).setScale(8, RoundingMode.HALF_UP).doubleValue();
readerTotalVarMLE[ir] = new BigDecimal(readerTotalVarMLE[ir]).setScale(8, RoundingMode.HALF_UP).doubleValue();
if (!Double.isNaN(readerVarAnoMLE[ir]))
readerVarAnoMLE[ir] = new BigDecimal(readerVarAnoMLE[ir]).setScale(8, RoundingMode.HALF_UP).doubleValue();
if (!Double.isNaN(readerVarBnoMLE[ir]))
readerVarBnoMLE[ir] = new BigDecimal(readerVarBnoMLE[ir]).setScale(8, RoundingMode.HALF_UP).doubleValue();
if (!Double.isNaN(readerVarAMLE[ir]))
readerVarAMLE[ir] = new BigDecimal(readerVarAMLE[ir]).setScale(8, RoundingMode.HALF_UP).doubleValue();
if (!Double.isNaN(readerVarBMLE[ir]))
readerVarBMLE[ir] = new BigDecimal(readerVarBMLE[ir]).setScale(8, RoundingMode.HALF_UP).doubleValue();
if (!Double.isNaN(readerTotalVarnoMLE[ir]))
readerTotalVarnoMLE[ir] = new BigDecimal(readerTotalVarnoMLE[ir]).setScale(8, RoundingMode.HALF_UP).doubleValue();
if (!Double.isNaN(readerTotalVarMLE[ir]))
readerTotalVarMLE[ir] = new BigDecimal(readerTotalVarMLE[ir]).setScale(8, RoundingMode.HALF_UP).doubleValue();
}
if (flagMLE==0){
totalVar= totalVarnoMLE;
Expand All @@ -1065,7 +1069,6 @@ private void BDGforStatPanel() {
readerVarB = readerVarBMLE;
}
SE = Math.sqrt(totalVar);

if(totalVar < 0) {
flagTotalVarIsNegative = 1;
}
Expand Down
2 changes: 1 addition & 1 deletion src/mrmc/core/MRMC.java
Expand Up @@ -102,7 +102,7 @@ public static void main(String[] args) {
outputFolderFullName = args[1];
commandStart = true;
}
int width = 900, height = 800;
int width = 900, height = 620;
run(new MRMC(), width, height);
cmonnandStartFunction cmonnandStartFunction1 = new cmonnandStartFunction();
cmonnandStartFunction1.cmonnandStartFunction(gui, inputFileFullName,outputFolderFullName);
Expand Down
32 changes: 29 additions & 3 deletions src/mrmc/gui/StatPanel.java
Expand Up @@ -3,6 +3,7 @@
*/
package mrmc.gui;

import java.awt.BorderLayout;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.event.ActionEvent;
Expand All @@ -23,10 +24,15 @@
import javax.swing.table.DefaultTableCellRenderer;
import javax.swing.table.DefaultTableModel;

import org.jfree.ui.RefineryUtilities;

import roemetz.core.RoeMetz;
import mrmc.chart.WrapLayout;
import mrmc.core.DBRecord;
import mrmc.core.InputFile;
import mrmc.core.Matrix;
import mrmc.gui.InputFileCard.exportreaderresult;
import mrmc.gui.InputFileCard.showAUCsButtonListener;


/**
Expand Down Expand Up @@ -167,7 +173,9 @@ public StatPanel(JFrame JFrameAppTemp, DBRecord DBRecordStatTemp) {
"comp MB", "coeff MB", "comp product", "- coeff product",
"total" };
String[] rowNamesSingle = new String[] { "components", "coeff", "total" };

JButton showCompButton = new JButton("Show Variance Component");
showCompButton.addActionListener(new showVarComponent());

// Create BDG tab
JPanel panelBDG1 = makeBDGTab(rowNamesDiff);
// Create BCK tab
Expand All @@ -185,15 +193,33 @@ public StatPanel(JFrame JFrameAppTemp, DBRecord DBRecordStatTemp) {
tabbedPane1.addTab("DBM", panelDBM1);
tabbedPane1.addTab("OR", panelOR1);
tabbedPane1.addTab("MS", panelMS1);

StatPanelRow5.add(showCompButton);

JPanelStat.add(StatPanelRow1);
JPanelStat.add(StatPanelRow2);
JPanelStat.add(StatPanelRow3);
JPanelStat.add(StatPanelRow4);
JPanelStat.add(StatPanelRow5);
JPanelStat.add(tabbedPane1);
// JPanelStat.add(tabbedPane1);

}

/**
* Creates a table showing individual reader AUCs
*
*/
class showVarComponent implements ActionListener {
public void actionPerformed(ActionEvent e) {
JFrame JFrameAUC= new JFrame("Variance Component");
RefineryUtilities.centerFrameOnScreen(JFrameAUC);
JFrameAUC.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
JFrameAUC.add(tabbedPane1, BorderLayout.CENTER);
JFrameAUC.setSize(900, 250);
JFrameAUC.setVisible(true);
}
}



/**
* Clears all input fields and statistics labels
Expand Down
18 changes: 17 additions & 1 deletion src/roemetz/core/CalcGenRoeMetz.java
Expand Up @@ -490,7 +490,23 @@ public static void genRoeMetz(double[] u, double[] var_t, SizePanel SizePanelRoe

// Set the coefficients
DBRecordNumerical.DBRecordRoeMetzNumericalFill(SizePanelRoeMetz);

if (SizePanelRoeMetz.pairedReadersFlag == 0) {
for(int i= 0; i<(DBRecordNumerical.Nreader/2);i++){
DBRecordNumerical.N0perReader[i][1] = 0;
DBRecordNumerical.N1perReader[i][1] = 0;
DBRecordNumerical.N0perReader[i][2] = 0;
DBRecordNumerical.N1perReader[i][2] = 0;
DBRecordNumerical.AUCs[i][1] = Double.NaN;
}
for(int i= (int) (DBRecordNumerical.Nreader/2); i<DBRecordNumerical.Nreader;i++){
DBRecordNumerical.N0perReader[i][0] = 0;
DBRecordNumerical.N1perReader[i][0] = 0;
DBRecordNumerical.N0perReader[i][2] = 0;
DBRecordNumerical.N1perReader[i][2] = 0;
DBRecordNumerical.AUCs[i][0] = Double.NaN;
}

}
}

}
2 changes: 1 addition & 1 deletion src/roemetz/core/SimRoeMetz.java
Expand Up @@ -367,7 +367,7 @@ public void doSim(DBRecord tempDBRecord) throws IOException {
observerData[irow][0] = "reader"+String.format("%03d", readerID);
// observerData[irow][1] = "disease"+Integer.toString(diseaseID);
observerData[irow][1] = "disease"+String.format("%06d", diseaseID);
observerData[irow][2] = DBRecordStat.modalityB;
observerData[irow][2] = DBRecordStat.modalityB;
observerData[irow][3] = Double.toString(tB1[readerID][diseaseID]);
irow++;
}
Expand Down

0 comments on commit 5df4570

Please sign in to comment.