Hi Brian & everyone, > there is currently a bug in ImgSaver preventing things from working ... > We are working on a fix now and will reply back when the bug is > resolved.
Just a quick update that ImgSaver of scifio-0.7.3 is working better. The following code now produces a multi-page TIFF as expected: --snip-- import io.scif.SCIFIO; import io.scif.img.ImgOpener; import io.scif.img.ImgOptions; import io.scif.img.ImgOptions.ImgMode; import io.scif.img.ImgSaver; import net.imglib2.meta.ImgPlus; public class WriteAnImgPlus { public static void main(final String... args) throws Exception { final SCIFIO scifio = new SCIFIO(); final ImgOpener opener = new ImgOpener(scifio.getContext()); // NB: ImgSaver only supports PlanarImg for now! final ImgOptions options = new ImgOptions().setImgModes(ImgMode.PLANAR); final ImgPlus<?> imgPlus = opener.openImg("stack&axes=X,Y,Z&lengths=128,128,10.fake", options); System.out.println("imgPlus = " + imgPlus); System.out.println("numDimensions = " + imgPlus.numDimensions()); for (int d=0; d<imgPlus.numDimensions(); d++) { System.out.println("dim #" + d + " = " + imgPlus.dimension(d)); System.out.println("axis #" + d + " = " + imgPlus.axis(d).type()); } final ImgSaver saver = new ImgSaver(scifio.getContext()); saver.saveImg("stack.tif", (ImgPlus) imgPlus); } } --snap-- As of this writing, please note that you will only be able to save as OME-TIFF if you include the ome-formats library [1] plus dependencies on your classpath. Regards, Curtis [1] https://github.com/scifio/ome-formats On Thu, Oct 24, 2013 at 1:14 PM, Curtis Rueden <ctrue...@wisc.edu> wrote: > Hi Brian, > > Apologies for the long delay in reply. It is better to write to a public > mailing list. I am CCing imagej-devel. > > > Is the following code snippet still correct given recent changes?? > > > > AxisType[] ax = new AxisType[3]; ax[0]=Axes.X; ax[1]=Axes.Y; > > ax[2]=Axes.Z; > > > > ImgPlus<T> imgPlus = new ImgPlus<T>(image, name, ax); > > > > new ImgSaver().saveImg("name.ome.tif", imgPlus); > > Firstly, as an aside, please note that ImgSaver has moved from the > net.imglib2:imglib2-io project into io.scif:scifio core. > > But yes, the above code is still supposed to work. > > However, in practice there is currently a bug in ImgSaver preventing > things from working correctly. > > Here is a complete (non-)working example: > https://gist.github.com/ctrueden/6234396 > > We are working on a fix now and will reply back when the bug is resolved. > > Regards, > Curtis > > > On Tue, Aug 13, 2013 at 5:21 AM, Brian Northan <bnort...@gmail.com> wrote: > >> Hi Curtis >> >> So after updating imglib this morning I now get lots of errors. Which is >> expected after your changes. So I suspect after I sort through them and >> rework my code for the changes that saving the axis types will work again. >> >> But one other quick question. Is the ImageJ2 scripting ready for use?? >> I looked at it a bit a while ago but it didn't seem quite ready. I have a >> series of commands I call, so temporarily I just use a bash script calling >> Imagej2 in headless mode, with a utility I wrote to parse command name and >> parameters. Eventually I will switch to the ImageJ scripting... is it >> usable yet or should I wait a few more months? >> >> Thanks, this stuff is really great. >> >> Brian >> >> On Tue, Aug 13, 2013 at 4:46 AM, Brian Northan <bnort...@gmail.com>wrote: >> >>> Hi Curtis >>> >>> I have some simple code to wrap an 3D Img<T> as an ImgPlus, define the >>> axis as x,y and z and then save it. Up until a week or so ago it seemed to >>> work fine. But now when I read back the image it come in as x, y, t. Is >>> the following code snippet still correct given recent changes?? Thanks- >>> Brian >>> >>> AxisType[] ax = new AxisType[3]; >>> ax[0]=Axes.X; >>> ax[1]=Axes.Y; >>> ax[2]=Axes.Z; >>> >>> ImgPlus<T> imgPlus = new ImgPlus<T>(image, name, ax); >>> >>> new ImgSaver().saveImg("name.ome.tif", imgPlus); >>> >>> >>> >>> On Mon, Aug 12, 2013 at 1:39 PM, Curtis Rueden <ctrue...@wisc.edu>wrote: >>> >>>> Hi all, >>>> >>>> > I will merge the img-metadata branch to master on Thursday. >>>> >>>> Got a bit busy in the interim, but img-metadata is now merged to >>>> imglib.git's master branch: >>>> >>>> >>>> https://github.com/imagej/imglib/commit/e4e26aa05e0f42ff1a90e8c6d67235431471de44 >>>> >>>> The commit message gives a quick gist of the changes, including future >>>> directions. >>>> >>>> Please let me know of any questions or problems with it! >>>> >>>> Regards, >>>> Curtis >>>> >>>> >>>> On Tue, Jul 30, 2013 at 10:28 AM, Curtis Rueden <ctrue...@wisc.edu>wrote: >>>> >>>>> Hi all, and especially ImgLib2 developers, >>>>> >>>>> At the ImgLib2 hackathon this past May, I started work on a branch to >>>>> make it easier to attach per-axis metadata to N-dimensional spaces. I >>>>> think >>>>> this branch is finally in a merge-worthy state. >>>>> >>>>> It introduces an AnnotatedSpace extension to EuclideanSpace which lets >>>>> you attach on Axis per dimension. It defines TypedSpace, which declares an >>>>> AxisType for each Axis, as well as a CalibratedSpace, which in addition >>>>> adds a calibration value and optional unit name to the mix. >>>>> >>>>> This approach is much more flexible than the previous CalibratedSpace, >>>>> which has been renamed to OldCalibratedSpace and deprecated until we can >>>>> fully transition all the code away from it. In particular, having the axes >>>>> attached to the space directly will allows Views to maintain the axis >>>>> metadata without much additional work. >>>>> >>>>> Note that these new classes are defined in the net.imglib2.meta >>>>> component, which was split into a separate module called imglib2-meta. The >>>>> ImgPlus class moved there, too (it should have been there all along). So >>>>> merging this branch will cause some code breakage, but all should be >>>>> straightforward to fix: rename usages of CalibratedSpace to >>>>> OldCalibratedSpace, and rename the ImgPlus package from net.imglib2.img to >>>>> net.imglib2.meta. >>>>> >>>>> Going forward, we can also add a CalibratedViews class to the >>>>> net.imglib2.meta package which has some additional features such as >>>>> exposing resampled Imgs from a source CalibratedSpace into a target one >>>>> based on the units used. We can lean on a units library for this, as we >>>>> have discussed in the past. >>>>> >>>>> If interested, you can browse the branch at: >>>>> https://github.com/imagej/imglib/compare/img-metadata >>>>> >>>>> If no one objects, I will merge the img-metadata branch to master on >>>>> Thursday. >>>>> >>>>> Regards, >>>>> Curtis >>>>> >>>>> >>>> >>>> _______________________________________________ >>>> ImageJ-devel mailing list >>>> ImageJ-devel@imagej.net >>>> http://imagej.net/mailman/listinfo/imagej-devel >>>> >>>> >>> >> >
_______________________________________________ ImageJ-devel mailing list ImageJ-devel@imagej.net http://imagej.net/mailman/listinfo/imagej-devel