use of org.scijava.Context in project imagej-omero by imagej.
the class OmeroIT method setup.
@Before
public void setup() {
client = new omero.client(OMERO_SERVER, OMERO_PORT);
cred = new OMEROCredentials();
cred.setServer(OMERO_SERVER);
cred.setPort(OMERO_PORT);
cred.setUser(OMERO_USER);
cred.setPassword(OMERO_PASSWORD);
context = new Context();
omero = context.getService(OMEROService.class);
}
use of org.scijava.Context in project imagej-omero by imagej.
the class Main method main.
public static void main(final String... args) {
final Context c = new Context();
c.service(UIService.class).showUI();
c.service(CommandService.class).run(OpenImageFromOMERO.class, true);
}
use of org.scijava.Context in project imagej-omero by imagej.
the class ScriptGeneratorTest method testGenerateAll.
@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);
}
use of org.scijava.Context in project imagej-ops by imagej.
the class SliceTest method setUp.
@Override
@Before
public void setUp() {
context = new Context(OpService.class);
ops = context.service(OpService.class);
in = ArrayImgs.bytes(20, 20, 21);
out = ArrayImgs.bytes(20, 20, 21);
for (final Cursor<ByteType> cur = in.cursor(); cur.hasNext(); ) {
cur.fwd();
cur.get().set((byte) cur.getIntPosition(2));
}
}
use of org.scijava.Context in project imagej-ops by imagej.
the class Main method main.
// -- Main method --
public static void main(final String[] args) throws IOException {
final Context context = new Context(OpService.class);
final OpService ops = context.getService(OpService.class);
new EvaluatorConsole(new OpEvaluator(ops)).showConsole();
}
Aggregations