use of org.vcell.util.ProgressDialogListener in project vcell by virtualcell.
the class WorkflowJGraphProxy method workflowRun.
public void workflowRun() throws Exception {
ClientTaskStatusSupport progress = new ClientTaskStatusSupport() {
String message = "";
int progress = 0;
@Override
public void setProgress(int progress) {
this.progress = progress;
}
@Override
public void setMessage(String message) {
this.message = message;
}
@Override
public boolean isInterrupted() {
return false;
}
@Override
public int getProgress() {
return progress;
}
@Override
public void addProgressDialogListener(ProgressDialogListener progressDialogListener) {
}
};
context.getWorkflow().compute(context, progress);
}
use of org.vcell.util.ProgressDialogListener in project vcell by virtualcell.
the class BNGWindowManager method runBioNetGen.
/**
* Gets the bngOutputPanel property (cbit.vcell.client.bionetgen.BNGOutputPanel) value.
* @return The bngOutputPanel property value.
*/
public void runBioNetGen(BNGInput bngInput) {
// Create a hash and put in the details required to run the ClientTaskDispatcher
Hashtable<String, Object> hash = new Hashtable<String, Object>();
hash.put(BNG_OUTPUT_PANEL, getBngOutputPanel());
final BNGExecutorService bngService = BNGExecutorService.getInstance(bngInput, NetworkGenerationRequirements.NoTimeoutMS);
// Create the AsynchClientTasks : in this case, running the BioNetGen (non-swing) and then displaying the output (swing) tasks.
AsynchClientTask[] tasksArray = new AsynchClientTask[2];
tasksArray[0] = new RunBioNetGen(bngService);
tasksArray[1] = new DisplayBNGOutput();
// Dispatch the tasks using the ClientTaskDispatcher.
ClientTaskDispatcher.dispatch(getBngOutputPanel(), hash, tasksArray, false, true, new ProgressDialogListener() {
public void cancelButton_actionPerformed(EventObject newEvent) {
try {
bngService.stopBNG();
} catch (Exception e) {
e.printStackTrace();
}
}
});
}
use of org.vcell.util.ProgressDialogListener in project vcell by virtualcell.
the class DocumentWindow method startVCellVisIt.
private void startVCellVisIt() {
AsynchClientTask findVisitTask = new AsynchClientTask("Searching for VisIt...", AsynchClientTask.TASKTYPE_NONSWING_BLOCKING) {
@Override
public void run(Hashtable<String, Object> hashTable) throws Exception {
try {
VisitSupport.launchVisTool(VCellConfiguration.getFileProperty(PropertyLoader.visitExe));
} catch (Exception e) {
e.printStackTrace();
OperatingSystemInfo osi = OperatingSystemInfo.getInstance();
String executableName = ResourceUtil.getExecutableName(VisitSupport.VISIT_EXEC_NAME, false, osi);
File executableLocation = new ExecutableFinderDialog(DocumentWindow.this, "If VisIt is installed (from " + "https://wci.llnl.gov/codes/visit/" + ") but not in the system path, then press press '" + ExecutableFinderDialog.FIND + "' and navigate to '" + executableName + "'.\nElse please install VisIt, restart VCell, and try again").find(executableName);
VisitSupport.launchVisTool(executableLocation);
}
}
};
ProgressDialogListener progressDialogListener = new ProgressDialogListener() {
@Override
public void cancelButton_actionPerformed(EventObject newEvent) {
System.out.println(newEvent);
}
};
// ClientTaskDispatcher.dispatch(requester, hash, tasks, customDialog, bShowProgressPopup, bKnowProgress, cancelable, progressDialogListener, bInputBlocking);
ClientTaskDispatcher.dispatch(DocumentWindow.this, new Hashtable<>(), new AsynchClientTask[] { findVisitTask }, null, true, false, true, progressDialogListener, false);
}
use of org.vcell.util.ProgressDialogListener in project vcell by virtualcell.
the class ROIMultiPaintManager method smoothUnderlay.
private void smoothUnderlay() {
AsynchClientTask smoothTask = new AsynchClientTask("Processing Image...", AsynchClientTask.TASKTYPE_NONSWING_BLOCKING) {
@Override
public void run(Hashtable<String, Object> hashTable) throws Exception {
ClientTaskStatusSupport localClientTaskStatusSupport = new ClientTaskStatusSupport() {
public void setProgress(int progress) {
if (getClientTaskStatusSupport() != null) {
getClientTaskStatusSupport().setProgress((int) (.9 * progress));
}
}
public void setMessage(String message) {
}
public boolean isInterrupted() {
return (getClientTaskStatusSupport() == null ? false : getClientTaskStatusSupport().isInterrupted());
}
public int getProgress() {
return 0;
}
public void addProgressDialogListener(ProgressDialogListener progressDialogListener) {
throw new RuntimeException("not yet implemented");
}
};
enhancedImageDatasetChannels = smoothImageDataset(initImageDataSetChannels, enhanceImageAmount, localClientTaskStatusSupport);
if (localClientTaskStatusSupport.isInterrupted()) {
throw UserCancelException.CANCEL_GENERIC;
}
localClientTaskStatusSupport.setMessage("Calculating histogram...");
condensedBinsMapChannels = calculateCondensedBinsChannels0(getImageDataset());
allPixelValuesRangeChannels = calculateAllPixelValuesRangeChannels0(getImageDataset());
}
};
AsynchClientTask updateDisplayTask = new AsynchClientTask("Updating display...", AsynchClientTask.TASKTYPE_SWING_BLOCKING) {
@Override
public void run(Hashtable<String, Object> hashTable) throws Exception {
if (getClientTaskStatusSupport() != null) {
getClientTaskStatusSupport().setProgress(100);
}
updateUnderlayHistogramDisplay();
}
};
if (calculateCurrentSize() > 2000000) {
// show update progress only if large
ClientTaskDispatcher.dispatch(overlayEditorPanelJAI, new Hashtable<String, Object>(), new AsynchClientTask[] { smoothTask, updateDisplayTask }, true, true, null, true);
} else {
ClientTaskDispatcher.dispatch(overlayEditorPanelJAI, new Hashtable<String, Object>(), new AsynchClientTask[] { smoothTask, updateDisplayTask });
}
}
use of org.vcell.util.ProgressDialogListener in project vcell by virtualcell.
the class ImageJHelper method vcellSendImage.
public static void vcellSendImage(final Component requester, final PDEDataContext pdeDataContext, SubVolume subvolume, Hashtable<SampledCurve, int[]>[] membraneTables, String description, double[] timePoints, String[] channelDescriptions, int[] colormap) throws Exception {
// xyz, 1 time, 1 var
final ImageJConnection[] imageJConnectionArr = new ImageJConnection[1];
AsynchClientTask sendImageTask = new AsynchClientTask("Send image to ImageJ...", AsynchClientTask.TASKTYPE_NONSWING_BLOCKING) {
@Override
public void run(Hashtable<String, Object> hashTable) throws Exception {
try {
ImageJConnection imageJConnection = new ImageJConnection(ExternalCommunicator.IMAGEJ);
imageJConnectionArr[0] = imageJConnection;
imageJConnection.openConnection(VCellImageJCommands.vcellSendImage, description);
// send size of the standard 5 dimensions in this order (width, height, nChannels, nSlices, nFrames)
ISize xyzSize = pdeDataContext.getCartesianMesh().getISize();
Extent extent = pdeDataContext.getCartesianMesh().getExtent();
BasicStackDimensions basicStackDimensions = new BasicStackDimensions(xyzSize.getX(), xyzSize.getY(), xyzSize.getZ(), 1, 1);
sendData0(imageJConnection, new HyperStackHelper(basicStackDimensions, extent, true, Float.class.getSimpleName(), null, new int[] { subvolume.getHandle() }, timePoints, channelDescriptions, colormap), pdeDataContext.getDataValues(), "'" + pdeDataContext.getVariableName() + "'" + pdeDataContext.getTimePoint());
sendVolumeDomain0(imageJConnection, pdeDataContext.getCartesianMesh(), null, description);
sendMembraneOutline(imageJConnection, membraneTables);
} catch (Exception e) {
if (e instanceof UserCancelException) {
throw e;
}
e.printStackTrace();
hashTable.put("imagejerror", e);
} finally {
try {
if (imageJConnectionArr[0] != null) {
imageJConnectionArr[0].closeConnection();
}
} catch (Exception e) {
e.printStackTrace();
}
}
}
};
ClientTaskDispatcher.dispatch(requester, new Hashtable<>(), new AsynchClientTask[] { sendImageTask }, false, true, new ProgressDialogListener() {
@Override
public void cancelButton_actionPerformed(EventObject newEvent) {
if (imageJConnectionArr[0] != null) {
imageJConnectionArr[0].closeConnection();
}
}
});
}
Aggregations