<div dir="ltr"><div>Hi, Jay and Curtis,<br><br></div><div>Thanks for your explanations, I could implement the triggering of the view. But since this part of the software may change in the future, I just overrode the methods "show(Display<?> display)" ,which originally searches among the different Viewers, and made it create my own viewer. Now I'm attacking pixel drawing, and again, many components seems to interacts with each other. The low-level part of the software seems to have a lot of control over the view. From what I saw, ImageJ proposes an abstraction of the ImageCanvas (which does not seems to hold any pixels) and publish modification of the canvas ( zoom, or drawn pixels ? ) as events, which should be then handled by the view. Am I correct ? I was just wondering : will this whole structure will be also modified in the future when implementing the guideline of the issue #154 ?<br><br></div><div>I implemented my own Canvas that uses JavaFx display elements. I guess I will just find a way to retrieve from the ImageDisplay the DatasetView which is already a pretty useful object.<br><br></div><div>What do you think ?<br><br></div><div>Cheers,<br><br></div><div>Cyril<br></div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">2015-04-08 19:20 GMT+02:00 Curtis Rueden <span dir="ltr"><<a href="mailto:ctrueden@wisc.edu" target="_blank">ctrueden@wisc.edu</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hi Cyril,<div><br></div><div><span class=""><div>> What the difference between the DisplayService, ImageDisplay and</div><div>> ImageDisplayViewer ?</div><div><br></div></span><div>The DisplayService is the service for working with Displays. It is UI agnostic, and should not need to be overridden.</div><div><br></div><div>ImageDisplay is a Display for image objects. These are UI agnostic.</div><div><br></div><div>ImageDisplayViewer is the actual UI-specific implementation (e.g., SwingImageDisplayViewer in imagej-ui-swing), which creates and shows the UI components for the desired ImageDisplay.</div><span class=""><div><br></div><div>> An image is open but who decide of what and how ?</div><div><br></div></span><div>The UIService responds to DisplayCreatedEvents, creating and showing a DisplayViewer for each currently visible UI [1, 2, 3].</div><span class=""><div><br></div><div>> Do I have to overwrite the ImageDisplayService or is it UI agnostic ?</div><div><br></div></span><div>The ImageDisplayService is a convenience service for working specifically with ImageDisplays (rather than the more general Displays). It is UI agnostic, and should not need to be overridden.</div><div><br></div><div>What you need to do is implement a JavaFXImageDisplayViewer, which will then be used to display the UI component that visualizes the image (i.e., the Dataset, which is wrapped in a DatasetView, which is wrapped in an ImageDisplay).</div><div><br></div><div>The current type hierarchy is at least one level too complex. FWIW, it evolved this way so that ImageDisplays could be fully headless [4]. But there are definitely ways to simplify the hierarchy. We will do it before the ImageJ2 data model comes out of beta.</div><div><br></div><div>See also these issues:</div><div>* <a href="https://github.com/scijava/scijava-common/issues/157" target="_blank">https://github.com/scijava/scijava-common/issues/157</a></div><div>* <a href="https://github.com/imagej/imagej-common/issues/12" target="_blank">https://github.com/imagej/imagej-common/issues/12</a></div><div><br></div><div>Regards,</div><div>Curtis</div><div><br></div><div>[1] <a href="https://github.com/scijava/scijava-common/blob/scijava-common-2.40.0/src/main/java/org/scijava/ui/DefaultUIService.java#L373-L380" target="_blank">https://github.com/scijava/scijava-common/blob/scijava-common-2.40.0/src/main/java/org/scijava/ui/DefaultUIService.java#L373-L380</a></div><div>[2] <a href="https://github.com/scijava/scijava-common/blob/scijava-common-2.40.0/src/main/java/org/scijava/ui/AbstractUserInterface.java#L125-L162" target="_blank">https://github.com/scijava/scijava-common/blob/scijava-common-2.40.0/src/main/java/org/scijava/ui/AbstractUserInterface.java#L125-L162</a></div><div>[3] <a href="https://github.com/scijava/scijava-common/blob/scijava-common-2.40.0/src/main/java/org/scijava/ui/DefaultUIService.java#L272-L277" target="_blank">https://github.com/scijava/scijava-common/blob/scijava-common-2.40.0/src/main/java/org/scijava/ui/DefaultUIService.java#L272-L277</a></div><div><br></div><div>[4] <a href="http://trac.imagej.net/ticket/995" target="_blank">http://trac.imagej.net/ticket/995</a></div></div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote"><div><div class="h5">On Tue, Apr 7, 2015 at 11:06 AM, Mongis Cyril <span dir="ltr"><<a href="mailto:cyril.mongis@googlemail.com" target="_blank">cyril.mongis@googlemail.com</a>></span> wrote:<br></div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div class="h5"><div dir="ltr"><div><div><div><div>Hello everyone !<br><br></div>I had to put the project on pause for a couple of week but now I'm back on it. First, thank you for your help. Thanks to you, I succeeded to put the FxUI as prior UI. Also the JavaFX App is started in ImageJ. I could even generate a menu and all. I can call the "Open file" plugin and it uses the JavaFX routines to show the file dialogs and all. It's great. However, not much happens after that. My next questions goes about to the ImageDisplay stack. I have troubles understanding the "call stack" after the image has been open. What the difference between the DisplayService, ImageDisplay and ImageDisplayViewer ? An image is open but who decide of what and how ? Do I have to overwrite the ImageDisplayService or is it UI agnostic ?<br></div><br></div>Cheers<span><font color="#888888"><br><br></font></span></div><span><font color="#888888">Cyril<br><div><div><div><br><br></div></div></div></font></span></div><div><div><div class="gmail_extra"><br><div class="gmail_quote">2015-03-26 18:23 GMT+01:00 Brian Schlining <span dir="ltr"><<a href="mailto:bschlining@gmail.com" target="_blank">bschlining@gmail.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word"><div><p></p></div><div><div style="font-family:Helvetica,Arial;font-size:13px;color:rgba(0,0,0,1.0);margin:0px;line-height:auto">Hi,</div><span> <br><p style="color:#000">On March 26, 2015 at 8:49:21 AM, Mongis Cyril (<a href="mailto:cyril.mongis@googlemail.com" target="_blank">cyril.mongis@googlemail.com</a>) wrote:</p> <div><div><blockquote type="cite" style="color:rgb(0,0,0);font-family:Helvetica,Arial;font-size:13px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><span><div><div></div><div><div dir="ltr"><div><div><br></div>I'm currently embedding ImageJ in one my application but I use JavaFX for the user interface. I would like to channel the image windows, which are created and handled by ImageJ, to JavaFX elements. In other words, when a plugin wants to display an image, this image would be displayed in a JavaFX element.<span> </span></div></div></div></div></span></blockquote></div><p><br></p></div></span></div><div><p></p>
<p>I have some code that may help get you going. The source is under <a href="https://github.com/hohonuuli/assignments-openimaj" target="_blank">https://github.com/hohonuuli/assignments-openimaj</a>. Specifically, you should take a look at the classes in <a href="https://github.com/hohonuuli/assignments-openimaj/tree/master/src/main/java/org/mbari/javafx/scene/image" target="_blank">https://github.com/hohonuuli/assignments-openimaj/tree/master/src/main/java/org/mbari/javafx/scene/image</a></p>
<p>The code there is pretty straightforward. I wrote this code for an image processing course I was taking. You can display an image in a resizable JavaFX Stage likes so:</p>
<pre><code>import java.net.URL;
import org.mbari.javafx.scene.image.*;
JavaFX.namedWindow("My Window",
new URL("<a href="https://upload.wikimedia.org/wikipedia/en/2/24/Lenna.png" target="_blank">https://upload.wikimedia.org/wikipedia/en/2/24/Lenna.png</a>"));
</code></pre>
<p>If you need a reference to the Stage you can do the following after you’ve created it:</p>
<pre><code>Optional<ImageStage> stage = JavaFX.getNamedWindow("My Window");
</code></pre>
<p>Anyway, it will at least give you a starting point. There’s a method that takes a <a href="http://docs.oracle.com/javase/8/javafx/api/javafx/scene/image/Image.html" target="_blank">javafx.scene.image.Image</a> instead of a URL too. You’ll still need to implement a conversion between ImageJ/imglib2 image formats and JavaFX’s Image. There’s also a Swing class the does something similar (e.g. <code>Swing.namedWindow(...)</code> in the project.</p>
<p>Good Luck</p><span><font color="#888888">
<p>–
Brian Schlining</p></font></span></div></div></blockquote></div><br></div>
</div></div><br></div></div><span class="">_______________________________________________<br>
ImageJ-devel mailing list<br>
<a href="mailto:ImageJ-devel@imagej.net" target="_blank">ImageJ-devel@imagej.net</a><br>
<a href="http://imagej.net/mailman/listinfo/imagej-devel" target="_blank">http://imagej.net/mailman/listinfo/imagej-devel</a><br>
<br></span></blockquote></div><br></div>
</blockquote></div><br></div>