Search in sources :

Example 71 with AsynchClientTask

use of cbit.vcell.client.task.AsynchClientTask in project vcell by virtualcell.

the class ChooseModel_ModelTypesDescriptor method preNextProcess.

public ArrayList<AsynchClientTask> preNextProcess() {
    ArrayList<AsynchClientTask> tasks = new ArrayList<AsynchClientTask>();
    AsynchClientTask aTask1 = new AsynchClientTask("Saving selected model types...", AsynchClientTask.TASKTYPE_NONSWING_BLOCKING) {

        public void run(Hashtable<String, Object> hashTable) throws Exception {
            FRAPStudy fStudy = frapWorkspace.getWorkingFrapStudy();
            if (fStudy == null) {
                throw new Exception("FRAPStudy is null. Please load data.");
            }
            boolean[] models = modelTypesPanel.getModelTypes();
            // perform checkings...is one selected, is koffRatemodel selected(in this case force to use bleached ROI only)
            if (modelTypesPanel.getNumUserSelectedModelTypes() < 1) {
                throw new Exception("At least one model type has to be selected.");
            }
            // if reaction dominant off rate model is selected, we have to make sure that the bleached ROI should be selected.
            if (models[FRAPModel.IDX_MODEL_REACTION_OFF_RATE] && !fStudy.getSelectedROIsForErrorCalculation()[FRAPData.VFRAP_ROI_ENUM.ROI_BLEACHED.ordinal()]) {
                String choice = DialogUtils.showWarningDialog(modelTypesPanel, "To evaluate Reaction Dominant Off Rate model, bleached ROI must be selected. \n\nSelecte 'Continue' to have bleached ROI automatically added and proceed. Or,\nSelecte 'Cancel' to stop proceeding.", new String[] { UserMessage.OPTION_CONTINUE, UserMessage.OPTION_CANCEL }, UserMessage.OPTION_CONTINUE);
                if (choice.equals(UserMessage.OPTION_CONTINUE)) {
                    fStudy.getSelectedROIsForErrorCalculation()[FRAPData.VFRAP_ROI_ENUM.ROI_BLEACHED.ordinal()] = true;
                } else {
                    throw UserCancelException.CANCEL_GENERIC;
                }
            }
            // update selected models in FrapStudy
            fStudy.refreshModels(models);
        }
    };
    tasks.add(aTask1);
    return tasks;
}
Also used : AsynchClientTask(cbit.vcell.client.task.AsynchClientTask) Hashtable(java.util.Hashtable) ArrayList(java.util.ArrayList) FRAPStudy(cbit.vcell.microscopy.FRAPStudy) UserCancelException(org.vcell.util.UserCancelException)

Example 72 with AsynchClientTask

use of cbit.vcell.client.task.AsynchClientTask in project vcell by virtualcell.

the class DefineROI_BackgroundROIDescriptor method postNextProcess.

public ArrayList<AsynchClientTask> postNextProcess() {
    // create AsynchClientTask arraylist
    ArrayList<AsynchClientTask> taskArrayList = new ArrayList<AsynchClientTask>();
    AsynchClientTask ifNeedROIAssistTask = new AsynchClientTask("", AsynchClientTask.TASKTYPE_SWING_BLOCKING) {

        public void run(Hashtable<String, Object> hashTable) throws Exception {
            if ((((DefineROI_Panel) imgPanel).getCenterPanel()).getOverlayEditorPanelJAI().isROIAssistVisible() && ((DefineROI_Panel) imgPanel).getFrapWorkspace().getWorkingFrapStudy().getFrapData().getRoi(FRAPData.VFRAP_ROI_ENUM.ROI_BACKGROUND.name()).getNonzeroPixelsCount() < 1) {
                DialogUtils.showWarningDialog((imgPanel), "Background ROI is not applied. Please complete the following actions to apply: \n \'Resolve...\' -> \'Fill Voids\' -> \'Apply and Close\'. ");
            }
        }
    };
    taskArrayList.add(ifNeedROIAssistTask);
    return taskArrayList;
}
Also used : AsynchClientTask(cbit.vcell.client.task.AsynchClientTask) Hashtable(java.util.Hashtable) ArrayList(java.util.ArrayList)

