Search in sources :

Example 1 with Wizard

use of org.vcell.wizard.Wizard in project vcell by virtualcell.

the class VirtualFrapBatchRunFrame method getChooseModelTypeWizard.

public Wizard getChooseModelTypeWizard() {
    if (modelTypeWizard == null) {
        modelTypeWizard = new Wizard(JOptionPane.getFrameForComponent(this));
        modelTypeWizard.getDialog().setTitle("Choose Model Type");
        WizardPanelDescriptor modelTypesDescriptor = new ModelTypesDescriptor();
        modelTypeWizard.registerWizardPanel(ModelTypesDescriptor.IDENTIFIER, modelTypesDescriptor);
        ((ModelTypesDescriptor) modelTypesDescriptor).setBatchRunWorkspace(batchRunWorkspace);
    }
    // always start from the first page
    modelTypeWizard.setCurrentPanel(ModelTypesDescriptor.IDENTIFIER);
    return modelTypeWizard;
}
Also used : ModelTypesDescriptor(cbit.vcell.microscopy.batchrun.gui.chooseModelWizard.ModelTypesDescriptor) WizardPanelDescriptor(org.vcell.wizard.WizardPanelDescriptor) Wizard(org.vcell.wizard.Wizard)

Example 2 with Wizard

use of org.vcell.wizard.Wizard in project vcell by virtualcell.

the class FRAPStudyPanel method getDefineROIWizard.

public Wizard getDefineROIWizard() {
    if (defineROIWizard == null) {
        // use one panel for all the steps.
        imgPanel = new DefineROI_Panel();
        imgPanel.setFrapWorkspace(getFrapWorkspace());
        defineROIWizard = new Wizard(JOptionPane.getFrameForComponent(this));
        defineROIWizard.getDialog().setTitle("Define ROIs");
        DefineROI_CropDescriptor cropDescriptor = new DefineROI_CropDescriptor(imgPanel);
        defineROIWizard.registerWizardPanel(DefineROI_CropDescriptor.IDENTIFIER, cropDescriptor);
        DefineROI_CellROIDescriptor cellROIDescriptor = new DefineROI_CellROIDescriptor(imgPanel);
        defineROIWizard.registerWizardPanel(DefineROI_CellROIDescriptor.IDENTIFIER, cellROIDescriptor);
        DefineROI_BleachedROIDescriptor bleachedROIDescriptor = new DefineROI_BleachedROIDescriptor(imgPanel);
        defineROIWizard.registerWizardPanel(DefineROI_BleachedROIDescriptor.IDENTIFIER, bleachedROIDescriptor);
        DefineROI_BackgroundROIDescriptor backgroundROIDescriptor = new DefineROI_BackgroundROIDescriptor(imgPanel);
        defineROIWizard.registerWizardPanel(DefineROI_BackgroundROIDescriptor.IDENTIFIER, backgroundROIDescriptor);
        DefineROI_SummaryDescriptor ROISummaryDescriptor = new DefineROI_SummaryDescriptor(imgPanel);
        defineROIWizard.registerWizardPanel(DefineROI_SummaryDescriptor.IDENTIFIER, ROISummaryDescriptor);
        ROISummaryDescriptor.setFrapWorkspace(getFrapWorkspace());
        DefineROI_RoiForErrorDescriptor roiForErrorDescriptor = new DefineROI_RoiForErrorDescriptor();
        defineROIWizard.registerWizardPanel(DefineROI_RoiForErrorDescriptor.IDENTIFIER, roiForErrorDescriptor);
        (roiForErrorDescriptor).setFrapWorkspace(getFrapWorkspace());
    }
    // always start from the first page
    defineROIWizard.setCurrentPanel(DefineROI_CropDescriptor.IDENTIFIER);
    imgPanel.refreshUI();
    return defineROIWizard;
}
Also used : DefineROI_CropDescriptor(cbit.vcell.microscopy.gui.defineROIwizard.DefineROI_CropDescriptor) DefineROI_CellROIDescriptor(cbit.vcell.microscopy.gui.defineROIwizard.DefineROI_CellROIDescriptor) DefineROI_BleachedROIDescriptor(cbit.vcell.microscopy.gui.defineROIwizard.DefineROI_BleachedROIDescriptor) DefineROI_SummaryDescriptor(cbit.vcell.microscopy.gui.defineROIwizard.DefineROI_SummaryDescriptor) Wizard(org.vcell.wizard.Wizard) DefineROI_Panel(cbit.vcell.microscopy.gui.defineROIwizard.DefineROI_Panel) DefineROI_BackgroundROIDescriptor(cbit.vcell.microscopy.gui.defineROIwizard.DefineROI_BackgroundROIDescriptor) DefineROI_RoiForErrorDescriptor(cbit.vcell.microscopy.gui.defineROIwizard.DefineROI_RoiForErrorDescriptor)

