Hi Brian,<br><div class="gmail_quote"><div> </div><blockquote style="margin:0pt 0pt 0pt 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex" class="gmail_quote"><br></blockquote><blockquote class="gmail_quote" style="margin:0pt 0pt 0pt 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">

<div class="im">> 2) How do I write a net.imglib2.img.Img to disk as the usual formats<br>
> (jpg, png, tiff) ? You have an ImgOpener but no ImgCloser err, I mean<br>
> ImgWriter.<br>
><br>
<br>
</div>Mark Hiner and Curtis Rueden are working on an ImageSaver:<br>
<br>
<a href="https://github.com/ctrueden/bioformats/blob/imglib-io/components/scifio/src/ome/scifio/img/ImgSaver.java" target="_blank">https://github.com/ctrueden/bioformats/blob/imglib-io/components/scifio/src/ome/scifio/img/ImgSaver.java</a><br>


<br>
Until this is finished, you will have to write data otherwise.<br></blockquote><div> </div></div>In case you hadn't already noticed, the initial version of ImgSaver is now complete and available as part of imglib2-io. Please let us know if you have any questions about it!<br>

<br>Regards,<br>Curtis<br><br><br><div class="gmail_quote">On Thu, Mar 15, 2012 at 6:05 AM, Stephan Saalfeld <span dir="ltr"><<a href="mailto:saalfeld@mpi-cbg.de">saalfeld@mpi-cbg.de</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

Hi Brian,<br>
<div class="im"><br>
> 1) How do I convert an net.imglib2.img.Img to a<br>
> java.awt.image.BufferedImage?<br>
><br>
<br>
</div>There is the interface ScreenImage which can return a BufferedImage<br>
<br>
<a href="http://fiji.sc/cgi-bin/gitweb.cgi?p=imglib.git;a=blob;f=imglib2/core/src/main/java/net/imglib2/display/ScreenImage.java" target="_blank">http://fiji.sc/cgi-bin/gitweb.cgi?p=imglib.git;a=blob;f=imglib2/core/src/main/java/net/imglib2/display/ScreenImage.java</a><br>


<br>
implemented by ARGBScreenImage<br>
<br>
<a href="http://fiji.sc/cgi-bin/gitweb.cgi?p=imglib.git;a=blob;f=imglib2/core/src/main/java/net/imglib2/display/ARGBScreenImage.java" target="_blank">http://fiji.sc/cgi-bin/gitweb.cgi?p=imglib.git;a=blob;f=imglib2/core/src/main/java/net/imglib2/display/ARGBScreenImage.java</a><br>


<br>
and UnsignedByteScreenImage<br>
<br>
<a href="http://fiji.sc/cgi-bin/gitweb.cgi?p=imglib.git;a=blob;f=imglib2/core/src/main/java/net/imglib2/display/UnsignedByteScreenImage.java" target="_blank">http://fiji.sc/cgi-bin/gitweb.cgi?p=imglib.git;a=blob;f=imglib2/core/src/main/java/net/imglib2/display/UnsignedByteScreenImage.java</a><br>


<br>
.  Both are Img themselves, so writing into their pixels changes the<br>
content of the BufferedImage.  You can also map an arbitrary XY-plane of<br>
a RandomAccessibleInterval (Img is one) into such a screen image using<br>
either of the two Projectors:<br>
<br>
<a href="http://fiji.sc/cgi-bin/gitweb.cgi?p=imglib.git;a=blob;f=imglib2/core/src/main/java/net/imglib2/display/XYProjector.java" target="_blank">http://fiji.sc/cgi-bin/gitweb.cgi?p=imglib.git;a=blob;f=imglib2/core/src/main/java/net/imglib2/display/XYProjector.java</a><br>


<br>
<a href="http://fiji.sc/cgi-bin/gitweb.cgi?p=imglib.git;a=blob;f=imglib2/core/src/main/java/net/imglib2/display/XYRandomAccessibleProjector.java" target="_blank">http://fiji.sc/cgi-bin/gitweb.cgi?p=imglib.git;a=blob;f=imglib2/core/src/main/java/net/imglib2/display/XYRandomAccessibleProjector.java</a><br>


<br>
which includes type conversion from your source type into either ARGB or<br>
UnsignedByte using a Converter<br>
<br>
<a href="http://fiji.sc/cgi-bin/gitweb.cgi?p=imglib.git;a=blob;f=imglib2/core/src/main/java/net/imglib2/converter/Converter.java" target="_blank">http://fiji.sc/cgi-bin/gitweb.cgi?p=imglib.git;a=blob;f=imglib2/core/src/main/java/net/imglib2/converter/Converter.java</a><br>


<br>
Default implementations are available, e.g.<br>
<br>
<a href="http://fiji.sc/cgi-bin/gitweb.cgi?p=imglib.git;a=blob;f=imglib2/core/src/main/java/net/imglib2/display/RealARGBConverter.java" target="_blank">http://fiji.sc/cgi-bin/gitweb.cgi?p=imglib.git;a=blob;f=imglib2/core/src/main/java/net/imglib2/display/RealARGBConverter.java</a><br>


<br>
An example how to use it together with ImageJ is here:<br>
<br>
<a href="http://fiji.sc/cgi-bin/gitweb.cgi?p=imglib.git;a=blob;f=imglib2/tests/src/test/java/tests/OpenAndDisplayScreenImage.java;h=77a9dcffee790f6d202c3c730e7588b203a2def2;hb=HEAD" target="_blank">http://fiji.sc/cgi-bin/gitweb.cgi?p=imglib.git;a=blob;f=imglib2/tests/src/test/java/tests/OpenAndDisplayScreenImage.java;h=77a9dcffee790f6d202c3c730e7588b203a2def2;hb=HEAD</a><br>


<div class="im"><br>
<br>
> 2) How do I write a net.imglib2.img.Img to disk as the usual formats<br>
> (jpg, png, tiff) ? You have an ImgOpener but no ImgCloser err, I mean<br>
> ImgWriter.<br>
><br>
<br>
</div>Mark Hiner and Curtis Rueden are working on an ImageSaver:<br>
<br>
<a href="https://github.com/ctrueden/bioformats/blob/imglib-io/components/scifio/src/ome/scifio/img/ImgSaver.java" target="_blank">https://github.com/ctrueden/bioformats/blob/imglib-io/components/scifio/src/ome/scifio/img/ImgSaver.java</a><br>


<br>
Until this is finished, you will have to write data otherwise.<br>
<br>
Best,<br>
Stephan<br>
<div class="HOEnZb"><div class="h5"><br>
<br>
<br>
_______________________________________________<br>
ImageJ-devel mailing list<br>
<a href="mailto:ImageJ-devel@imagej.net">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>
</div></div></blockquote></div><br>