use of qupath.lib.plugins.workflow.SimplePluginWorkflowStep in project qupath by qupath.
the class WorkflowCommandLogView method runWorkflowStepInteractively.
/**
* Launch a plugin dialog for a specified WorkflowStep.
*
* TODO: Run any scriptable step
*
* @param qupath
* @param step
*/
@SuppressWarnings({ "unchecked", "rawtypes" })
private static void runWorkflowStepInteractively(final QuPathGUI qupath, final WorkflowStep step) {
ImageData<BufferedImage> imageData = qupath.getImageData();
if (imageData == null) {
Dialogs.showNoImageError("Run workflow step");
return;
}
if (step instanceof SimplePluginWorkflowStep) {
if (step instanceof SimplePluginWorkflowStep) {
SimplePluginWorkflowStep pluginStep = (SimplePluginWorkflowStep) step;
String pluginClassName = pluginStep.getPluginClass();
PathPlugin<BufferedImage> plugin = null;
try {
Class<? extends PathPlugin> cls = (Class<? extends PathPlugin>) Class.forName(pluginClassName);
plugin = qupath.createPlugin(cls);
Map<String, ?> parameterMap = pluginStep.getParameterMap();
String arg = null;
if (parameterMap != null && !parameterMap.isEmpty()) {
arg = ParameterList.getParameterListJSON(parameterMap, " ");
}
qupath.runPlugin(plugin, arg, true);
} catch (ClassNotFoundException e1) {
Dialogs.showErrorNotification("Plugin class not found", "No plugin class found with name " + pluginClassName);
} catch (Exception e1) {
Dialogs.showErrorNotification("Plugin error", "Error running plugin " + plugin.getName() + " - see log for details");
logger.error(e1.getLocalizedMessage(), e1);
}
}
} else if (step instanceof ScriptableWorkflowStep) {
// TODO: Run command script
}
}
use of qupath.lib.plugins.workflow.SimplePluginWorkflowStep in project qupath by qupath.
the class TMADearrayerPluginIJ method addWorkflowStep.
@Override
protected void addWorkflowStep(final ImageData<BufferedImage> imageData, final String arg) {
WorkflowStep step = new SimplePluginWorkflowStep(getName(), (Class<? extends PathPlugin<?>>) getClass(), arg, "if (!isTMADearrayed()) {\n\t", "\n\treturn;\n}");
imageData.getHistoryWorkflow().addStep(step);
logger.info("{}", step);
}
use of qupath.lib.plugins.workflow.SimplePluginWorkflowStep in project qupath by qupath.
the class AbstractPlugin method addWorkflowStep.
/**
* Add a workflow step to the ImageData indicating the argument that this plugin was run with.
*
* Subclasses may override this if a better workflow step should be logged.
*
* A subclass may also override this to avoid adding a workflow step at all.
*
* @param imageData
* @param arg
*/
protected void addWorkflowStep(final ImageData<T> imageData, final String arg) {
@SuppressWarnings("unchecked") WorkflowStep step = new SimplePluginWorkflowStep(getName(), (Class<? extends PathPlugin<T>>) getClass(), arg);
imageData.getHistoryWorkflow().addStep(step);
logger.debug("Adding workflow step: {}", step);
}
Aggregations