org.scijava.command.CommandService Java Examples

The following examples show how to use org.scijava.command.CommandService. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: SnippetCreator.java    From Scripts with GNU General Public License v3.0 6 votes vote down vote up
/**
 * This method is called when the plugin is loaded. See
 * {@link ij.plugin.PlugIn#run(java.lang.String)} Prompts user for a new
 * snippet that will be saved in {@code BAR/My_Routines/}
 *
 * @param arg
 *            ignored (Otherwise specified in plugins.config).
 */
@Override
public void run(final String arg) {
	Utils.shiftClickWarning();
	if (new GuiUtils().getFileCount(Utils.getLibDir()) == 0) {
		final YesNoCancelDialog query = new YesNoCancelDialog(null, "Install lib Files?",
				"Some of the code generated by this plugin assumes the adoption\n"
						+ "of centralized lib files, but none seem to exist in your local directory\n" + "("
						+ Utils.getLibDir() + ")\nWould you like to install them now?");
		if (query.cancelPressed()) {
			return;
		} else if (query.yesPressed()) {
			final Context context = (Context) IJ.runPlugIn("org.scijava.Context", "");
			final CommandService commandService = context.getService(CommandService.class);
			commandService.run(Installer.class, true);
			return;
		}
	}
	if (showDialog()) {
		if (sContents.length()>0)
			saveAndOpenSnippet();
		else
			IJ.showStatus(sFilename +" was empty. No file was saved...");
	}

}
 
Example #2
Source File: RunningOpAsCommandTest.java    From imagej-ops with BSD 2-Clause "Simplified" License 5 votes vote down vote up
@Test
public void testRunCommand() throws InterruptedException, ExecutionException {
	final CommandService cs = context.service(CommandService.class);
	final CommandModule module = cs.run(Fibonacci.class, true, "n", 7).get();
	final int result = (Integer) module.getOutput("result");
	assertEquals(13, result);
}
 
Example #3
Source File: SceneRiggingDemo.java    From sciview with BSD 2-Clause "Simplified" License 3 votes vote down vote up
public static void main(String... args) throws Exception {
    SciView sv = SciView.create();

    CommandService command = sv.getScijavaContext().getService(CommandService.class);

    HashMap<String, Object> argmap = new HashMap<String, Object>();

    command.run(SceneRiggingDemo.class, true, argmap);
}
 
Example #4
Source File: ExportN5.java    From sciview with BSD 2-Clause "Simplified" License 3 votes vote down vote up
public static void main(String... args) throws Exception {
    SciView sv = SciView.create();

    CommandService command = sv.getScijavaContext().getService(CommandService.class);

    HashMap<String, Object> argmap = new HashMap<>();

    command.run(MeshDemo.class, true, argmap);

    argmap.put("n5File", "/tmp/sciview/test.n5");
    argmap.put("dataset", "/testMesh");
    Thread.sleep(1000);

    command.run(ExportN5.class, true, argmap);
}
 
Example #5
Source File: ImagePlaneDemo.java    From sciview with BSD 2-Clause "Simplified" License 3 votes vote down vote up
public static void main(String... args) throws Exception {
    SciView sv = SciView.create();

    CommandService command = sv.getScijavaContext().getService(CommandService.class);

    HashMap<String, Object> argmap = new HashMap<>();

    command.run(ImagePlaneDemo.class, true, argmap);
}
 
Example #6
Source File: ParticleDemo.java    From sciview with BSD 2-Clause "Simplified" License 3 votes vote down vote up
public static void main(String... args) throws Exception {
    SciView sv = SciView.create();

    CommandService command = sv.getScijavaContext().getService(CommandService.class);

    HashMap<String, Object> argmap = new HashMap<>();

    command.run(ParticleDemo.class, true, argmap);
}
 
Example #7
Source File: Line3DDemo.java    From sciview with BSD 2-Clause "Simplified" License 3 votes vote down vote up
public static void main(String... args) throws Exception {
    SciView sv = SciView.create();

    CommandService command = sv.getScijavaContext().getService(CommandService.class);

    HashMap<String, Object> argmap = new HashMap<>();

    command.run(Line3DDemo.class, true, argmap);
}
 
