Standalone ImgLib2 usage

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
13 messages Options
Reply | Threaded
Open this post in threaded view
|

Standalone ImgLib2 usage

Rex Kerr
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
Reply | Threaded
Open this post in threaded view
|

Re: Standalone ImgLib2 usage

Stephan Preibisch
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
Reply | Threaded
Open this post in threaded view
|

Re: Standalone ImgLib2 usage

Rex Kerr
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
Reply | Threaded
Open this post in threaded view
|

Re: Standalone ImgLib2 usage

Stephan Saalfeld
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/347

It'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/creator


Regarding 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:ImgLib

Including 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
Reply | Threaded
Open this post in threaded view
|

Re: Standalone ImgLib2 usage

dscho
In reply to this post by Rex Kerr
Hi Rex,

On Sun, 1 Dec 2013, 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)?

This is a subject about which I can provide helpful information --
including what state the different components are in and what the
relations are among them, but I will reply tomorrow (I need to scale back
on internet usage on Sundays).

Ciao,
Johannes

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: Standalone ImgLib2 usage

ctrueden
In reply to this post by Rex Kerr
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/34

That 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/threshold

It 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
Reply | Threaded
Open this post in threaded view
|

Re: Standalone ImgLib2 usage

dscho
In reply to this post by Rex Kerr
Hi Rex,

On Sun, 1 Dec 2013, 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.

Just to clarify (since that might be lost otherwise in the extensive
information you received from other people): ImgLib2 is under heavy
development, its primary purpose being to serve the needs of the ImgLib2
team (Stephan Saalfeld, Stephan Preibisch and Tobias Pietzsch) and to
cater to ImageJ2 and KNIME.

As such, ImgLib2 has proved to be incredibly powerful, but necessarily at
the expense of documentation that makes it easy for others to get started
with using ImgLib2.

Also: While ImgLib2 is used in ImageJ2, KNIME, Fiji and SCIFIO, it is a
*dependency* thereof, not a dependencee [*1*].

> This has been so difficult thus far that I have to wonder if I'm missing
> some key resource.

The biggest key resource you missed until you wrote this mail was the
mailing list. The community is really *the* strength of ImageJ (and by
extension, ImgLib2).

> Before I ask specific questions: what is it that I was supposed to do?

You did the right thing: raise your issues here.

> 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)?

Eventually, no knowledge of ImageJ 1.x will be required at all to use
ImgLib2 efficiently. Nor is knowledge about Fiji or ImageJ2 essential.
KNIME uses ImgLib2 entirely without relying on ImageJ 1.x, Fiji or
ImageJ2.

Practically speaking, most of the developers using ImgLib2 have been
exposed to ImageJ 1.x, therefore it does not hurt to understand the latter
in order to understand the former.

But as I said, in the future this will be a thing of the past.

