use of cbit.vcell.opt.Parameter in project vcell by virtualcell.
the class EstParams_ReacBindingDescriptor method aboutToDisplayPanel.
public void aboutToDisplayPanel() {
FRAPStudy fStudy = getFrapWorkspace().getWorkingFrapStudy();
FRAPModel[] frapModels = fStudy.getModels();
Parameter[] params = null;
// get parameters to display in reaction binding panel
if (frapModels[FRAPModel.IDX_MODEL_DIFF_BINDING] != null && frapModels[FRAPModel.IDX_MODEL_DIFF_BINDING].getModelParameters() != null) {
params = frapModels[FRAPModel.IDX_MODEL_DIFF_BINDING].getModelParameters();
((EstParams_ReacBindingPanel) getPanelComponent()).setCurrentSimResults(frapModels[FRAPModel.IDX_MODEL_DIFF_BINDING].getData());
((EstParams_ReacBindingPanel) getPanelComponent()).setCurrentRawSimTimePoints(frapModels[FRAPModel.IDX_MODEL_DIFF_BINDING].getTimepoints());
} else {
((EstParams_ReacBindingPanel) getPanelComponent()).setCurrentSimResults(null);
((EstParams_ReacBindingPanel) getPanelComponent()).setCurrentRawSimTimePoints(null);
if (frapModels[FRAPModel.IDX_MODEL_DIFF_ONE_COMPONENT] != null && frapModels[FRAPModel.IDX_MODEL_DIFF_ONE_COMPONENT].getModelParameters() != null) {
params = FRAPModel.createReacBindingParametersFromDiffusionParameters(frapModels[FRAPModel.IDX_MODEL_DIFF_ONE_COMPONENT].getModelParameters());
} else // no parameters are available
{
try {
params = FRAPModel.getInitialParameters(fStudy.getFrapData(), FRAPModel.MODEL_TYPE_ARRAY[FRAPModel.IDX_MODEL_DIFF_BINDING], fStudy.getStartingIndexForRecovery());
} catch (Exception ex) {
ex.printStackTrace(System.out);
DialogUtils.showErrorDialog((getPanelComponent()), "Error getting parameters for diffusion plus binding model." + ex.getMessage());
}
}
}
((EstParams_ReacBindingPanel) getPanelComponent()).setReacBindingParams(params);
try {
((EstParams_ReacBindingPanel) getPanelComponent()).setData(fStudy.getFrapData(), params, fStudy.getFrapData().getImageDataset().getImageTimeStamps(), fStudy.getStartingIndexForRecovery(), fStudy.getSelectedROIsForErrorCalculation());
} catch (Exception ex) {
ex.printStackTrace(System.out);
DialogUtils.showErrorDialog((getPanelComponent()), "Error plotting data for diffusion plus binding model." + ex.getMessage());
}
}
use of cbit.vcell.opt.Parameter in project vcell by virtualcell.
the class EstParams_ReacBindingPanel method activateReacDiffEstPanel.
public void activateReacDiffEstPanel() {
FRAPStudy fStudy = getFrapWorkspace().getWorkingFrapStudy();
// check if we can do auto estimation on reaction binding papameters
Parameter[] params = null;
if (fStudy.getModels()[FRAPModel.IDX_MODEL_DIFF_ONE_COMPONENT] != null && fStudy.getModels()[FRAPModel.IDX_MODEL_DIFF_ONE_COMPONENT].getModelParameters() != null) {
params = fStudy.getModels()[FRAPModel.IDX_MODEL_DIFF_ONE_COMPONENT].getModelParameters();
} else {
DialogUtils.showErrorDialog(EstParams_ReacBindingPanel.this, "Parameters from 'Diffusion with One Diffusing Component' model " + "is needed for automated estimation of reaction binding parameters.\n" + "Please include the above-mentioned model using 'Choose Model Types' wizard.");
return;
}
if (estGuidePanel == null) {
estGuidePanel = new FRAPReacDiffEstimationGuidePanel();
}
// set initial parameters from diffusion with one diffusing component
estGuidePanel.setPrimaryParameters(params);
int choice2 = DialogUtils.showComponentOKCancelDialog(EstParams_ReacBindingPanel.this, estGuidePanel, "FRAP Parameter Estimation Guide");
if (choice2 == JOptionPane.OK_OPTION) {
if (estGuidePanel.getParamTable() != null) {
int rowLen = estGuidePanel.getParamTable().getRowCount();
for (int i = 0; i < rowLen; i++) {
String name = ((String) estGuidePanel.getParamTable().getValueAt(i, EstimatedParameterTableModel.COLUMN_NAME));
double val = ((Double) estGuidePanel.getParamTable().getValueAt(i, EstimatedParameterTableModel.COLUMN_VALUE)).doubleValue();
if (name.equals(FRAPReacDiffEstimationGuidePanel.paramNames[FRAPReacDiffEstimationGuidePanel.IDX_FreePartDiffRate])) {
reactionDiffusionPanel.setFreeDiffRate(val + "");
} else if (name.equals(FRAPReacDiffEstimationGuidePanel.paramNames[FRAPReacDiffEstimationGuidePanel.IDX_FreePartConc])) {
reactionDiffusionPanel.setFreeFraction(val + "");
} else if (name.equals(FRAPReacDiffEstimationGuidePanel.paramNames[FRAPReacDiffEstimationGuidePanel.IDX_BWMRate])) {
reactionDiffusionPanel.setBleachMonitorRate(val + "");
} else if (name.equals(FRAPReacDiffEstimationGuidePanel.paramNames[FRAPReacDiffEstimationGuidePanel.IDX_ComplexConc])) {
reactionDiffusionPanel.setComplexFraction(val + "");
} else if (name.equals(FRAPReacDiffEstimationGuidePanel.paramNames[FRAPReacDiffEstimationGuidePanel.IDX_ReacPseudoOnRate])) {
reactionDiffusionPanel.setOnRate(val + "");
} else if (name.equals(FRAPReacDiffEstimationGuidePanel.paramNames[FRAPReacDiffEstimationGuidePanel.IDX_ReacOffRate])) {
reactionDiffusionPanel.setOffRate(val + "");
} else if (name.equals(FRAPReacDiffEstimationGuidePanel.paramNames[FRAPReacDiffEstimationGuidePanel.IDX_Immobile])) {
reactionDiffusionPanel.setImmobileFraction(val + "");
}
}
// multisourcePlotPane.setDataSources(null);
}
}
}
use of cbit.vcell.opt.Parameter in project vcell by virtualcell.
the class EstParams_ReactionOffRateDescriptor method preNextProcess.
// save model parameters
public ArrayList<AsynchClientTask> preNextProcess() {
// create AsynchClientTask arraylist
ArrayList<AsynchClientTask> taskArrayList = new ArrayList<AsynchClientTask>();
AsynchClientTask saveParametersTask = new AsynchClientTask("", AsynchClientTask.TASKTYPE_NONSWING_BLOCKING) {
public void run(Hashtable<String, Object> hashTable) throws Exception {
Parameter[] params = ((EstParams_ReactionOffRatePanel) getPanelComponent()).getCurrentParameters();
FRAPModel frapModel = getFrapWorkspace().getWorkingFrapStudy().getFrapModel(FRAPModel.IDX_MODEL_REACTION_OFF_RATE);
frapModel.setModelParameters(params);
frapModel.setData(((EstParams_ReactionOffRatePanel) getPanelComponent()).getCurrentEstimationResults());
}
};
taskArrayList.add(saveParametersTask);
return taskArrayList;
}
use of cbit.vcell.opt.Parameter in project vcell by virtualcell.
the class EstParams_ReactionOffRateDescriptor method aboutToDisplayPanel.
public void aboutToDisplayPanel() {
FRAPStudy fStudy = frapWorkspace.getWorkingFrapStudy();
Parameter[] params = fStudy.getModels()[FRAPModel.IDX_MODEL_REACTION_OFF_RATE].getModelParameters();
try {
if (params == null) {
params = fStudy.getFrapOptFunc().getBestParamters(fStudy.getFrapData(), null, true);
}
((EstParams_ReactionOffRatePanel) getPanelComponent()).setData(params, fStudy.getFrapData(), /*fStudy.getFrapOptFunc().getOffRateResults(),*/
fStudy.getStartingIndexForRecovery());
} catch (Exception ex) {
ex.printStackTrace(System.out);
DialogUtils.showErrorDialog((getPanelComponent()), "Error getting parameters for reaction dominant off rate model.");
}
}
use of cbit.vcell.opt.Parameter in project vcell by virtualcell.
the class EstParams_TwoDiffComponentDescriptor method saveModelParameters.
private void saveModelParameters() {
Parameter[] params = ((EstParams_TwoDiffComponentPanel) getPanelComponent()).getCurrentParameters();
FRAPModel frapModel = getFrapWorkspace().getWorkingFrapStudy().getFrapModel(FRAPModel.IDX_MODEL_DIFF_TWO_COMPONENTS);
frapModel.setModelParameters(params);
frapModel.setData(((EstParams_TwoDiffComponentPanel) getPanelComponent()).getCurrentEstimationResults());
}
Aggregations