Confusion about SubsampleIntervalView, HyperSliceImgPlus, etc.

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Confusion about SubsampleIntervalView, HyperSliceImgPlus, etc.

Jan Schier
Hi,

Excuse me perhaps naive questions for this list. I have, say, reasonable
experience with Java coding for ImageJ1, and now I have tried to touch
ImageJ2 and ImgLib2

I have written some code using Haar wavelets on 3D images last year,
using HyperSliceImgPlus.fixChannelAxis() to select the channel and then
SubsampleIntervalView etc. to get the sampling for wavelet computation.

Essentially, I have used something like

final ImgPlus<T> input = (ImgPlus<T>)dataset.getImgPlus();
final Img<T> viewChan = HyperSliceImgPlus.fixChannelAxis(input, 1L);

and then I was using Img<T> for subsampling and further processing.
With this code, I run into conflict between net.imglib2.meta.ImgPlus<T>
and net.imagej.ImgPlus<T> now.

I wanted to extend it now, but things have changed a lot with ops. I
assume that my approach of working on Img<T> is incorrect now.

- how should I replace the above construct for channel selection now?

- what should I use for the subsampling operations to do it properly? I
assume I should stay at the Dataset or ImgPlus level?

Many thanks for any hint,

Jan

_______________________________________________
ImageJ-devel mailing list
[hidden email]
http://imagej.net/mailman/listinfo/imagej-devel
Reply | Threaded
Open this post in threaded view
|

Re: Confusion about SubsampleIntervalView, HyperSliceImgPlus, etc.

Curtis Rueden
Hi Jan,

Apologies for the delay in reply.

> I run into conflict between net.imglib2.meta.ImgPlus<T> and
> net.imagej.ImgPlus<T> now.

That suggests a clash of dependencies. The "net.imglib2.meta.ImgPlus" is gone, in favor of (for the time being [1]) net.imagej.ImgPlus.

Everything should work if you update your POM to extend the newest pom-imagej (5.10.0 at the time of this writing), and purge all "import net.imglib2.meta" lines from your imports in favor of the new "import net.imagej" class instead.  The HyperSliceImgPlus, though deprecated, was updated to use net.imagej.ImgPlus, so hopefully this will work for you.

> what should I use for the subsampling operations to do it properly?

The API for doing this is still under development. The Views.interpolate method [2] is probably a good starting point, though it is rather low level. If what you want is to resample an image, we should create an op for that in the ImageJ OPS project (I don't think one exists yet).

Regards,
Curtis

[1] In case you are curious: the ImgPlus class really needs a better interface-driven type hierarchy, which has been a long time in coming. It is planned to rework the ImageJ2 data model a bit along these lines later this year.


On Fri, Feb 13, 2015 at 6:45 AM, Jan Schier <[hidden email]> wrote:
Hi,

Excuse me perhaps naive questions for this list. I have, say, reasonable experience with Java coding for ImageJ1, and now I have tried to touch ImageJ2 and ImgLib2

I have written some code using Haar wavelets on 3D images last year, using HyperSliceImgPlus.fixChannelAxis() to select the channel and then SubsampleIntervalView etc. to get the sampling for wavelet computation.

Essentially, I have used something like

final ImgPlus<T> input = (ImgPlus<T>)dataset.getImgPlus();     
final Img<T> viewChan = HyperSliceImgPlus.fixChannelAxis(input, 1L);

and then I was using Img<T> for subsampling and further processing.
With this code, I run into conflict between net.imglib2.meta.ImgPlus<T> and net.imagej.ImgPlus<T> now.

I wanted to extend it now, but things have changed a lot with ops. I assume that my approach of working on Img<T> is incorrect now.

- how should I replace the above construct for channel selection now?

- what should I use for the subsampling operations to do it properly? I assume I should stay at the Dataset or ImgPlus level?

Many thanks for any hint,

Jan

_______________________________________________
ImageJ-devel mailing list
[hidden email]
http://imagej.net/mailman/listinfo/imagej-devel


_______________________________________________
ImageJ-devel mailing list
[hidden email]
http://imagej.net/mailman/listinfo/imagej-devel
Reply | Threaded
Open this post in threaded view
|

Re: Confusion about SubsampleIntervalView, HyperSliceImgPlus, etc.

Jan Schier
> Hi Jan,
>
> Apologies for the delay in reply.

no problem, many thank for your reply!

>  > I run into conflict between net.imglib2.meta.ImgPlus<T> and
>  > net.imagej.ImgPlus<T> now.
>
> That suggests a clash of dependencies. The "net.imglib2.meta.ImgPlus" is
> gone, in favor of (for the time being [1]) net.imagej.ImgPlus.
>
> Everything should work if you update your POM to extend the newest
> pom-imagej (5.10.0 at the time of this writing), and purge all "import
> net.imglib2.meta" lines from your imports in favor of the new "import
> net.imagej" class instead.  The HyperSliceImgPlus, though deprecated,
> was updated to use net.imagej.ImgPlus, so hopefully this will work for you.

OK, thanks, I will check this.

>
>  > what should I use for the subsampling operations to do it properly?
>
> The API for doing this is still under development. The Views.interpolate
> method [2] is probably a good starting point, though it is rather low
> level. If what you want is to resample an image, we should create an op
> for that in the ImageJ OPS project (I don't think one exists yet).

I was using Views.subsample in my old code (all I needed was an integer
subsampling), but was going to "rather low level" probably way too
early. Thanks for the hint.

For the moment, I just took the algorithm and reimplemented it in
ImageJ1 - I am much more familiar there and really needed to get the job
done.

I will try to play with OPS and definitely, I will keep eye on its
development  - it really looks great and evolves pretty quickly.

 > [1] In case you are curious: the ImgPlus class really needs a better
 > interface-driven type hierarchy, which has been a long time in coming.
 > It is planned to rework the ImageJ2 data model a bit along these lines
 > later this year.

This will for sure be interesting to follow!

Thanks again,

Jan

_______________________________________________
ImageJ-devel mailing list
[hidden email]
http://imagej.net/mailman/listinfo/imagej-devel