本文整理汇总了Java中org.scijava.Context.dispose方法的典型用法代码示例。如果您正苦于以下问题:Java Context.dispose方法的具体用法?Java Context.dispose怎么用?Java Context.dispose使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.scijava.Context
的用法示例。
在下文中一共展示了Context.dispose方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: main
import org.scijava.Context; //导入方法依赖的package包/类
public static void main(String... args) {
final Context context = new Context();
// Remove the Display and Results post-processors to prevent output
// windows from being displayed
final PluginService pluginService = context.service(PluginService.class);
final PluginInfo<SciJavaPlugin> display = pluginService.getPlugin(DisplayPostprocessor.class);
final PluginInfo<SciJavaPlugin> results = pluginService.getPlugin(ResultsPostprocessor.class);
pluginService.removePlugin(display);
pluginService.removePlugin(results);
JupyterService jupyter = context.service(JupyterService.class);
jupyter.runKernel(args);
context.dispose();
}
示例2: main
import org.scijava.Context; //导入方法依赖的package包/类
public static void main(String[] args) throws ScriptException {
// Only for testing purpose
Context context = new Context();
ScriptService scriptService = context.getService(ScriptService.class);
ScriptLanguage scriptLanguage = scriptService.getLanguageByName("python");
ScriptEngine engine = scriptLanguage.getScriptEngine();
Object result = engine.eval("p=999\n555");
System.out.println(result);
scriptService = context.getService(ScriptService.class);
scriptLanguage = scriptService.getLanguageByName("python");
engine = scriptLanguage.getScriptEngine();
result = engine.eval("555");
System.out.println(result);
context.dispose();
}
示例3: main
import org.scijava.Context; //导入方法依赖的package包/类
public static void main(String... args) {
Context context = new Context();
LogService log = context.service(LogService.class);
log.setLevel(LogLevel.INFO);
JupyterService jupyter = context.service(JupyterService.class);
jupyter.installKernel(args);
context.dispose();
}
示例4: main
import org.scijava.Context; //导入方法依赖的package包/类
public static void main(final String[] args) {
// Warning : if run from your IDE the classpath won't be set to your Fiji installation
Context context = new Context();
JupyterService jupyter = context.service(JupyterService.class);
jupyter.runKernel("jython", "info", "");
context.dispose();
}
示例5: convertImg
import org.scijava.Context; //导入方法依赖的package包/类
private static void convertImg(final File file) throws Exception {
final Context c = new Context();
final SCIFIOConfig config =
new SCIFIOConfig().imgOpenerSetImgModes(ImgMode.ARRAY);
final ImgPlus<?> img =
new ImgOpener(c).openImgs(file.getAbsolutePath(), config).get(0);
final String outPath =
file.getParent() + File.separator + "out_" + img.getName();
new ImgSaver(c).saveImg(outPath, img);
c.dispose();
}
示例6: testGenerateAll
import org.scijava.Context; //导入方法依赖的package包/类
@Test
public void testGenerateAll() throws IOException {
// create a context with a minimal command set
final PluginIndex pluginIndex = new PluginIndex() {
@Override
public void discover() {
super.discover();
removeAll(getPlugins(Command.class));
add(pluginInfo(FileNew.class));
add(pluginInfo(FileOpen.class));
add(pluginInfo(FileSave.class));
add(pluginInfo(FileExit.class));
add(pluginInfo(Lion.class));
add(pluginInfo(Tiger.class));
add(pluginInfo(Bear.class));
}
};
final ArrayList<Class<? extends Service>> classes =
new ArrayList<Class<? extends Service>>();
classes.add(AppService.class);
classes.add(CommandService.class);
classes.add(MenuService.class);
final Context context = new Context(classes, pluginIndex);
final ScriptGenerator scriptGen = new ScriptGenerator(context);
final File tempDir =
TestUtils.createTemporaryDirectory("script-generator-");
final File libDir = new File(tempDir, "lib");
final File scriptsDir = new File(libDir, "scripts");
assertTrue(scriptsDir.mkdirs());
final int returnCode = scriptGen.generateAll(tempDir);
context.dispose();
assertEquals(0, returnCode);
final File imagejDir = new File(scriptsDir, "imagej");
assertTrue(imagejDir.isDirectory());
final File fileDir = new File(imagejDir, "File");
assertTrue(fileDir.isDirectory());
final File animalsDir = new File(imagejDir, "\ufeffAnimals");
assertTrue(animalsDir.isDirectory());
assertTrue(new File(fileDir, "New.py").exists());
assertTrue(new File(fileDir, "\ufeffOpen.py").exists());
assertTrue(new File(fileDir, "\ufeff\ufeffSave.py").exists());
assertTrue(new File(fileDir, "\ufeff\ufeff\ufeffExit.py").exists());
assertTrue(new File(animalsDir, "Lion.py").exists());
assertTrue(new File(animalsDir, "\ufeffTiger.py").exists());
assertTrue(new File(animalsDir, "\ufeff\ufeffBear.py").exists());
FileUtils.deleteRecursively(tempDir);
}
示例7: main
import org.scijava.Context; //导入方法依赖的package包/类
public static void main(String... args) {
String pythonBinaryPath = "/home/hadim/local/conda/bin/python";
Context context = new Context();
JupyterService jupyter = context.service(JupyterService.class);
ScriptService scriptService = context.service(ScriptService.class);
//jupyter.installKernel("groovy", "info", pythonBinaryPath);
System.out.println(scriptService.getLanguages());
context.dispose();
}