complex-valued images in ImageJ2 ?

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

complex-valued images in ImageJ2 ?

Adrian Daerr-2
Hello,

For an image analysis which would benefit from using complex numbers
(Fourrier analysis etc), I downloaded ImageJ2 after I saw that imglib
defines promising ComplexTypes. However I do not manage to naively
create a complex-valued images in an ImageJ2 plugin. Should it be
possible ? Before I fall back to treating real and imaginary components
separately, I would like to know what the current status of complex type
images is in ImageJ2 (creation, processing, viewing ?)?

Some details about what I tried: after easily compiling the
GradientImage example from the simple-commands in the IJ2-doc at

http://developer.imagej.net/writing-imagej2-plugins

I tried to modify this plugin to create a ComplexDoubleType Img object,
using the first example of the ImgLib2 doc at:

http://fiji.sc/ImgLib2_-_Getting_Started

with a ComplexDoubleType in place of the UnsignedByteType and using the
generic ImgFactory instead of the ArrayImageFactory, namely

Img< ComplexDoubleType > img = new ImgFactory< ComplexDoubleType
 >().create( dims, new ComplexDoubleType() );

The plugin compiles and runs (at least up to the dialog asking for width
and height), but nothing happens:
- ImageJ does not automatically display this Img even if I declare it as
output parameter:
   @Parameter(type = ItemIO.OUTPUT) Img< ComplexDoubleType > img;
- I do not see anything either using:
   net.imglib2.img.display.imagej.ImageJFunctions.show( img );
- I see no errors (where do I have to look ?)

The complete source of my plugin-attempt is at
https://gitorious.org/phasegradientimage/phasegradientimage/source/233c74c7932e3d8e469e95e47b7e30cdf5bb7be1:PhaseGradientImage.java

(and can also be cloned as
[hidden email]:phasegradientimage/phasegradientimage.git
)

If ImageJ cannot yet display ComplexType images, but *can* do headless
stuff using imglib that's fine with me, but I am quite confused that I
do not see any errors at all, even if I do stuff that is not permissible
(such as, if I understand the API correctly, calling ArrayImageFactory
with a ComplexDoubleType (i.e. a non-NativeType) as argument). Where are
errors logged ?

Any help appreciated,
Adrian

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

Re: complex-valued images in ImageJ2 ?

Adrian Daerr-2
> I tried to modify this plugin to create a ComplexDoubleType Img
>object, using the first example of the ImgLib2 doc [..] with a
> ComplexDoubleType in place of the UnsignedByteType and using
>the generic ImgFactory instead of the ArrayImageFactory, namely
>
> Img< ComplexDoubleType > img = new ImgFactory< ComplexDoubleType
>>().create( dims, new ComplexDoubleType() );

Sorry, I meant using the generic ListImgFactory which accepts any Type
(ImgFactory is abstract).

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

Re: complex-valued images in ImageJ2 ?

dscho
In reply to this post by Adrian Daerr-2
Hi Adrian,

On Fri, 27 Sep 2013, Adrian Daerr wrote:

> The complete source of my plugin-attempt is at
> https://gitorious.org/phasegradientimage/phasegradientimage/source/233c74c7932e3d8e469e95e47b7e30cdf5bb7be1:PhaseGradientImage.java
>
> (and can also be cloned as
> [hidden email]:phasegradientimage/phasegradientimage.git
> )

That clone address works only if you are the owner. The public clone
address is:

        git://gitorious.org/phasegradientimage/phasegradientimage.git

> If ImageJ cannot yet display ComplexType images,

That is indeed the case!

> but *can* do headless stuff using imglib

I am not quite sure that we handle that case properly in ImageJ2 yet... It
is quite possible that at least some of our operations still rely on being
able to extract a double value from each pixel that definitely contains
all the information (which is not possible with complex-valued images).

> that's fine with me, but I am quite confused that I do not see any
> errors at all, even if I do stuff that is not permissible (such as, if I
> understand the API correctly, calling ArrayImageFactory with a
> ComplexDoubleType (i.e. a non-NativeType) as argument). Where are errors
> logged ?

Errors are logged on the console, usually. We do have a plan to log into a
circular buffer in addition that can be displayed on demand, but so far
more pressing projects took precedence.

Ciao,
Johannes

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

Re: complex-valued images in ImageJ2 ?

Adrian Daerr-2
>> If ImageJ cannot yet display ComplexType images,
>
> That is indeed the case!
>
>> but *can* do headless stuff using imglib
>
> I am not quite sure that we handle that case properly in ImageJ2 yet...

Hi Johannes,

Thanks for the info, I just noticed that the ComplexDoubleType API doc
says "TODO" in a prominent place, I must have missed it on my first
visit. Got the job done using octave in the meantime, but still glad I
had my first glance at how ImageJ2 plugins may look like. Very nice
syntactic sugar, the automatic input dialog generation by simple
annotations on the input parameters is for the moment my favorite :-)

Adrian

p.s.
Wayne, I took note of your request and will post to -devel next time; my
apologies for choosing the wrong ML.

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

Re: complex-valued images in ImageJ2 ?

dscho
Hi Adrian,

On Mon, 30 Sep 2013, Adrian Daerr wrote:

> > > If ImageJ cannot yet display ComplexType images,
> >
> > That is indeed the case!
> >
> > > but *can* do headless stuff using imglib
> >
> > I am not quite sure that we handle that case properly in ImageJ2 yet...
>
> Thanks for the info, I just noticed that the ComplexDoubleType API doc
> says "TODO" in a prominent place, I must have missed it on my first
> visit. Got the job done using octave in the meantime, but still glad I
> had my first glance at how ImageJ2 plugins may look like. Very nice
> syntactic sugar, the automatic input dialog generation by simple
> annotations on the input parameters is for the moment my favorite :-)

Indeed. The plugin mechanism is meant to be so general that it can be used
in other -- even non-Java -- projects, e.g. CellProfiler.

We will work very hard to support IJ2 plugins in Fiji (even in legacy
mode) in the next few months. So your getting started with IJ2 plugins was
definitely not wasted!

> p.s.
> Wayne, I took note of your request and will post to -devel next time; my
> apologies for choosing the wrong ML.

I do not think that an apology is required: we are very collegial in the
ImageJ project. But of course it may be better to ask very technical
ImageJ2-specific questions on [hidden email] when more
user-oriented questions are more likely of interest to
[hidden email].

Ciao,
Johannes

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html