However, please keep in mind that as enthusiastic as the ImgLib2
developers are (both core team and contributors), our days have 24 hours
just as yours and while we strive to help users such as yourself, we
simply cannot spend most of our time to write tutorials (although there
are quite some, as pointed out by others: http://imglib2.net/). We have to
use most of our time to develop ImgLib2 for use in our research.

This is where you come in: ask the questions you need answers for, and
then write documentation helping others in turn. The ImgLib2 website is
actually a Wiki, you can easily register and extend/improve it.

I would be interested in particular in a description how to use ImgLib2 in
conjunction with Scala, for there are quite a few Scala fans out there
(just as yourself), requiring image processing and analysis.

And now, as promised, the overview of the involved components/projects:

ImgLib2
        actually consists of a couple of subprojects. Developed mainly by
        above-mentioned trio, it is separated into

        core (data structures and interfaces),
        three algorithm packages (mainly differing in licensing, as there are a
                few that need to be under GPL),
        ops (to be reworked massively in the near future, don't use it yet),
        realtransform (for coordinate transformations),
        meta (for metadata, such as axis types),
        io (soon to be replaced by SCIFIO completely),
        ui (hopefully soon to be reconciled with parts of ImageJ2), and
        ij (for interacting with ImageJ 1.x' data structures -- insofar
                possible)

SCIFIO
        *the* I/O to be used with ImgLib2. SCIFIO's extensible design
        makes it very easy to add drop-in support for additional file
        formats and decouples ImgLib2 nicely from the many implementation
        details of the many, many file formats out there

Fiji, ImageJ2, KNIME
        users of ImgLib2, to be used as examples in your case, not as
        dependencies

While it is true that most of the developers who work with ImgLib2 use
Eclipse (it is kind of *the* standard when working with Java projects, to
complain about it just means to lose a lot of hot air, not that I am not
guilty of that myself...), by no means you are bound to use it.

ImgLib2 is actually maintained as a set of Maven projects; Eclipse is just
a convenient way to work with them.

In fact, you do not even need to use Maven -- unless you want to --
because you can easily interact with the Maven repositories without using
Maven. For example, Fiji and part of our Jenkins jobs use this shell
script (in conjunction with curl to retrieve files from the website
interface of the ImageJ2 Maven repository) to download specified artifacts:

        https://github.com/scijava/scijava-common/blob/master/bin/maven-helper.sh

There is also a minimal drop-in replacement we developed for users who do
not need the full power of Maven but just want to build a Java project
adhering to pretty strict standards: MiniMaven. This is, in fact, what
ImageJ2's script editor (and also Fiji's default Build.sh) use to build
artifacts and download/install dependencies.

In case you do not want to bother with Maven, MiniMaven, or
maven-helper.sh, but also insist on not downloading each and every
component manually, you can still just use Maven to *download* the .jar
files: After

        git clone https://github.com/imagej/imglib/
        cd imglib/examples
        mvn dependency:copy-dependencies

all the dependencies used by the ImgLib2 examples will be in the
target/dependency/ subdirectory of imglib/examples/.

Speaking of the examples: in many cases, they are more helpful than
reading the source of the ImgLib2 libraries themselves, and "git grep" is
a very powerful tool to query the examples for hints.

Ciao,
Johannes

Footnote *1*: technically, there is some code in ImgLib2 that uses SCIFIO
as a dependency, but that is by no means ImgLib2 code you need to use,
except as a reference how to do things.

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: Standalone ImgLib2 usage

Rex Kerr
Thanks all for the responses, especially those from Curtis and Johannes!  I
appreciate all the time that went into them; that was enough to get me over
the sticking points that were making several ought-to-be-trivial tasks
apparently impossible.

I think my initial foray was worse than expected due to bad luck with the
snapshot of Fiji that I downloaded.  Using the dependencies for the current
imglib2 examples at least gives me a copy of SCIFIO that can save something
other than a jpg without throwing exceptions.  (I also tried building the
latest SCIFIO from source, but that was binary incompatible with everything
else.)  I should also have explained that my initial exasperation was in
large part because I had done the exact same automation with my own tools
plus Apache Commons plus jtransforms in literally 1/10th of the coding time
that it took me to not even get something working with ImgLib2; the reason
I wanted to use ImgLib2 was to make installation less clunky for others who
might want to use my code, and to keep me from having to maintain my random
set of personal tools.

For Curtis specifically, here is what I used (in Scala) to generate a
histogram:

  val hbm = new IntBinMapper[UnsignedByteType](0.ub, 255.ub)
  val h = new Histogram(hbm, im)
  h.process
  val ha = h.getHistogram

where .ub is an extension method (effectively) that wraps integers as
UnsignedByteType.  And, since it's Scala, types are inferred in most places.

If I'd had Curtis' example first, I'd have tried using
histogram.Histogram1d, but there's no indication which is the "right" one
to use, and algorithm.stats.Histogram seemed to have the simpler API.
 Except that it doesn't document the necessity of calling .process; if you
omit that line, h.getHistogram returns an array of zeros.

Note that none of my problems were caused by any of the interesting
capabilities or design of ImgLib2.  It was all bugs, missing features, or
lack of documentation.  In a way, that's good; it suggests that the
fundamental concepts are sound and can be picked up fairly quickly by at
least some people.  But I would add, respectfully, that giving new users a
poor initial experience due to bugs and lack of documentation is not the
best way to get them to be members of the community and to contribute.  (In
that vein, note that "getting started" doesn't tell you how to get started
but assumes you're ready to start compiling successfully, and "introduction
and required files" in examples doesn't give a complete list of the
required files.)

Thanks again to those who took time to get me back on track.

I will direct any further questions I have to some -devel list, as the
content will probably be more appropriate there.

  --Rex

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: Standalone ImgLib2 usage

Albert Cardona-2
Hi Rex,

Two years on, I wonder if you successfully pushed through and are you now
using ImgLib2?

When ImgLib (v1) was created, its sheer "otherness" led me to create a
simple wrapper library for scripting it, abstracting away all its internal
oddities as fast as I could grasp them. Unfortunately for practical reasons
that library is bound to Fiji, and is currently considered obsolete, using
still ImgLib 1 (even though it works very well). An updated version to
ImgLib2 exists partially but I never finished some aspects of it--the I/O
was being rewritten and only now it would be a good time to revisit it to
finalize it.

All the best,

Albert



2013-12-04 6:42 GMT-05:00 Rex Kerr <[hidden email]>:

> Thanks all for the responses, especially those from Curtis and Johannes!  I
> appreciate all the time that went into them; that was enough to get me over
> the sticking points that were making several ought-to-be-trivial tasks
> apparently impossible.
>
> I think my initial foray was worse than expected due to bad luck with the
> snapshot of Fiji that I downloaded.  Using the dependencies for the current
> imglib2 examples at least gives me a copy of SCIFIO that can save something
> other than a jpg without throwing exceptions.  (I also tried building the
> latest SCIFIO from source, but that was binary incompatible with everything
> else.)  I should also have explained that my initial exasperation was in
> large part because I had done the exact same automation with my own tools
> plus Apache Commons plus jtransforms in literally 1/10th of the coding time
> that it took me to not even get something working with ImgLib2; the reason
> I wanted to use ImgLib2 was to make installation less clunky for others who
> might want to use my code, and to keep me from having to maintain my random
> set of personal tools.
>
> For Curtis specifically, here is what I used (in Scala) to generate a
> histogram:
>
>   val hbm = new IntBinMapper[UnsignedByteType](0.ub, 255.ub)
>   val h = new Histogram(hbm, im)
>   h.process
>   val ha = h.getHistogram
>
> where .ub is an extension method (effectively) that wraps integers as
> UnsignedByteType.  And, since it's Scala, types are inferred in most
> places.
>
> If I'd had Curtis' example first, I'd have tried using
> histogram.Histogram1d, but there's no indication which is the "right" one
> to use, and algorithm.stats.Histogram seemed to have the simpler API.
>  Except that it doesn't document the necessity of calling .process; if you
> omit that line, h.getHistogram returns an array of zeros.
>
> Note that none of my problems were caused by any of the interesting
> capabilities or design of ImgLib2.  It was all bugs, missing features, or
> lack of documentation.  In a way, that's good; it suggests that the
> fundamental concepts are sound and can be picked up fairly quickly by at
> least some people.  But I would add, respectfully, that giving new users a
> poor initial experience due to bugs and lack of documentation is not the
> best way to get them to be members of the community and to contribute.  (In
> that vein, note that "getting started" doesn't tell you how to get started
> but assumes you're ready to start compiling successfully, and "introduction
> and required files" in examples doesn't give a complete list of the
> required files.)
>
> Thanks again to those who took time to get me back on track.
>
> I will direct any further questions I have to some -devel list, as the
> content will probably be more appropriate there.
>
>   --Rex
>
> --
> ImageJ mailing list: http://imagej.nih.gov/ij/list.html
>



--
http://albert.rierol.net
http://www.janelia.org/lab/cardona-lab
http://www.ini.uzh.ch/~acardona/

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: Standalone ImgLib2 usage

Avital Steinberg
Hi Albert,
I just noticed your post from October. I can use ImageJ's Java API, ImageJ's macro language and Fiji's Javascript language. I will need to do 3D segmentation and some custom 3D alignments of 3D images, and imgLib2 seems to have some useful methods. However, it looks complicated to use.

Is there a user friendly way of accessing methods from imgLib2? (a user friendly scripting wrapper would be awesome!) Or any other tool with built in segmentation and registration methods that would be possible to learn for someone who can program in Java?

Thanks and happy Thanksgiving,
Avital
Reply | Threaded
Open this post in threaded view
|

Re: Standalone ImgLib2 usage

Albert Cardona-2
Hi Avital,

For custom registration, I'd use the mpicbg library, which has most if not
all functionality that you'll need, like e.g. ability to define a 3D
transform by a bunch of point correspondences and then map a 3D image
through it. Fiji has it included. The source code is here:
https://github.com/axtimwalde/mpicbg

For automated 3D segmentation there aren't any great options within Fiji. I
suggest using the ilastik software: http://ilastik.org/

As for scripting ImgLib2: if you know java, I'd use it directly. It's quite
straightforward really; cursors abstract it all for you. Read this paper,
particularly the supplemental code examples:
http://bioinformatics.oxfordjournals.org/content/28/22/3009.long

Best,

Albert


2015-11-27 14:36 GMT-05:00 Avital Steinberg <[hidden email]>:

> Hi Albert,
> I just noticed your post from October. I can use ImageJ's Java API,
> ImageJ's
> macro language and Fiji's Javascript language. I will need to do 3D
> segmentation and some custom 3D alignments of 3D images, and imgLib2 seems
> to have some useful methods. However, it looks complicated to use.
>
> Is there a user friendly way of accessing methods from imgLib2? (a user
> friendly scripting wrapper would be awesome!) Or any other tool with built
> in segmentation and registration methods that would be possible to learn
> for
> someone who can program in Java?
>
> Thanks and happy Thanksgiving,
> Avital
>
>
>
> --
> View this message in context:
> http://imagej.1557.x6.nabble.com/Standalone-ImgLib2-usage-tp5005746p5015038.html
> Sent from the ImageJ mailing list archive at Nabble.com.
>
> --
> ImageJ mailing list: http://imagej.nih.gov/ij/list.html
>



--
http://albert.rierol.net
http://www.janelia.org/lab/cardona-lab
http://www.ini.uzh.ch/~acardona/

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: Standalone ImgLib2 usage

ctrueden
In reply to this post by Avital Steinberg
Hi Avital,

> Is there a user friendly way of accessing methods from imgLib2? (a
> user friendly scripting wrapper would be awesome!)

The intent is for ImageJ Ops to fulfill that use case. It still has a long
way to go, but we did give a tutorial illustrating how to call Ops from
ImageJ scripts at the last ImageJ conference:

* https://imagej.github.io/presentations/2015-09-04-imagej2-scripting/
* https://vimeo.com/140098817
* https://vimeo.com/140098835

See also:

* http://imagej.net/Ops#Getting_started

That wiki page still needs a lot of fleshing out, though.

Regards,
Curtis

On Fri, Nov 27, 2015 at 1:36 PM, Avital Steinberg <[hidden email]
> wrote:

> Hi Albert,
> I just noticed your post from October. I can use ImageJ's Java API,
> ImageJ's
> macro language and Fiji's Javascript language. I will need to do 3D
> segmentation and some custom 3D alignments of 3D images, and imgLib2 seems
> to have some useful methods. However, it looks complicated to use.
>
> Is there a user friendly way of accessing methods from imgLib2? (a user
> friendly scripting wrapper would be awesome!) Or any other tool with built
> in segmentation and registration methods that would be possible to learn
> for
> someone who can program in Java?
>
> Thanks and happy Thanksgiving,
> Avital
>
>
>
> --
> View this message in context:
> http://imagej.1557.x6.nabble.com/Standalone-ImgLib2-usage-tp5005746p5015038.html
> Sent from the ImageJ mailing list archive at Nabble.com.
>
> --
> ImageJ mailing list: http://imagej.nih.gov/ij/list.html
>

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: Standalone ImgLib2 usage

Avital Steinberg
Thank you, Albert - I read the two page imgLib2 paper, but I overlooked the
supp. material, which looks extremely useful! I'll also try out the mpicbg
library for the 3D transform and Ilastik for 3D segmentation.

Curtis - thanks a lot for the links. I will watch your talk and the second
talk. I updated Fiji - I didn't have the tutorials before. I haven't used
Ops, so I will be happy to learn about them.

I learned a lot from both of you - I wasn't aware of some of the resources
you pointed out,

Avital

On Sat, Nov 28, 2015 at 6:31 AM, Curtis Rueden <[hidden email]> wrote:

> Hi Avital,
>
> > Is there a user friendly way of accessing methods from imgLib2? (a
> > user friendly scripting wrapper would be awesome!)
>
> The intent is for ImageJ Ops to fulfill that use case. It still has a long
> way to go, but we did give a tutorial illustrating how to call Ops from
> ImageJ scripts at the last ImageJ conference:
>
> * https://imagej.github.io/presentations/2015-09-04-imagej2-scripting/
> * https://vimeo.com/140098817
> * https://vimeo.com/140098835
>
> See also:
>
> * http://imagej.net/Ops#Getting_started
>
> That wiki page still needs a lot of fleshing out, though.
>
> Regards,
> Curtis
>
> On Fri, Nov 27, 2015 at 1:36 PM, Avital Steinberg <
> [hidden email]
> > wrote:
>
> > Hi Albert,
> > I just noticed your post from October. I can use ImageJ's Java API,
> > ImageJ's
> > macro language and Fiji's Javascript language. I will need to do 3D
> > segmentation and some custom 3D alignments of 3D images, and imgLib2
> seems
> > to have some useful methods. However, it looks complicated to use.
> >
> > Is there a user friendly way of accessing methods from imgLib2? (a user
> > friendly scripting wrapper would be awesome!) Or any other tool with
> built
> > in segmentation and registration methods that would be possible to learn
> > for
> > someone who can program in Java?
> >
> > Thanks and happy Thanksgiving,
> > Avital
> >
> >
> >
> > --
> > View this message in context:
> >
> http://imagej.1557.x6.nabble.com/Standalone-ImgLib2-usage-tp5005746p5015038.html
> > Sent from the ImageJ mailing list archive at Nabble.com.
> >
> > --
> > 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