Example 3 with Wizard

use of org.vcell.wizard.Wizard in project vcell by virtualcell.

the class FRAPStudyPanel method getEstimateParametersWizard.

public Wizard getEstimateParametersWizard() {
    FRAPStudy fStudy = getFrapWorkspace().getWorkingFrapStudy();
    if (fStudy == null || fStudy.getSelectedModels().size() == 0) {
        return null;
    } else {
        if (estimateParamWizard == null) {
            estimateParamWizard = new Wizard(JOptionPane.getFrameForComponent(this));
            estimateParamWizard.getDialog().setTitle("Estimate Parameters");
            // initialize the wizard panels
            diffOneDescriptor = new EstParams_OneDiffComponentDescriptor();
            diffOneDescriptor.setFrapWorkspace(getFrapWorkspace());
            diffTwoDescriptor = new EstParams_TwoDiffComponentDescriptor();
            diffTwoDescriptor.setFrapWorkspace(getFrapWorkspace());
            offRateDescriptor = new EstParams_ReactionOffRateDescriptor();
            offRateDescriptor.setFrapWorkspace(getFrapWorkspace());
            compareResultsDescriptor = new EstParams_CompareResultsDescriptor();
            compareResultsDescriptor.setFrapWorkspace(getFrapWorkspace());
        }
        // Dynamicly link the wizard pages according to the selected models.
        // clear all first
        estimateParamWizard.clearAllPanels();
        WizardPanelDescriptor lastDescriptor = null;
        for (int i = 0; i < fStudy.getSelectedModels().size(); i++) {
            int modelType = fStudy.getSelectedModels().get(i).intValue();
            if (modelType == FRAPModel.IDX_MODEL_DIFF_ONE_COMPONENT) {
                estimateParamWizard.registerWizardPanel(EstParams_OneDiffComponentDescriptor.IDENTIFIER, diffOneDescriptor);
                diffOneDescriptor.setBackPanelDescriptorID((lastDescriptor == null) ? null : lastDescriptor.getPanelDescriptorIdentifier());
                if (// not the first wizard page
                lastDescriptor != null) {
                    lastDescriptor.setNextPanelDescriptorID(EstParams_OneDiffComponentDescriptor.IDENTIFIER);
                }
                lastDescriptor = diffOneDescriptor;
            } else if (modelType == FRAPModel.IDX_MODEL_DIFF_TWO_COMPONENTS) {
                estimateParamWizard.registerWizardPanel(EstParams_TwoDiffComponentDescriptor.IDENTIFIER, diffTwoDescriptor);
                diffTwoDescriptor.setBackPanelDescriptorID((lastDescriptor == null) ? null : lastDescriptor.getPanelDescriptorIdentifier());
                if (lastDescriptor != null) {
                    lastDescriptor.setNextPanelDescriptorID(EstParams_TwoDiffComponentDescriptor.IDENTIFIER);
                }
                lastDescriptor = diffTwoDescriptor;
            } else if (modelType == FRAPModel.IDX_MODEL_REACTION_OFF_RATE) {
                estimateParamWizard.registerWizardPanel(EstParams_ReactionOffRateDescriptor.IDENTIFIER, offRateDescriptor);
                offRateDescriptor.setBackPanelDescriptorID((lastDescriptor == null) ? null : lastDescriptor.getPanelDescriptorIdentifier());
                if (lastDescriptor != null) {
                    lastDescriptor.setNextPanelDescriptorID(EstParams_ReactionOffRateDescriptor.IDENTIFIER);
                }
                lastDescriptor = offRateDescriptor;
            }
        }
        // the last one should always be the compare page
        estimateParamWizard.registerWizardPanel(EstParams_CompareResultsDescriptor.IDENTIFIER, compareResultsDescriptor);
        lastDescriptor.setNextPanelDescriptorID(EstParams_CompareResultsDescriptor.IDENTIFIER);
        compareResultsDescriptor.setBackPanelDescriptorID(lastDescriptor.getPanelDescriptorIdentifier());
        // each time when load the wizard, it should start from the first possible page.
        if (fStudy.getModels()[FRAPModel.IDX_MODEL_DIFF_ONE_COMPONENT] != null) {
            estimateParamWizard.setCurrentPanel(EstParams_OneDiffComponentDescriptor.IDENTIFIER);
        } else if (fStudy.getModels()[FRAPModel.IDX_MODEL_DIFF_TWO_COMPONENTS] != null) {
            estimateParamWizard.setCurrentPanel(EstParams_TwoDiffComponentDescriptor.IDENTIFIER);
        } else if (fStudy.getModels()[FRAPModel.IDX_MODEL_REACTION_OFF_RATE] != null) {
            estimateParamWizard.setCurrentPanel(EstParams_ReactionOffRateDescriptor.IDENTIFIER);
        }
        return estimateParamWizard;
    }
}
Also used : EstParams_OneDiffComponentDescriptor(cbit.vcell.microscopy.gui.estparamwizard.EstParams_OneDiffComponentDescriptor) EstParams_ReactionOffRateDescriptor(cbit.vcell.microscopy.gui.estparamwizard.EstParams_ReactionOffRateDescriptor) FRAPStudy(cbit.vcell.microscopy.FRAPStudy) EstParams_TwoDiffComponentDescriptor(cbit.vcell.microscopy.gui.estparamwizard.EstParams_TwoDiffComponentDescriptor) WizardPanelDescriptor(org.vcell.wizard.WizardPanelDescriptor) Wizard(org.vcell.wizard.Wizard) Point(java.awt.Point) EstParams_CompareResultsDescriptor(cbit.vcell.microscopy.gui.estparamwizard.EstParams_CompareResultsDescriptor)

