use of cbit.vcell.client.task.AsynchClientTask in project vcell by virtualcell.
the class FRAPDiffOneParamPanel method showParameterEvaluation.
public void showParameterEvaluation() {
AsynchClientTask evaluateTask = new AsynchClientTask("Prepare to evaluate parameters ...", AsynchClientTask.TASKTYPE_NONSWING_BLOCKING) {
public void run(Hashtable<String, Object> hashTable) throws Exception {
String errorStr = checkParameters();
if (!errorStr.equals("")) {
throw new IllegalArgumentException(errorStr);
}
}
};
AsynchClientTask showResultTask = new AsynchClientTask("Showing profile likelihood and confidence intervals ...", AsynchClientTask.TASKTYPE_SWING_BLOCKING) {
public void run(Hashtable<String, Object> hashTable) throws Exception {
ProfileData[] profileData = frapOptData.getExpFrapStudy().getProfileData_oneDiffComponent();
if (profileData != null && profileData.length > 0) {
// put plotpanes of different parameters' profile likelihoods into a base panel
JPanel basePanel = new JPanel();
basePanel.setLayout(new BoxLayout(basePanel, BoxLayout.Y_AXIS));
for (int i = 0; i < profileData.length; i++) {
ConfidenceIntervalPlotPanel plotPanel = new ConfidenceIntervalPlotPanel();
plotPanel.setProfileSummaryData(FRAPOptimizationUtils.getSummaryFromProfileData(profileData[i]));
plotPanel.setBorder(new EtchedBorder());
String paramName = "";
if (profileData[i].getProfileDataElements().size() > 0) {
paramName = profileData[i].getProfileDataElements().get(0).getParamName();
}
ProfileDataPanel profileDataPanel = new ProfileDataPanel(plotPanel, paramName);
basePanel.add(profileDataPanel);
}
JScrollPane scrollPane = new JScrollPane(basePanel);
scrollPane.setAutoscrolls(true);
scrollPane.setPreferredSize(new Dimension(620, 600));
scrollPane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
scrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED);
// show plots in a dialog
DialogUtils.showComponentCloseDialog(FRAPDiffOneParamPanel.this, scrollPane, "Profile Likelihood of Parameters");
}
}
};
// dispatch
ClientTaskDispatcher.dispatch(FRAPDiffOneParamPanel.this, new Hashtable<String, Object>(), new AsynchClientTask[] { evaluateTask, showResultTask }, false, true, null, true);
}
use of cbit.vcell.client.task.AsynchClientTask in project vcell by virtualcell.
the class FRAPDiffOneParamPanel method runAndSetBestParameters.
public void runAndSetBestParameters() {
AsynchClientTask optTask = new AsynchClientTask("Running optimization ...", AsynchClientTask.TASKTYPE_NONSWING_BLOCKING) {
public void run(Hashtable<String, Object> hashTable) throws Exception {
String errorStr = checkParameters();
if (errorStr.equals("")) {
frapOptData.setNumEstimatedParams(getCurrentParameters().length);
final Parameter[] bestParameters = frapOptData.getBestParamters(getCurrentParameters(), frapWorkspace.getWorkingFrapStudy().getSelectedROIsForErrorCalculation());
hashTable.put("bestParameters", bestParameters);
} else {
throw new IllegalArgumentException(errorStr);
}
}
};
AsynchClientTask showResultTask = new AsynchClientTask("Running optimization ...", AsynchClientTask.TASKTYPE_SWING_BLOCKING) {
public void run(Hashtable<String, Object> hashTable) throws Exception {
final Parameter[] bestParameters = (Parameter[]) hashTable.get("bestParameters");
if (bestParameters.length == FRAPModel.NUM_MODEL_PARAMETERS_ONE_DIFF) {
setParameterValues(new Double(bestParameters[FRAPModel.INDEX_PRIMARY_DIFF_RATE].getInitialGuess()), new Double(bestParameters[FRAPModel.INDEX_PRIMARY_FRACTION].getInitialGuess()), new Double(bestParameters[FRAPModel.INDEX_BLEACH_MONITOR_RATE].getInitialGuess()));
firePropertyChange(FRAPSingleWorkspace.PROPERTY_CHANGE_OPTIMIZER_VALUE, null, null);
}
}
};
// dispatch
ClientTaskDispatcher.dispatch(FRAPDiffOneParamPanel.this, new Hashtable<String, Object>(), new AsynchClientTask[] { optTask, showResultTask }, false, false, null, true);
}
use of cbit.vcell.client.task.AsynchClientTask in project vcell by virtualcell.
the class FRAPDiffTwoParamPanel method showParameterEvaluation.
public void showParameterEvaluation() {
AsynchClientTask evaluateTask = new AsynchClientTask("Prepare to evaluate parameters ...", AsynchClientTask.TASKTYPE_NONSWING_BLOCKING) {
public void run(Hashtable<String, Object> hashTable) throws Exception {
String errorStr = checkParameters();
if (!errorStr.equals("")) {
throw new IllegalArgumentException(errorStr);
}
}
};
AsynchClientTask showResultTask = new AsynchClientTask("Showing profile likelihood and confidence intervals ...", AsynchClientTask.TASKTYPE_SWING_BLOCKING) {
public void run(Hashtable<String, Object> hashTable) throws Exception {
ProfileData[] profileData = frapOptData.getExpFrapStudy().getProfileData_twoDiffComponents();
if (profileData != null && profileData.length > 0) {
JPanel basePanel = new JPanel();
// put plotpanes of different parameters' profile likelihoods into a base panel
basePanel.setLayout(new BoxLayout(basePanel, BoxLayout.Y_AXIS));
for (int i = 0; i < profileData.length; i++) {
ConfidenceIntervalPlotPanel plotPanel = new ConfidenceIntervalPlotPanel();
plotPanel.setProfileSummaryData(FRAPOptimizationUtils.getSummaryFromProfileData(profileData[i]));
plotPanel.setBorder(new EtchedBorder());
String paramName = "";
if (profileData[i].getProfileDataElements().size() > 0) {
paramName = profileData[i].getProfileDataElements().get(0).getParamName();
}
ProfileDataPanel profileDataPanel = new ProfileDataPanel(plotPanel, paramName);
basePanel.add(profileDataPanel);
}
JScrollPane scrollPane = new JScrollPane(basePanel);
scrollPane.setAutoscrolls(true);
scrollPane.setPreferredSize(new Dimension(620, 600));
scrollPane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
scrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED);
// show plots in a dialog
DialogUtils.showComponentCloseDialog(FRAPDiffTwoParamPanel.this, scrollPane, "Profile Likelihood of Parameters");
}
}
};
// dispatch
ClientTaskDispatcher.dispatch(FRAPDiffTwoParamPanel.this, new Hashtable<String, Object>(), new AsynchClientTask[] { evaluateTask, showResultTask }, false, true, null, true);
}
use of cbit.vcell.client.task.AsynchClientTask in project vcell by virtualcell.
the class FRAPDiffTwoParamPanel method runAndSetBestParameters.
public void runAndSetBestParameters() {
AsynchClientTask optTask = new AsynchClientTask("Running optimization ...", AsynchClientTask.TASKTYPE_NONSWING_BLOCKING) {
public void run(Hashtable<String, Object> hashTable) throws Exception {
String errorStr = checkParameters();
if (errorStr.equals("")) {
frapOptData.setNumEstimatedParams(getCurrentParameters().length);
final Parameter[] bestParameters = frapOptData.getBestParamters(getCurrentParameters(), frapWorkspace.getWorkingFrapStudy().getSelectedROIsForErrorCalculation());
hashTable.put("bestParameters", bestParameters);
} else {
throw new IllegalArgumentException(errorStr);
}
}
};
AsynchClientTask showResultTask = new AsynchClientTask("Running optimization ...", AsynchClientTask.TASKTYPE_SWING_BLOCKING) {
public void run(Hashtable<String, Object> hashTable) throws Exception {
final Parameter[] bestParameters = (Parameter[]) hashTable.get("bestParameters");
if (bestParameters.length == FRAPModel.NUM_MODEL_PARAMETERS_TWO_DIFF) {
setParameterValues(new Double(bestParameters[FRAPModel.INDEX_PRIMARY_DIFF_RATE].getInitialGuess()), new Double(bestParameters[FRAPModel.INDEX_PRIMARY_FRACTION].getInitialGuess()), new Double(bestParameters[FRAPModel.INDEX_BLEACH_MONITOR_RATE].getInitialGuess()), new Double(bestParameters[FRAPModel.INDEX_SECONDARY_DIFF_RATE].getInitialGuess()), new Double(bestParameters[FRAPModel.INDEX_SECONDARY_FRACTION].getInitialGuess()));
firePropertyChange(FRAPSingleWorkspace.PROPERTY_CHANGE_OPTIMIZER_VALUE, null, null);
}
}
};
// dispatch
ClientTaskDispatcher.dispatch(FRAPDiffTwoParamPanel.this, new Hashtable<String, Object>(), new AsynchClientTask[] { optTask, showResultTask }, false, false, null, true);
}
use of cbit.vcell.client.task.AsynchClientTask in project vcell by virtualcell.
the class FRAPReacOffRateParametersPanel method showParameterEvaluation.
public void showParameterEvaluation() {
AsynchClientTask evaluateTask = new AsynchClientTask("Prepare to evaluate parameters ...", AsynchClientTask.TASKTYPE_NONSWING_BLOCKING) {
public void run(Hashtable<String, Object> hashTable) throws Exception {
String errorStr = checkParameters();
if (!errorStr.equals("")) {
throw new IllegalArgumentException(errorStr);
}
}
};
AsynchClientTask showResultTask = new AsynchClientTask("Showing profile likelihood and confidence intervals ...", AsynchClientTask.TASKTYPE_SWING_BLOCKING) {
public void run(Hashtable<String, Object> hashTable) throws Exception {
ProfileData[] profileData = frapWorkspace.getWorkingFrapStudy().getProfileData_reactionOffRate();
if (profileData != null && profileData.length > 0) {
// put plotpanes of different parameters' profile likelihoods into a base panel
JPanel basePanel = new JPanel();
basePanel.setLayout(new BoxLayout(basePanel, BoxLayout.Y_AXIS));
for (int i = 0; i < profileData.length; i++) {
ConfidenceIntervalPlotPanel plotPanel = new ConfidenceIntervalPlotPanel();
plotPanel.setProfileSummaryData(FRAPOptimizationUtils.getSummaryFromProfileData(profileData[i]));
plotPanel.setBorder(new EtchedBorder());
String paramName = "";
if (profileData[i].getProfileDataElements().size() > 0) {
paramName = profileData[i].getProfileDataElements().get(0).getParamName();
}
ProfileDataPanel profileDataPanel = new ProfileDataPanel(plotPanel, paramName);
basePanel.add(profileDataPanel);
}
JScrollPane scrollPane = new JScrollPane(basePanel);
scrollPane.setAutoscrolls(true);
scrollPane.setPreferredSize(new Dimension(620, 600));
scrollPane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
scrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED);
// show plots in a dialog
DialogUtils.showComponentCloseDialog(FRAPReacOffRateParametersPanel.this, scrollPane, "Profile Likelihood of Parameters");
}
}
};
// dispatch
ClientTaskDispatcher.dispatch(FRAPReacOffRateParametersPanel.this, new Hashtable<String, Object>(), new AsynchClientTask[] { evaluateTask, showResultTask }, false, true, null, true);
}
Aggregations