Posted by
Stephan Saalfeld on
Dec 01, 2013; 4:26pm
URL: http://imagej.273.s1.nabble.com/Standalone-ImgLib2-usage-tp5005746p5005749.html
Hi Rex,
maven is independent from Eclipse. Eclipse just has a reasonably
working plugin for it. That is, you can use maven to compile/resolve
dependencies independently of eclipse. This looks like a staring point
how to setup your Scala project using maven:
http://www.scala-lang.org/old/node/347It's most likely simple after done once and, I am certain, will trigger
some tantrums before you accept that maven is only easy if you adjust to
their thinking...
Regarding saving:
To my knowledge, scifio's ImgSaver is indeed limited to PlanarImgs,
which is what's needed for ImageJ(2). That is, if using something else,
you would memcopy first. General purpose copy method without
considering optimized iteration orders:
<T extends Type<T>> void copy(
RandomAccessibleInterval<T> source,
RandomAccessibleInterval<T> target) {
Cursor<T> src = Views.flatIterable(source).cursor();
Cursor<T> trg = Views.flatIterable(target).cursor();
while (src.hasNext())
trg.next().set(src.next());
}
Tobias Pietzsch has developed an HDF5 backend but this isn't yet a
general purpose saver/opener. If interested, start searching here:
https://github.com/tpietzsch/spimviewer/tree/master/src/main/java/creatorRegarding documentation:
Chronicle lack thereof is a known issue. JavaDoc is ok though in many
places. Nobody has time and we depend on contribution of those who
suffered through and succeeded. The place for contributing is the
Fiji-Wiki under category ImgLib
http://fiji.sc/Category:ImgLibIncluding everything that does not depend on Fiji but is ImgLib2 only.
Please contribute if you learn something that was hard to find out.
Sorry if the experience has been frustrating so far.
All the best,
Stephan
On Sun, 2013-12-01 at 06:19 -0800, Rex Kerr 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