Example #8
Source File: GameOfLife3D.java    From sciview with BSD 2-Clause "Simplified" License 3 votes vote down vote up
public static void main(String... args) throws Exception {
    SciView sv = SciView.create();

    CommandService command = sv.getScijavaContext().getService(CommandService.class);

    HashMap<String, Object> argmap = new HashMap<>();

    command.run(GameOfLife3D.class, true, argmap);
}
 
Example #9
Source File: TextDemo.java    From sciview with BSD 2-Clause "Simplified" License 3 votes vote down vote up
public static void main(String... args) throws Exception {
    SciView sv = SciView.create();

    CommandService command = sv.getScijavaContext().getService(CommandService.class);

    HashMap<String, Object> argmap = new HashMap<>();

    command.run(TextDemo.class, true, argmap);
}
 
Example #10
Source File: MeshDemo.java    From sciview with BSD 2-Clause "Simplified" License 3 votes vote down vote up
public static void main(String... args) throws Exception {
    SciView sv = SciView.create();

    CommandService command = sv.getScijavaContext().getService(CommandService.class);

    HashMap<String, Object> argmap = new HashMap<>();

    command.run(MeshDemo.class, true, argmap);
}
 
Example #11
Source File: MeshTextureDemo.java    From sciview with BSD 2-Clause "Simplified" License 3 votes vote down vote up
public static void main(String... args) throws Exception {
    SciView sv = SciView.create();

    CommandService command = sv.getScijavaContext().getService(CommandService.class);

    HashMap<String, Object> argmap = new HashMap<>();

    command.run(MeshTextureDemo.class, true, argmap);
}
 
Example #12
Source File: VolumeTimeseriesDemo.java    From sciview with BSD 2-Clause "Simplified" License 3 votes vote down vote up
public static void main(String... args) throws Exception {
        SciView sv = SciView.create();

//        ImageJ imagej = new ImageJ(sv.getScijavaContext());
//        imagej.ui().showUI();

        CommandService command = sv.getScijavaContext().getService(CommandService.class);

        HashMap<String, Object> argmap = new HashMap<String, Object>();

        command.run(VolumeTimeseriesDemo.class, true, argmap);
    }
 
Example #13
Source File: VolumeRenderDemo.java    From sciview with BSD 2-Clause "Simplified" License 3 votes vote down vote up
public static void main(String... args) throws Exception {
    SciView sv = SciView.create();

    CommandService command = sv.getScijavaContext().getService(CommandService.class);

    HashMap<String, Object> argmap = new HashMap<String, Object>();
    argmap.put("iso",true);

    command.run(VolumeRenderDemo.class, true, argmap);
}
 
Example #14
Source File: LineDemo.java    From sciview with BSD 2-Clause "Simplified" License 3 votes vote down vote up
public static void main(String... args) throws Exception {
    SciView sv = SciView.create();

    CommandService command = sv.getScijavaContext().getService(CommandService.class);

    HashMap<String, Object> argmap = new HashMap<>();

    command.run(LineDemo.class, true, argmap);
}
 
Example #15
Source File: BDVSlicingDemo.java    From sciview with BSD 2-Clause "Simplified" License 3 votes vote down vote up
public static void main(String... args) throws Exception {
    SciView sv = SciView.create();

    CommandService command = sv.getScijavaContext().getService(CommandService.class);

    HashMap<String, Object> argmap = new HashMap<String, Object>();

    command.run(BDVSlicingDemo.class, true, argmap);
}
 
Example #16
Source File: ShowSegmentationDemo.java    From sciview with BSD 2-Clause "Simplified" License 3 votes vote down vote up
public static void main(String... args) throws Exception {
    SciView sv = SciView.create();

    CommandService command = sv.getScijavaContext().getService(CommandService.class);

    HashMap<String, Object> argmap = new HashMap<String, Object>();

    command.run(ShowSegmentationDemo.class, true, argmap);
}
 
Example #17
Source File: MultiMeshDemo.java    From sciview with BSD 2-Clause "Simplified" License 3 votes vote down vote up
public static void main(String... args) throws Exception {
    SciView sv = SciView.create();

    CommandService command = sv.getScijavaContext().getService(CommandService.class);

    HashMap<String, Object> argmap = new HashMap<>();

    command.run(MultiMeshDemo.class, true, argmap);
}