@@ -0,0 +1,1652 @@
+%0Apackage net.restlesscoder.sandbox.imagej;%0A%0Aimport net.imagej.ImageJ;%0Aimport net.imagej.ops.OpService;%0Aimport net.imglib2.Dimensions;%0Aimport net.imglib2.FinalDimensions;%0Aimport net.imglib2.RandomAccess;%0Aimport net.imglib2.img.Img;%0Aimport net.imglib2.img.display.imagej.ImageJFunctions;%0Aimport net.imglib2.type.logic.BitType;%0Aimport net.imglib2.view.IntervalView;%0Aimport net.imglib2.view.Views;%0A%0Aimport org.scijava.command.Command;%0Aimport org.scijava.display.DisplayService;%0Aimport org.scijava.plugin.Parameter;%0Aimport org.scijava.plugin.Plugin;%0A%0A/**%0A * From %3Ca href=%22http://forum.imagej.net/t/5068%22%3EDiscrepancy between different%0A * ways of displaying Views%3C/a%3E.%0A *%0A * @author Curtis Rueden%0A */%0A@Plugin(type = Command.class)%0Apublic class ImgViewDisplay implements Command %7B%0A%0A%09@Parameter%0A%09private OpService opService;%0A%0A%09@Parameter%0A%09private DisplayService displayService;%0A%0A%09@Override%0A%09public void run() %7B%0A%0A%09%09final int%5B%5D center = new int%5B%5D %7B 15, 10 %7D;%0A%09%09final Dimensions dims = new FinalDimensions(31, 21);%0A%0A%09%09final Img%3CBitType%3E img = opService.create().img(dims, new BitType());%0A%0A%09%09final RandomAccess%3CBitType%3E ra = img.randomAccess();%0A%09%09ra.setPosition(center);%0A%09%09ra.get().set(true);%0A%0A%09%09displayService.createDisplay(%22original%22, img);%0A%0A%09%09final IntervalView%3CBitType%3E view = Views.interval(img, new long%5B%5D %7B 5, 5 %7D,%0A%09%09%09new long%5B%5D %7B 25, 15 %7D);%0A%09%09ImageJFunctions.show(view, %22view - ImageJFunctions.show()%22);%0A%0A%09%09displayService.createDisplay(%22view - DisplayService.createDisplay()%22, view);%0A%09%7D%0A%0A%09public static void main(final String%5B%5D args) throws Exception %7B%0A%09%09final ImageJ ij = net.imagej.Main.launch(args);%0A%09%09ij.command().run(ImgViewDisplay.class, false);%0A%09%7D%0A%7D%0A

Add MCVE for SciJava display creation discrepancy