Example 4 with Wizard

use of org.vcell.wizard.Wizard in project vcell by virtualcell.

the class FRAPStudyPanel method showEstimateParamWizard.

private void showEstimateParamWizard() {
    // check if frapOpt data is null? if yes, run ref simulation.
    // check if parameters of each selected models are there, if not, run analytic solution, get best parameters and store parameters
    AsynchClientTask saveTask = new AsynchClientTask("Preparing for parameter estimation ...", AsynchClientTask.TASKTYPE_NONSWING_BLOCKING) {

        public void run(Hashtable<String, Object> hashTable) throws Exception {
            FRAPStudy fStudy = getFrapWorkspace().getWorkingFrapStudy();
            if (fStudy.hasDiffusionOnlyModel()) {
                // create optdata
                if (fStudy.getFrapOptData() == null) {
                    if (fStudy.getStoredRefData() != null) {
                        getFrapWorkspace().getWorkingFrapStudy().setFrapOptData(new FRAPOptData(fStudy, FRAPModel.NUM_MODEL_PARAMETERS_ONE_DIFF, getLocalWorkspace(), fStudy.getStoredRefData()));
                    } else {
                        // check external data info
                        if (!FRAPWorkspace.areExternalDataOK(getLocalWorkspace(), fStudy.getFrapDataExternalDataInfo(), fStudy.getRoiExternalDataInfo())) {
                            // if external files are missing/currupt or ROIs are changed, create keys and save them
                            fStudy.setFrapDataExternalDataInfo(FRAPStudy.createNewExternalDataInfo(localWorkspace, FRAPStudy.IMAGE_EXTDATA_NAME));
                            fStudy.setRoiExternalDataInfo(FRAPStudy.createNewExternalDataInfo(localWorkspace, FRAPStudy.ROI_EXTDATA_NAME));
                            fStudy.saveROIsAsExternalData(localWorkspace, fStudy.getRoiExternalDataInfo().getExternalDataIdentifier(), fStudy.getStartingIndexForRecovery());
                            fStudy.saveImageDatasetAsExternalData(localWorkspace, fStudy.getFrapDataExternalDataInfo().getExternalDataIdentifier(), fStudy.getStartingIndexForRecovery());
                        }
                        // run ref sim
                        fStudy.setFrapOptData(new FRAPOptData(fStudy, FRAPModel.NUM_MODEL_PARAMETERS_ONE_DIFF, localWorkspace, this.getClientTaskStatusSupport()));
                        fStudy.setSaveNeeded(true);
                    }
                }
            }
            if (fStudy.hasReactionOnlyOffRateModel()) {
                if (fStudy.getFrapOptFunc() == null) {
                    fStudy.setFrapOptFunc(new FRAPOptFunctions(fStudy));
                }
            }
        }
    };
    AsynchClientTask runOptTask = new AsynchClientTask("Running optimization ...", AsynchClientTask.TASKTYPE_NONSWING_BLOCKING) {

        public void run(Hashtable<String, Object> hashTable) throws Exception {
            FRAPStudy fStudy = getFrapWorkspace().getWorkingFrapStudy();
            if (fStudy.getSelectedModels() != null && fStudy.getSelectedModels().size() > 0) {
                ArrayList<Integer> models = fStudy.getSelectedModels();
                for (int i = 0; i < models.size(); i++) {
                    if ((models.get(i)).intValue() == FRAPModel.IDX_MODEL_DIFF_ONE_COMPONENT) {
                        if (fStudy.getModels()[FRAPModel.IDX_MODEL_DIFF_ONE_COMPONENT].getModelParameters() == null) {
                            fStudy.getFrapOptData().setNumEstimatedParams(FRAPModel.NUM_MODEL_PARAMETERS_ONE_DIFF);
                            Parameter[] initialParams = FRAPModel.getInitialParameters(fStudy.getFrapData(), FRAPModel.MODEL_TYPE_ARRAY[FRAPModel.IDX_MODEL_DIFF_ONE_COMPONENT], fStudy.getStartingIndexForRecovery());
                            Parameter[] bestParameters = fStudy.getFrapOptData().getBestParamters(initialParams, fStudy.getSelectedROIsForErrorCalculation());
                            fStudy.getModels()[FRAPModel.IDX_MODEL_DIFF_ONE_COMPONENT].setModelParameters(bestParameters);
                            fStudy.setSaveNeeded(true);
                        }
                    } else if ((models.get(i)).intValue() == FRAPModel.IDX_MODEL_DIFF_TWO_COMPONENTS) {
                        if (fStudy.getModels()[FRAPModel.IDX_MODEL_DIFF_TWO_COMPONENTS].getModelParameters() == null) {
                            fStudy.getFrapOptData().setNumEstimatedParams(FRAPModel.NUM_MODEL_PARAMETERS_TWO_DIFF);
                            Parameter[] initialParams = FRAPModel.getInitialParameters(fStudy.getFrapData(), FRAPModel.MODEL_TYPE_ARRAY[FRAPModel.IDX_MODEL_DIFF_TWO_COMPONENTS], fStudy.getStartingIndexForRecovery());
                            Parameter[] bestParameters = fStudy.getFrapOptData().getBestParamters(initialParams, fStudy.getSelectedROIsForErrorCalculation());
                            fStudy.getModels()[FRAPModel.IDX_MODEL_DIFF_TWO_COMPONENTS].setModelParameters(bestParameters);
                            fStudy.setSaveNeeded(true);
                        }
                    } else if ((models.get(i)).intValue() == FRAPModel.IDX_MODEL_REACTION_OFF_RATE) {
                        if (fStudy.getModels()[FRAPModel.IDX_MODEL_REACTION_OFF_RATE].getModelParameters() == null) {
                            Parameter[] bestParameters = fStudy.getFrapOptFunc().getBestParamters(fStudy.getFrapData(), null, true);
                            fStudy.getModels()[FRAPModel.IDX_MODEL_REACTION_OFF_RATE].setModelParameters(bestParameters);
                            fStudy.setSaveNeeded(true);
                        }
                    }
                }
            }
        }
    };
    AsynchClientTask evaulateCITask = new AsynchClientTask("Evaluating confidence intervals for model parameters ...", AsynchClientTask.TASKTYPE_NONSWING_BLOCKING) {

        public void run(Hashtable<String, Object> hashTable) throws Exception {
            FRAPStudy fStudy = getFrapWorkspace().getWorkingFrapStudy();
            if (fStudy.getSelectedModels() != null && fStudy.getSelectedModels().size() > 0) {
                ArrayList<Integer> models = fStudy.getSelectedModels();
                for (int i = 0; i < models.size(); i++) {
                    if ((models.get(i)).intValue() == FRAPModel.IDX_MODEL_DIFF_ONE_COMPONENT) {
                        if (fStudy.getModels()[FRAPModel.IDX_MODEL_DIFF_ONE_COMPONENT].getModelParameters() != null && fStudy.getModels()[FRAPModel.IDX_MODEL_DIFF_ONE_COMPONENT].getModelParameters().length > 0) {
                            Parameter[] currentParams = fStudy.getModels()[FRAPModel.IDX_MODEL_DIFF_ONE_COMPONENT].getModelParameters();
                            fStudy.getFrapOptData().setNumEstimatedParams(currentParams.length);
                            ProfileData[] profileData = null;
                            if (fStudy.getProfileData_oneDiffComponent() != null) {
                                profileData = fStudy.getProfileData_oneDiffComponent();
                            } else {
                                profileData = fStudy.getFrapOptData().evaluateParameters(currentParams, this.getClientTaskStatusSupport());
                                fStudy.setProfileData_oneDiffComponent(profileData);
                                fStudy.setSaveNeeded(true);
                            }
                        }
                    } else if ((models.get(i)).intValue() == FRAPModel.IDX_MODEL_DIFF_TWO_COMPONENTS) {
                        if (fStudy.getModels()[FRAPModel.IDX_MODEL_DIFF_TWO_COMPONENTS].getModelParameters() != null && fStudy.getModels()[FRAPModel.IDX_MODEL_DIFF_TWO_COMPONENTS].getModelParameters().length > 0) {
                            Parameter[] currentParams = fStudy.getModels()[FRAPModel.IDX_MODEL_DIFF_TWO_COMPONENTS].getModelParameters();
                            fStudy.getFrapOptData().setNumEstimatedParams(currentParams.length);
                            ProfileData[] profileData = null;
                            if (fStudy.getProfileData_twoDiffComponents() != null) {
                                profileData = fStudy.getProfileData_twoDiffComponents();
                            } else {
                                profileData = fStudy.getFrapOptData().evaluateParameters(currentParams, this.getClientTaskStatusSupport());
                                fStudy.setProfileData_twoDiffComponents(profileData);
                                fStudy.setSaveNeeded(true);
                            }
                        }
                    } else if ((models.get(i)).intValue() == FRAPModel.IDX_MODEL_REACTION_OFF_RATE) {
                        if (fStudy.getModels()[FRAPModel.IDX_MODEL_REACTION_OFF_RATE].getModelParameters() != null && fStudy.getModels()[FRAPModel.IDX_MODEL_REACTION_OFF_RATE].getModelParameters().length > 0) {
                            Parameter[] currentParams = fStudy.getModels()[FRAPModel.IDX_MODEL_REACTION_OFF_RATE].getModelParameters();
                            ProfileData[] profileData = null;
                            if (fStudy.getProfileData_reactionOffRate() != null) {
                                profileData = fStudy.getProfileData_reactionOffRate();
                            } else {
                                profileData = fStudy.getFrapOptFunc().evaluateParameters(currentParams, this.getClientTaskStatusSupport());
                                fStudy.setProfileData_reactionOffRate(profileData);
                                fStudy.setSaveNeeded(true);
                            }
                        }
                    }
                }
            }
            hashTable.put(FRAPSTUDY_KEY, fStudy);
        }
    };
    AsynchClientTask showDialogTask = new AsynchClientTask("Showing estimation results ...", AsynchClientTask.TASKTYPE_SWING_BLOCKING) {

        public void run(Hashtable<String, Object> hashTable) throws Exception {
            // get frap models  before the wizard
            FRAPStudy fStudy = getFrapWorkspace().getWorkingFrapStudy();
            FRAPModel[] oldFrapModels = new FRAPModel[FRAPModel.NUM_MODEL_TYPES];
            for (int i = 0; i < fStudy.getModels().length; i++) {
                if (fStudy.getModels()[i] != null) {
                    FRAPModel model = fStudy.getModels()[i];
                    oldFrapModels[i] = new FRAPModel(new String(model.getModelIdentifer()), model.duplicateParameters(), null, model.duplicateTimePoints());
                }
            }
            // get best model index before the wizard
            Integer oldBestModelIndex = null;
            if (fStudy.getBestModelIndex() != null) {
                oldBestModelIndex = new Integer(fStudy.getBestModelIndex().intValue());
                // put old best model index into hashtable
                hashTable.put(BEST_MODEL_KEY, oldBestModelIndex);
            }
            // put old frapmodels in hashtable
            hashTable.put(FRAPMODELS_KEY, oldFrapModels);
            // show wizard
            final Wizard estParamWizard = getEstimateParametersWizard();
            SwingUtilities.invokeLater(new Runnable() {

                public void run() {
                    estParamWizard.showModalDialog(new Dimension(1000, 750));
                }
            });
            // put wizard in hashtable in order to check return code in next task
            hashTable.put(EST_PARAM_WIZARD_KEY, estParamWizard);
        }
    };
    AsynchClientTask updateSaveStatusTask = new AsynchClientTask("...", AsynchClientTask.TASKTYPE_NONSWING_BLOCKING) {

        public void run(Hashtable<String, Object> hashTable) throws Exception {
            Wizard estParamWizard = (Wizard) hashTable.get(EST_PARAM_WIZARD_KEY);
            // get old values from hashtable
            FRAPModel[] oldFrapModels = (FRAPModel[]) hashTable.get(FRAPMODELS_KEY);
            Integer oldBestModelIndex = (Integer) hashTable.get(BEST_MODEL_KEY);
            // get new values
            Integer newBestModelIndex = getFrapWorkspace().getWorkingFrapStudy().getBestModelIndex();
            if (estParamWizard.getReturnCode() == Wizard.FINISH_RETURN_CODE) {
                if (!getFrapWorkspace().getWorkingFrapStudy().areFRAPModelsEqual(oldFrapModels) || (oldBestModelIndex == null && newBestModelIndex != null) || (oldBestModelIndex != null && newBestModelIndex == null) || (oldBestModelIndex != null && newBestModelIndex != null && oldBestModelIndex.intValue() != newBestModelIndex.intValue())) {
                    getFrapWorkspace().getWorkingFrapStudy().setSaveNeeded(true);
                }
            }
        }
    };
    // dispatch
    ClientTaskDispatcher.dispatch(this, new Hashtable<String, Object>(), new AsynchClientTask[] { saveTask, runOptTask, evaulateCITask, showDialogTask, updateSaveStatusTask }, true, true, true, null, true);
}
Also used : AsynchClientTask(cbit.vcell.client.task.AsynchClientTask) Hashtable(java.util.Hashtable) FRAPOptFunctions(cbit.vcell.microscopy.FRAPOptFunctions) ProfileData(org.vcell.optimization.ProfileData) Dimension(java.awt.Dimension) Point(java.awt.Point) FRAPModel(cbit.vcell.microscopy.FRAPModel) FRAPStudy(cbit.vcell.microscopy.FRAPStudy) FRAPOptData(cbit.vcell.microscopy.FRAPOptData) Parameter(cbit.vcell.opt.Parameter) Wizard(org.vcell.wizard.Wizard)

