Search in sources :

Example 6 with Parameter

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());
    }
}
Also used : FRAPStudy(cbit.vcell.microscopy.FRAPStudy) Parameter(cbit.vcell.opt.Parameter) FRAPModel(cbit.vcell.microscopy.FRAPModel)

Example 7 with Parameter

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);
        }
    }
}
Also used : FRAPStudy(cbit.vcell.microscopy.FRAPStudy) Parameter(cbit.vcell.opt.Parameter)

Example 8 with Parameter

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;
}
Also used : AsynchClientTask(cbit.vcell.client.task.AsynchClientTask) Hashtable(java.util.Hashtable) ArrayList(java.util.ArrayList) Parameter(cbit.vcell.opt.Parameter) FRAPModel(cbit.vcell.microscopy.FRAPModel)

Example 9 with Parameter

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.");
    }
}
Also used : FRAPStudy(cbit.vcell.microscopy.FRAPStudy) Parameter(cbit.vcell.opt.Parameter)

Example 10 with Parameter

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());
}
Also used : Parameter(cbit.vcell.opt.Parameter) FRAPModel(cbit.vcell.microscopy.FRAPModel)

Aggregations

Parameter (cbit.vcell.opt.Parameter)59 FRAPStudy (cbit.vcell.microscopy.FRAPStudy)11 Hashtable (java.util.Hashtable)10 AsynchClientTask (cbit.vcell.client.task.AsynchClientTask)9 ProfileDataElement (org.vcell.optimization.ProfileDataElement)8 Expression (cbit.vcell.parser.Expression)7 File (java.io.File)7 FRAPModel (cbit.vcell.microscopy.FRAPModel)6 ProfileData (org.vcell.optimization.ProfileData)6 OptimizationResultSet (cbit.vcell.opt.OptimizationResultSet)5 Element (org.jdom.Element)5 OptSolverResultSet (cbit.vcell.opt.OptSolverResultSet)4 OptimizationSpec (cbit.vcell.opt.OptimizationSpec)4 SimpleReferenceData (cbit.vcell.opt.SimpleReferenceData)4 ArrayList (java.util.ArrayList)4 ROI (cbit.vcell.VirtualMicroscopy.ROI)3 Dimension (java.awt.Dimension)3 Plot2D (cbit.plot.Plot2D)2 PlotData (cbit.plot.PlotData)2 BioModel (cbit.vcell.biomodel.BioModel)2