Search in sources :

Example 61 with AsynchClientTask

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);
}
Also used : JScrollPane(javax.swing.JScrollPane) JPanel(javax.swing.JPanel) AsynchClientTask(cbit.vcell.client.task.AsynchClientTask) Hashtable(java.util.Hashtable) BoxLayout(javax.swing.BoxLayout) ProfileData(org.vcell.optimization.ProfileData) Dimension(java.awt.Dimension) EtchedBorder(javax.swing.border.EtchedBorder) ConfidenceIntervalPlotPanel(org.vcell.optimization.gui.ConfidenceIntervalPlotPanel) ProfileDataPanel(org.vcell.optimization.gui.ProfileDataPanel)

Example 62 with AsynchClientTask

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

Example 63 with AsynchClientTask

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);
}
Also used : JScrollPane(javax.swing.JScrollPane) JPanel(javax.swing.JPanel) AsynchClientTask(cbit.vcell.client.task.AsynchClientTask) Hashtable(java.util.Hashtable) BoxLayout(javax.swing.BoxLayout) ProfileData(org.vcell.optimization.ProfileData) Dimension(java.awt.Dimension) EtchedBorder(javax.swing.border.EtchedBorder) ConfidenceIntervalPlotPanel(org.vcell.optimization.gui.ConfidenceIntervalPlotPanel) ProfileDataPanel(org.vcell.optimization.gui.ProfileDataPanel)

Example 64 with AsynchClientTask

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

Example 65 with AsynchClientTask

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);
}
Also used : JScrollPane(javax.swing.JScrollPane) JPanel(javax.swing.JPanel) AsynchClientTask(cbit.vcell.client.task.AsynchClientTask) Hashtable(java.util.Hashtable) BoxLayout(javax.swing.BoxLayout) ProfileData(org.vcell.optimization.ProfileData) Dimension(java.awt.Dimension) EtchedBorder(javax.swing.border.EtchedBorder) ConfidenceIntervalPlotPanel(org.vcell.optimization.gui.ConfidenceIntervalPlotPanel) ProfileDataPanel(org.vcell.optimization.gui.ProfileDataPanel)

Aggregations

AsynchClientTask (cbit.vcell.client.task.AsynchClientTask)229 Hashtable (java.util.Hashtable)219 ArrayList (java.util.ArrayList)68 UserCancelException (org.vcell.util.UserCancelException)52 File (java.io.File)35 CSGObject (cbit.vcell.geometry.CSGObject)30 Point (java.awt.Point)23 DataAccessException (org.vcell.util.DataAccessException)22 SimulationContext (cbit.vcell.mapping.SimulationContext)21 FRAPStudy (cbit.vcell.microscopy.FRAPStudy)18 PropertyVetoException (java.beans.PropertyVetoException)18 ImageException (cbit.image.ImageException)17 IOException (java.io.IOException)17 GeometryThumbnailImageFactoryAWT (cbit.vcell.geometry.GeometryThumbnailImageFactoryAWT)14 Vector (java.util.Vector)14 DataFormatException (java.util.zip.DataFormatException)14 UtilCancelException (org.vcell.util.UtilCancelException)14 Geometry (cbit.vcell.geometry.Geometry)12 ActionEvent (java.awt.event.ActionEvent)12 BioModel (cbit.vcell.biomodel.BioModel)11