Example 5 with Wizard

use of org.vcell.wizard.Wizard in project vcell by virtualcell.

the class FRAPStudyPanel method getLoadFRAPDataWizard.

public Wizard getLoadFRAPDataWizard() {
    // summarypanel) to frapdatapanel.
    if (loadFRAPDataWizard == null) {
        loadFRAPDataWizard = new Wizard(JOptionPane.getFrameForComponent(this));
        loadFRAPDataWizard.getDialog().setTitle("Load FRAP Data");
        LoadFRAPData_FileTypeDescriptor fTypeDescriptor = new LoadFRAPData_FileTypeDescriptor();
        // goes next to single file input by default
        fTypeDescriptor.setNextPanelDescriptorID(LoadFRAPData_SingleFileDescriptor.IDENTIFIER);
        loadFRAPDataWizard.registerWizardPanel(LoadFRAPData_FileTypeDescriptor.IDENTIFIER, fTypeDescriptor);
        LoadFRAPData_SingleFileDescriptor singleFileDescriptor = new LoadFRAPData_SingleFileDescriptor();
        loadFRAPDataWizard.registerWizardPanel(LoadFRAPData_SingleFileDescriptor.IDENTIFIER, singleFileDescriptor);
        (singleFileDescriptor).setFrapWorkspace(getFrapWorkspace());
        LoadFRAPData_MultiFileDescriptor multiFileDescriptor = new LoadFRAPData_MultiFileDescriptor();
        loadFRAPDataWizard.registerWizardPanel(LoadFRAPData_MultiFileDescriptor.IDENTIFIER, multiFileDescriptor);
        (multiFileDescriptor).setFrapWorkspace(getFrapWorkspace());
        LoadFRAPData_SummaryDescriptor fSummaryDescriptor = new LoadFRAPData_SummaryDescriptor();
        // goes back to single file input by default
        fSummaryDescriptor.setBackPanelDescriptorID(LoadFRAPData_SingleFileDescriptor.IDENTIFIER);
        loadFRAPDataWizard.registerWizardPanel(LoadFRAPData_SummaryDescriptor.IDENTIFIER, fSummaryDescriptor);
        fSummaryDescriptor.setFrapWorkspace(getFrapWorkspace());
        final WizardPanelDescriptor fileTypeDescriptor = fTypeDescriptor;
        final WizardPanelDescriptor fileSummaryDescriptor = fSummaryDescriptor;
        // actionListener to single file input radio button
        // this radio button affects the wizard series. especially on the next of file type and the back of summary
        ((LoadFRAPData_FileTypePanel) fTypeDescriptor.getPanelComponent()).getSingleFileButton().addActionListener(new ActionListener() {

            public void actionPerformed(ActionEvent e) {
                if (((JRadioButton) e.getSource()).isSelected()) {
                    fileTypeDescriptor.setNextPanelDescriptorID(LoadFRAPData_SingleFileDescriptor.IDENTIFIER);
                    fileSummaryDescriptor.setBackPanelDescriptorID(LoadFRAPData_SingleFileDescriptor.IDENTIFIER);
                }
            }
        });
        // actionListener to multiple file input radio button
        // this radio button affects the wizard series. especially on the next of file type and the back of summary
        ((LoadFRAPData_FileTypePanel) fTypeDescriptor.getPanelComponent()).getMultipleFileButton().addActionListener(new ActionListener() {

            public void actionPerformed(ActionEvent e) {
                if (((JRadioButton) e.getSource()).isSelected()) {
                    fileTypeDescriptor.setNextPanelDescriptorID(LoadFRAPData_MultiFileDescriptor.IDENTIFIER);
                    fileSummaryDescriptor.setBackPanelDescriptorID(LoadFRAPData_MultiFileDescriptor.IDENTIFIER);
                }
            }
        });
        if (getDocumentWindowManager() != null) {
            LoadFRAPData_PostProcessingDataDescriptor postProcessingDataDescriptor = new LoadFRAPData_PostProcessingDataDescriptor();
            loadFRAPDataWizard.registerWizardPanel(LoadFRAPData_PostProcessingDataDescriptor.IDENTIFIER, postProcessingDataDescriptor);
            postProcessingDataDescriptor.setFrapWorkspace(getFrapWorkspace());
            postProcessingDataDescriptor.setDocumentWindowManager(getDocumentWindowManager());
            // actionListener to multiple file input radio button
            // this radio button affects the wizard series. especially on the next of file type and the back of summary
            ((LoadFRAPData_FileTypePanel) fTypeDescriptor.getPanelComponent()).getPostProcessDataButton().setVisible(true);
            ((LoadFRAPData_FileTypePanel) fTypeDescriptor.getPanelComponent()).getPostProcessDataButton().addActionListener(new ActionListener() {

                public void actionPerformed(ActionEvent e) {
                    if (((JRadioButton) e.getSource()).isSelected()) {
                        fileTypeDescriptor.setNextPanelDescriptorID(LoadFRAPData_PostProcessingDataDescriptor.IDENTIFIER);
                        fileSummaryDescriptor.setBackPanelDescriptorID(LoadFRAPData_PostProcessingDataDescriptor.IDENTIFIER);
                    }
                }
            });
        }
    }
    // always start from the first page
    loadFRAPDataWizard.setCurrentPanel(LoadFRAPData_FileTypeDescriptor.IDENTIFIER);
    return loadFRAPDataWizard;
}
Also used : LoadFRAPData_FileTypeDescriptor(cbit.vcell.microscopy.gui.loaddatawizard.LoadFRAPData_FileTypeDescriptor) LoadFRAPData_PostProcessingDataDescriptor(cbit.vcell.microscopy.gui.loaddatawizard.LoadFRAPData_PostProcessingDataDescriptor) ActionListener(java.awt.event.ActionListener) ActionEvent(java.awt.event.ActionEvent) LoadFRAPData_SingleFileDescriptor(cbit.vcell.microscopy.gui.loaddatawizard.LoadFRAPData_SingleFileDescriptor) LoadFRAPData_SummaryDescriptor(cbit.vcell.microscopy.gui.loaddatawizard.LoadFRAPData_SummaryDescriptor) WizardPanelDescriptor(org.vcell.wizard.WizardPanelDescriptor) Wizard(org.vcell.wizard.Wizard) LoadFRAPData_MultiFileDescriptor(cbit.vcell.microscopy.gui.loaddatawizard.LoadFRAPData_MultiFileDescriptor)

