Posted by
ctrueden on
Dec 02, 2013; 8:41pm
URL: http://imagej.273.s1.nabble.com/Standalone-ImgLib2-usage-tp5005746p5005780.html
Hi Rex,
> is ImgLib2 not intended to be used apart from Fiji etc.
As others have said, ImgLib2 is a standalone project. AFAIK, ImgLib2 does
not have any dependencies on Fiji-specific components at all. The
imglib2-ij component depends on ImageJ1, and the primary image file I/O is
provided by SCIFIO as you discovered. The whole project is intended to be
modular, so that you can cherry pick only the parts that are valuable for
your work without being burdened by the rest.
> But fine--I can use Eclipse.
As Stephan S. says, it should not be necessary to use Eclipse. Stephan P.
just suggested it because in our experience, it works quite well. But one
of the primary reasons for choosing Maven as the project management system
is that it does not force you into any particular IDE.
> My experience so far, trying to stick to ImgLib2 alone, has gone
> something like this:
Thank you for going into specific detail about the problems you
encountered. This sort of feedback is immensely valuable, and furthermore
is the best way for you to get past any bugs and/or roadblocks in your way.
> Tried to save an image file. There are zero examples of saving a
> file.
First of all, please note that both ImgLib2 and SCIFIO are still beta
software. SCIFIO is in the pre-1.0 development stage, and is still under
very heavy development. Many portions of the core API have stabilized, and
we even have quite a few tutorials (
https://github.com/scifio/scifio-tutorials), but many more still need to be
created.
> SCIFIO javadocs are not easily available.
Actually, they are online here:
http://jenkins.imagej.net/job/SCIFIO-javadoc/javadoc/But they weren't really linked obviously from anywhere. I have no linked
them from the main README.md at
https://github.com/scifio/scifio.
> Trial and error revealed something to do with images not being
> PlanarImg.
Yes, unfortunately the ImgSaver still needs to be generalized to support
every kind of Img:
https://github.com/scifio/scifio/issues/34That work will be a priority soon.
> Using the "universal image copy" example didn't work to copy to a
> PlanarImg--the planar image would stay blank.
Hopefully the Img copying code Stephan S. posted will work for you for the
short term...
> SCIFIO then throws exceptions on an Img without telling you it wants
> an ImgPlus.
SCIFIO is supposed to transparently wrap Img objects as ImgPluses without
you needing to worry about it (unless you care about the metadata such as
which axes are which, of course). If that isn't happening for you, please
post a code example and exception so we can help diagnose the problem.
> Another case study: I tried to take a histogram. No examples.
> Methods look straightforward enough, but do nothing.
Are you using the net.imglib2.histogram package? If so, I am not sure which
process method you mean. Could you post a code sample? Also, I agree that
it would be great to have an example here. Care to submit one, once you get
it working? It would really help the developer community.
> Another: I try to take a threshold. No examples of thresholds.
> Classes and methods that contain the word "threshold" are not
> documented.
We implemented support for thresholding in ImageJ2 (on top of ImgLib2 data
structures):
https://github.com/imagej/imagej/tree/imagej-2.0.0-beta-7.5/core/data/src/main/java/imagej/data/thresholdIt still needs work. You are welcome to use it but again, this is beta
software.
Some of the thresholding methods also use histograms computed using
net.imglib2.histogram, so perhaps studying the code might help you
understand the histogram API a bit better; e.g.:
https://github.com/imagej/imagej/blob/imagej-2.0.0-beta-7.5/core/data/src/main/java/imagej/data/autoscale/ConfidenceIntervalAutoscaleMethod.java#L131> It shouldn't be this hard, should it?
ImgLib2 is very complex -- a generalized N-dimensional framework for image
processing turns out to be a ton of work and careful thought to get right.
That said, ImgLib2 needs to have layers of abstraction on top that make the
simple things easy, as well as lots of documentation illustrating how to
perform common tasks. Well-designed software is like a delicious croissant,
with many layers. :-)
It is natural to feel that software is lacking when it does not painlessly
address your personal use cases, but please realize that the breadth of use
cases for projects like ImgLib2, SCIFIO and ImageJ2 is really
staggering. Feedback
and contributions from the community always helps to direct development
priorities, so thanks again for taking the time to write to the list.
Regards,
Curtis
On Sun, Dec 1, 2013 at 8:19 AM, Rex Kerr <
[hidden email]> wrote:
> Hi Stephan,
>
> Thanks for the swift reply!
>
> That only partly helps; it takes care of dependencies, but requires me to
> use Eclipse, which while almost essential for Java is more of an irritation
> to me than useful when using Scala (which I am). But fine--I can use
> Eclipse.
>
> But the dependencies are only part of the issue. I know how to solve all
> of those semi-manually and did (after realizing that the dependencies
> listed on the examples page were incomplete). The bigger problem is that I
> can't figure out how to do much of anything without looking at source code,
> which usually means something in Fiji, which usually depends on more things
> in Fiji.
>
> My experience so far, trying to stick to ImgLib2 alone, has gone something
> like this:
>
> Tried to save an image file. There are zero examples of saving a file.
> SCIFIO javadocs are not easily available. Trial and error revealed
> something to do with images not being PlanarImg. Using the "universal
> image copy" example didn't work to copy to a PlanarImg--the planar image
> would stay blank. SCIFIO then throws exceptions on an Img without telling
> you it wants an ImgPlus. No examples of copying an ImgPlus. Etc..
>
> Another case study: I tried to take a histogram. No examples. Methods
> look straightforward enough, but do nothing. Eventually I notice the
> .process method. No documentation stating that you need to call it or you
> will get zeros (rather than e.g. an exception).
>
> Another: I try to take a threshold. No examples of thresholds. Classes
> and methods that contain the word "threshold" are not documented. Forget
> it and implement it myself.
>
> It shouldn't be this hard, should it?
>
> --Rex
>
>
>
>
> On Sun, Dec 1, 2013 at 5:44 AM, Stephan Preibisch <
[hidden email]
> >wrote:
>
> > Hi Rex,
> >
> > ImgLib2 can be developed and run independent of Fiji. The easiest way is
> to
> >
> > 1) check out the ImgLib2 repository using GIT
> >
https://github.com/imagej/imglib> > 2) Install & Run Eclipse
> > 3) File > Import > Existing Maven Project (then select the directory and
> > choose all the poms that you want, for example all of them)
> >
> > You are good to go, now add these projects as dependency of your project.
> >
> > To get started, try the examples:
http://fiji.sc/ImgLib2_Examples> > You also find them in the submodule (ImgLib2-examples)
> >
> > Hope this helps,
> > Stephan
> > ---
> >
> > Dr. Stephan Preibisch
> > HFSP Fellow
> > Eugene Myers lab / Robert H. Singer
> >
> > MPI-CBG / Albert Einstein College of Medicine / HHMI Janelia Farm
> >
> > email:
[hidden email] /
[hidden email] /
> >
[hidden email]
> > web:
http://www.preibisch.net/> >
> >
> > On Dec 1, 2013, at 14:23 , Rex Kerr wrote:
> >
> > > I've been attempting to use ImgLib2 in a quasi-standalone fashion to
> > > automate some image processing tasks. So far this has been an exercise
> > in
> > > frustration due to a combination of underdocumented dependency on other
> > > libraries for critical functionality (ImageJ/Fiji, SCIFIO, etc.) and
> lack
> > > of documentation of ImgLib2 itself.
> > >
> > > This has been so difficult thus far that I have to wonder if I'm
> missing
> > > some key resource. Before I ask specific questions: what is it that I
> > was
> > > supposed to do? Or is ImgLib2 not intended to be used apart from Fiji
> > etc.
> > > (and a good working knowledge of what ImageJ can do and how it does
> it)?
> > >
> > > --Rex
> > >
> > > --
> > > ImageJ mailing list:
http://imagej.nih.gov/ij/list.html> >
> > --
> > ImageJ mailing list:
http://imagej.nih.gov/ij/list.html> >
>
> --
> ImageJ mailing list:
http://imagej.nih.gov/ij/list.html>
--
ImageJ mailing list:
http://imagej.nih.gov/ij/list.html