use of cbit.vcell.client.task.AsynchClientTask in project vcell by virtualcell.
the class CellROIDescriptor method preNextProcess.
public ArrayList<AsynchClientTask> preNextProcess() {
// create AsynchClientTask arraylist
ArrayList<AsynchClientTask> taskArrayList = new ArrayList<AsynchClientTask>();
final String nextROIStr = 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 goes next to
((BatchRunROIImgPanel) imgPanel).setCurrentROI(nextROIStr, true);
}
};
taskArrayList.add(setCurrentROITask);
return taskArrayList;
}
use of cbit.vcell.client.task.AsynchClientTask in project vcell by virtualcell.
the class CropDescriptor method preNextProcess.
public ArrayList<AsynchClientTask> preNextProcess() {
// create AsynchClientTask arraylist
ArrayList<AsynchClientTask> taskArrayList = new ArrayList<AsynchClientTask>();
final String nextROIStr = FRAPData.VFRAP_ROI_ENUM.ROI_CELL.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 goes next to
((BatchRunROIImgPanel) imgPanel).setCurrentROI(nextROIStr, true);
}
};
taskArrayList.add(setCurrentROITask);
return taskArrayList;
}
use of cbit.vcell.client.task.AsynchClientTask in project vcell by virtualcell.
the class MultiFileDescriptor method preNextProcess.
// load the data before the panel disappears
public ArrayList<AsynchClientTask> preNextProcess() {
// create AsynchClientTask arraylist
ArrayList<AsynchClientTask> taskArrayList = new ArrayList<AsynchClientTask>();
final File[] files = multiFilePanel.getSelectedFiles();
if (files.length > 0) {
final String filePath = files[0].getParent();
final String LOADING_MESSAGE = "Loading files from directory " + filePath + "...";
AsynchClientTask updateUIBeforeLoadTask = new AsynchClientTask("", AsynchClientTask.TASKTYPE_SWING_BLOCKING) {
public void run(Hashtable<String, Object> hashTable) throws Exception {
try {
VirtualFrapMainFrame.updateStatus(LOADING_MESSAGE);
} catch (Exception e) {
e.printStackTrace(System.out);
}
}
};
AsynchClientTask loadTask = new AsynchClientTask(LOADING_MESSAGE, AsynchClientTask.TASKTYPE_NONSWING_BLOCKING) {
public void run(Hashtable<String, Object> hashTable) throws Exception {
FRAPStudy newFRAPStudy = null;
newFRAPStudy = FRAPWorkspace.loadFRAPDataFromMultipleFiles(files, this.getClientTaskStatusSupport(), multiFilePanel.isTimeSeries(), multiFilePanel.getTimeInterval());
isFileLoaded = true;
// for all loaded files
hashTable.put(FRAPStudyPanel.NEW_FRAPSTUDY_KEY, newFRAPStudy);
}
};
AsynchClientTask afterLoadingSwingTask = new AsynchClientTask(LOADING_MESSAGE, AsynchClientTask.TASKTYPE_SWING_BLOCKING) {
public void run(Hashtable<String, Object> hashTable) throws Exception {
FRAPStudy newFRAPStudy = (FRAPStudy) hashTable.get(FRAPStudyPanel.NEW_FRAPSTUDY_KEY);
// setFrapStudy fires property change, so we have to put it in Swing thread.
getFrapWorkspace().setWorkingFRAPStudy(newFRAPStudy);
VirtualFrapLoader.mf.setMainFrameTitle("");
VirtualFrapMainFrame.updateProgress(0);
if (isFileLoaded) {
VirtualFrapMainFrame.updateStatus("Loaded files from " + filePath);
} else {
VirtualFrapMainFrame.updateStatus("Failed loading files from " + filePath + ".");
}
}
};
taskArrayList.add(updateUIBeforeLoadTask);
taskArrayList.add(loadTask);
taskArrayList.add(afterLoadingSwingTask);
} else {
DialogUtils.showErrorDialog(multiFilePanel, "No file is selected. Please input one or more file names to continue.");
throw new RuntimeException("No file is selected. Please input one or more file names to continue.");
}
return taskArrayList;
}
use of cbit.vcell.client.task.AsynchClientTask in project vcell by virtualcell.
the class ROISummaryDescriptor method preNextProcess.
// save the startingIndex before the panel disappears
public ArrayList<AsynchClientTask> preNextProcess() {
// create AsynchClientTask arraylist
ArrayList<AsynchClientTask> taskArrayList = new ArrayList<AsynchClientTask>();
AsynchClientTask verifyLoadedDataTask = new AsynchClientTask("", AsynchClientTask.TASKTYPE_SWING_BLOCKING) {
public void run(Hashtable<String, Object> hashTable) throws Exception {
String msg = ((DefineROI_SummaryPanel) getPanelComponent()).checkInputValidity();
if (msg.equals("")) {
int startIndex = ((DefineROI_SummaryPanel) getPanelComponent()).getStartingIndex();
FRAPStudy fStudy = getBatchRunWorkspace().getWorkingFrapStudy();
// check ROI void/discontinuous location
Point internalVoidLocation = ROI.findInternalVoid(fStudy.getFrapData().getRoi(FRAPData.VFRAP_ROI_ENUM.ROI_CELL.name()));
if (internalVoidLocation != null) {
throw new Exception("CELL ROI has unfilled internal void area at image location " + "x=" + internalVoidLocation.x + ",y=" + internalVoidLocation.y + "\n" + "Use ROI editing tools to completely define the CELL ROI");
}
Point[] distinctCellAreaLocations = ROI.checkContinuity(fStudy.getFrapData().getRoi(FRAPData.VFRAP_ROI_ENUM.ROI_CELL.name()));
if (distinctCellAreaLocations != null) {
throw new Exception("CELL ROI has at least 2 discontinuous areas at image locations \n" + "x=" + distinctCellAreaLocations[0].x + ",y=" + distinctCellAreaLocations[0].y + " and " + "x=" + distinctCellAreaLocations[1].x + ",y=" + distinctCellAreaLocations[1].y + "\n" + "Use ROI editing tools to define a single continuous CELL ROI");
}
/**
* check for conflicts of background and bleach ROIs against CellROI.
*/
boolean bViolationBleachROI = fStudy.getFrapData().checkBleachROIViolatesConstraints();
boolean bViolationBackgroundROI = fStudy.getFrapData().checkBackgroundROIViolatesConstraints();
if (bViolationBleachROI || bViolationBackgroundROI) {
final String FIX_AUTO = "Fix Automatically";
final String NO_THANKS = "No, Thanks";
String result = DialogUtils.showWarningDialog(imgPanel, (bViolationBleachROI ? "Bleach ROI extends beyond Cell ROI" : "") + (bViolationBackgroundROI && bViolationBleachROI ? " and" : "") + (bViolationBackgroundROI ? "Background ROI overlaps Cell ROI" : "") + ". Ensure that the Bleach ROI is completely inside the Cell ROI and the Background ROI is completely outside the Cell ROI.\nDo you want Virtual Frap to fix it automatically?", new String[] { FIX_AUTO, NO_THANKS }, FIX_AUTO);
if (result != null && result.equals(FIX_AUTO)) {
if (fStudy.getFrapData().fixROIConstraints()) {
fStudy.setStartingIndexForRecovery(startIndex);
getBatchRunWorkspace().setWorkingFRAPStudy(fStudy);
// generate ROI rings
fStudy.refreshDependentROIs();
} else {
throw new Exception("Please fix the ROI problem or cancel the wizard.");
}
}
}
} else
throw new Exception(msg);
}
};
taskArrayList.add(verifyLoadedDataTask);
return taskArrayList;
}
use of cbit.vcell.client.task.AsynchClientTask in project vcell by virtualcell.
the class ROISummaryDescriptor method preBackProcess.
public ArrayList<AsynchClientTask> preBackProcess() {
// create AsynchClientTask arraylist
ArrayList<AsynchClientTask> taskArrayList = new ArrayList<AsynchClientTask>();
final String nextROIStr = FRAPData.VFRAP_ROI_ENUM.ROI_BACKGROUND.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 goes next to
((BatchRunROIImgPanel) imgPanel).setCurrentROI(nextROIStr, false);
}
};
taskArrayList.add(setCurrentROITask);
return taskArrayList;
}
Aggregations