Aggregations

Wizard (org.vcell.wizard.Wizard)8 WizardPanelDescriptor (org.vcell.wizard.WizardPanelDescriptor)4 FRAPStudy (cbit.vcell.microscopy.FRAPStudy)3 AsynchClientTask (cbit.vcell.client.task.AsynchClientTask)2 FRAPOptData (cbit.vcell.microscopy.FRAPOptData)2 FRAPOptFunctions (cbit.vcell.microscopy.FRAPOptFunctions)2 Parameter (cbit.vcell.opt.Parameter)2 Dimension (java.awt.Dimension)2 Point (java.awt.Point)2 ActionEvent (java.awt.event.ActionEvent)2 ActionListener (java.awt.event.ActionListener)2 Hashtable (java.util.Hashtable)2 FRAPModel (cbit.vcell.microscopy.FRAPModel)1 BackgroundROIDescriptor (cbit.vcell.microscopy.batchrun.gui.addFRAPdocWizard.BackgroundROIDescriptor)1 BatchRunROIImgPanel (cbit.vcell.microscopy.batchrun.gui.addFRAPdocWizard.BatchRunROIImgPanel)1 BleachedROIDescriptor (cbit.vcell.microscopy.batchrun.gui.addFRAPdocWizard.BleachedROIDescriptor)1 CellROIDescriptor (cbit.vcell.microscopy.batchrun.gui.addFRAPdocWizard.CellROIDescriptor)1 CropDescriptor (cbit.vcell.microscopy.batchrun.gui.addFRAPdocWizard.CropDescriptor)1 FileSaveDescriptor (cbit.vcell.microscopy.batchrun.gui.addFRAPdocWizard.FileSaveDescriptor)1 FileSummaryDescriptor (cbit.vcell.microscopy.batchrun.gui.addFRAPdocWizard.FileSummaryDescriptor)1