Example 73 with AsynchClientTask

use of cbit.vcell.client.task.AsynchClientTask in project vcell by virtualcell.

the class DefineROI_BackgroundROIDescriptor method preNextProcess.

public ArrayList<AsynchClientTask> preNextProcess() {
    // create AsynchClientTask arraylist
    ArrayList<AsynchClientTask> taskArrayList = new ArrayList<AsynchClientTask>();
    final String nextROIStr = null;
    AsynchClientTask setCurrentROITask = new AsynchClientTask("", AsynchClientTask.TASKTYPE_SWING_BLOCKING) {

        public void run(Hashtable<String, Object> hashTable) throws Exception {
            // save current ROI and load ROI in the panel it goes next to
            ((DefineROI_Panel) imgPanel).setCurrentROI(nextROIStr, true);
            FRAPData fData = ((DefineROI_Panel) imgPanel).getFrapWorkspace().getWorkingFrapStudy().getFrapData();
            fData.setCurrentlyDisplayedROI(fData.getRoi(FRAPData.VFRAP_ROI_ENUM.ROI_CELL.name()), true);
        }
    };
    taskArrayList.add(setCurrentROITask);
    return taskArrayList;
}
Also used : AsynchClientTask(cbit.vcell.client.task.AsynchClientTask) Hashtable(java.util.Hashtable) FRAPData(cbit.vcell.microscopy.FRAPData) ArrayList(java.util.ArrayList)

Example 74 with AsynchClientTask

use of cbit.vcell.client.task.AsynchClientTask in project vcell by virtualcell.

the class DefineROI_BackgroundROIDescriptor method preBackProcess.

public ArrayList<AsynchClientTask> preBackProcess() {
    // create AsynchClientTask arraylist
    ArrayList<AsynchClientTask> taskArrayList = new ArrayList<AsynchClientTask>();
    final String backROIStr = FRAPData.VFRAP_ROI_ENUM.ROI_BLEACHED.name();
    AsynchClientTask setCurrentROITask = new AsynchClientTask("", AsynchClientTask.TASKTYPE_SWING_BLOCKING) {

        public void run(Hashtable<String, Object> hashTable) throws Exception {
            // save current ROI and load ROI in the panel it backs to
            ((DefineROI_Panel) imgPanel).setCurrentROI(backROIStr, true);
        }
    };
    taskArrayList.add(setCurrentROITask);
    return taskArrayList;
}
Also used : AsynchClientTask(cbit.vcell.client.task.AsynchClientTask) Hashtable(java.util.Hashtable) ArrayList(java.util.ArrayList)

Example 75 with AsynchClientTask

use of cbit.vcell.client.task.AsynchClientTask in project vcell by virtualcell.

the class DefineROI_BleachedROIDescriptor method postNextProcess.

public ArrayList<AsynchClientTask> postNextProcess() {
    // create AsynchClientTask arraylist
    ArrayList<AsynchClientTask> taskArrayList = new ArrayList<AsynchClientTask>();
    AsynchClientTask ifNeedROIAssistTask = new AsynchClientTask("", AsynchClientTask.TASKTYPE_SWING_BLOCKING) {

        public void run(Hashtable<String, Object> hashTable) throws Exception {
            if ((((DefineROI_Panel) imgPanel).getCenterPanel()).getOverlayEditorPanelJAI().isROIAssistVisible() && ((DefineROI_Panel) imgPanel).getFrapWorkspace().getWorkingFrapStudy().getFrapData().getRoi(FRAPData.VFRAP_ROI_ENUM.ROI_BLEACHED.name()).getNonzeroPixelsCount() < 1) {
                DialogUtils.showWarningDialog((imgPanel), "Bleached ROI is not applied. Please complete the following actions to apply: \n \'Resolve...\' -> \'Fill Voids\' -> \'Apply and Close\'. ");
            }
        }
    };
    taskArrayList.add(ifNeedROIAssistTask);
    return taskArrayList;
}
Also used : AsynchClientTask(cbit.vcell.client.task.AsynchClientTask) Hashtable(java.util.Hashtable) ArrayList(java.util.ArrayList)

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