Dear list,<br><br>Apologies if this posting is not in the correct place but I seem to have hit a brick wall in moving to ImgLib2 and ImageJ2.<br><br>I have used ImageJ 1 without the the user interface for a variety of software projects. In Image J to open an Image I would use<br>
<br>Opener opener = new opener();<br>Imageplus imp = opener.openImage("someFile");<br>
imp.show();<br><br>and from there I could perform the processing and change the display etc. <br><br>With a view to moving to imgLib2 and ImageJ2 I have been going through the Javadoc to try to display an image perform more complicated tasks. So I have found this example among others on the Imglib2 site but in the imgLibs package there is no ImageJFunctions anymore.<br>
<br><code>public</code> <code>< T </code><code>extends</code> <code>RealType< T > & NativeType< T > > Example1b() </code><div>
<code> </code><code>throws</code> <code>ImgIOException, IncompatibleTypeException</code></div><div><code> </code><code>{</code></div>
<div><code> </code><code>// define the file to open</code></div><div><code> </code><code>File file = </code><code>new</code> <code>File( </code><code>"DrosophilaWing.tif"</code> <code>);</code></div>
<div> </div><div><code> </code><code>// open with ImgOpener using an ArrayImgFactory, here the return type will be </code></div>
<div><code> </code><code>// defined by the opener</code></div><div><code> </code><code>// the opener will ignore the Type of the ArrayImgFactory</code></div>
<div><code> </code><code>ImgFactory< ? > imgFactory = </code><code>new</code> <code>ArrayImgFactory< T >();</code></div>
<div><code> </code><code>Img< T > image = </code><code>new</code> <code>ImgOpener().openImg( file.getAbsolutePath(), imgFactory );</code></div>
<div> </div><div><code> </code><code>// display it via ImgLib using ImageJ</code></div><div>
<code> </code><code>ImageJFunctions.show( image );</code></div><div> </div><div><code> </code><code>// open with ImgOpener as Float using a CellImgFactory, it will be opened as float </code></div>
<div><code> </code><code>// independent of the type of the image</code></div><div><code> </code><code>// to enforce to open it as FloatType, an instance of FloatType has to be passed along</code></div>
<div><code> </code><code>Img< FloatType > imageFloat = </code><code>new</code> <code>ImgOpener().openImg( file.getAbsolutePath(), </code></div>
<div><code> </code><code>new</code> <code>CellImgFactory< FloatType >( </code><code>10</code> <code>), </code><code>new</code> <code>FloatType() );</code></div>
<div> </div><div><code> </code><code>// display it via ImgLib using ImageJ</code></div><div>
<code> </code><code>ImageJFunctions.show( imageFloat );</code></div><div><code> </code><code>}</code></div>
<br>Ideally I would like to use Swing and get a Canvas containing the image and to be able to put this on a JFrame. I have gone through the ImageJ2 javadoc and I have found a range of classes that seem relevant such as Defaultdataset, SwingSdiImageDisplayViewer, SwingDisplayPanel but I keep running into errors with Services that don't exist because I am probably not using ImageJ2 as intended. <br>
<br>Many thanks <br><br>Padraig Looney<br>Medical Physicist <br>Royal Surrey County Hospital<br> <br><br><br><br>