Search in sources :

Example 1 with BatchRunXmlReader

use of cbit.vcell.microscopy.batchrun.BatchRunXmlReader in project vcell by virtualcell.

the class EstParams_OneDiffComponentPanel method loadBatchRunParameters.

public void loadBatchRunParameters(File inFile) {
    String xmlString;
    try {
        xmlString = XmlUtil.getXMLString(inFile.getAbsolutePath());
        BatchRunXmlReader batchRunXmlReader = new BatchRunXmlReader();
        FRAPBatchRunWorkspace tempBatchRunWorkspace = batchRunXmlReader.getBatchRunWorkspace(XmlUtil.stringToXML(xmlString, null).getRootElement());
        Parameter[] parameters = tempBatchRunWorkspace.getAverageParameters();
        if (parameters != null && parameters.length > 0 && parameters.length == FRAPModel.NUM_MODEL_PARAMETERS_ONE_DIFF) {
            String paramMsg = "Replace the current parameters with the following parameter values: \n\n";
            for (int i = 0; i < parameters.length; i++) {
                paramMsg = paramMsg + parameters[i].getName() + ": " + parameters[i].getInitialGuess() + "\n";
            }
            String choice = DialogUtils.showWarningDialog(this, paramMsg, new String[] { UserMessage.OPTION_OK, UserMessage.OPTION_CANCEL }, UserMessage.OPTION_OK);
            if (choice == UserMessage.OPTION_OK) {
                getPureDiffusionPanel().setParameterValues(parameters[FRAPModel.INDEX_PRIMARY_DIFF_RATE].getInitialGuess(), parameters[FRAPModel.INDEX_PRIMARY_FRACTION].getInitialGuess(), parameters[FRAPModel.INDEX_BLEACH_MONITOR_RATE].getInitialGuess());
            }
        } else {
            throw new Exception("Parameters are null or number of applied parameters don't match the number (3) of parameters for diffusion with one diffusing component.");
        }
    } catch (Exception e) {
        e.printStackTrace(System.out);
        DialogUtils.showErrorDialog(this, e.getMessage());
    }
}
Also used : BatchRunXmlReader(cbit.vcell.microscopy.batchrun.BatchRunXmlReader) Parameter(cbit.vcell.opt.Parameter) FRAPBatchRunWorkspace(cbit.vcell.microscopy.batchrun.FRAPBatchRunWorkspace)

Example 2 with BatchRunXmlReader

use of cbit.vcell.microscopy.batchrun.BatchRunXmlReader in project vcell by virtualcell.

the class EstParams_TwoDiffComponentPanel method loadBatchRunParameters.

public void loadBatchRunParameters(File inFile) {
    String xmlString;
    try {
        xmlString = XmlUtil.getXMLString(inFile.getAbsolutePath());
        BatchRunXmlReader batchRunXmlReader = new BatchRunXmlReader();
        FRAPBatchRunWorkspace tempBatchRunWorkspace = batchRunXmlReader.getBatchRunWorkspace(XmlUtil.stringToXML(xmlString, null).getRootElement());
        Parameter[] parameters = tempBatchRunWorkspace.getAverageParameters();
        if (parameters != null && parameters.length > 0 && parameters.length == FRAPModel.NUM_MODEL_PARAMETERS_TWO_DIFF) {
            String paramMsg = "Replace the current parameters with the following parameter values, \n";
            for (int i = 0; i < parameters.length; i++) {
                paramMsg = paramMsg + parameters[i].getName() + ": " + parameters[i].getInitialGuess() + "\n";
            }
            String choice = DialogUtils.showWarningDialog(this, paramMsg, new String[] { UserMessage.OPTION_OK, UserMessage.OPTION_CANCEL }, UserMessage.OPTION_OK);
            if (choice == UserMessage.OPTION_OK) {
                frapWorkspace.getWorkingFrapStudy();
                getPureDiffusionPanel().setParameterValues(parameters[FRAPModel.INDEX_PRIMARY_DIFF_RATE].getInitialGuess(), parameters[FRAPModel.INDEX_PRIMARY_FRACTION].getInitialGuess(), parameters[FRAPModel.INDEX_BLEACH_MONITOR_RATE].getInitialGuess(), parameters[FRAPModel.INDEX_SECONDARY_DIFF_RATE].getInitialGuess(), parameters[FRAPModel.INDEX_SECONDARY_FRACTION].getInitialGuess());
            }
        } else {
            throw new Exception("Parameters are null or number of applied parameters don't match the number (5) of parameters for diffusion with two diffusing components.");
        }
    } catch (Exception e) {
        e.printStackTrace(System.out);
        DialogUtils.showErrorDialog(this, e.getMessage());
    }
}
Also used : BatchRunXmlReader(cbit.vcell.microscopy.batchrun.BatchRunXmlReader) Parameter(cbit.vcell.opt.Parameter) FRAPBatchRunWorkspace(cbit.vcell.microscopy.batchrun.FRAPBatchRunWorkspace)

Aggregations

BatchRunXmlReader (cbit.vcell.microscopy.batchrun.BatchRunXmlReader)2 FRAPBatchRunWorkspace (cbit.vcell.microscopy.batchrun.FRAPBatchRunWorkspace)2 Parameter (cbit.vcell.opt.Parameter)2