Ho to get 2D image from stack (X,Y,T) with imglib2 library in jython script

Hi All,
I am quite frustrating to not be able to get the XY slice from a 3D stack (X+Y+T) with imglib2 library. I know how to deal with it by using ImageStack from the ImageJ1 library but not with the imglib2. Could you help me to get each XY slice separately or just show me an example.
As a input I have a ImagePlusImg.

thanks by advance

in short:

dim = 2 # time dimension
timepoint = 0 # first time
slice = Views.hyperslice( img, dim, timepoint );

don’t have time for details at the moment. but post back if you still have issues.

Yea, imglib2 has a steep learning curve, but these examples are really worth taking your time through if you haven’t already



Hi @bogovicj

thank you I understand better how the imglib2 is working.
And to combine 2d images in stack i have to use Views.stack for array of img, do I ?


1 Like


Yes, exactly. :+1:

Hi @bogovicj,

thank you for your help, it is working …


1 Like