Concatenate A+B works but not B+A

Hello,

I am trying to concatenate two hyperstack. I noticed that I can concatenate the following stacks without problem:

  • A (dim: 1024x1024x19x2x7 – XYZCT)
  • B (dim: 1024x1024x1x2x7 – XYZCT)
    This results in C=concatenate(A,B), with dimensions (1024x1024x20x2x7 – XYZCT)
    However, when I try concatenate(B,A), I get an error message about the images not having the same dimensions or types.

I wonder whether this is an expected behaviour, and what would be an easier way of circumventing it? I can think about adding the “slice” at the end and reordering the stack, but I have the feeling that there should be an easier way to proceed.

I’d be happy to receive any advice, many thanks!

Hello Maxime -

I am unable to concatenate two such hyperstacks. That is,
when the Z-dimensions (slice) of the two hyperstacks differ
(even if one of them has Z = 1), I get a pop-up error message
of the type you describe. It doesn’t matter which order I try
to perform the concatenation – neither order works.

I tried this using the gui, e.g. File > New > Hyperstack...
and Image > Stacks > Tools > Concatenate....

I do get this error when attempting “concatenate (B, A)”, but,
as noted above, I also get the error the other way around,
“concatenate (B, A)”.

(This is running Fiji / Imagej 2.0.0-rc-69/1.52r55.)

I don’t know why we are seeing different behaviors. Could you
give detailed steps – either a (complete, runnable) detailed
script or explicit gui commands – that reproduce your behavior?

A quick glance at the code for Concatenator leads me to expect
the behavior that I see – namely the error message when
concatenating the hyperstacks with mismatched Z-dimensions
in either order.

It is possible to “re-order” a hyperstack so that Z (slices)
becomes T (frames):
Image > Hyperstacks > Re-order Hyperstack ....

If I do this I can then concatenate the hyperstacks (in either order).
What is now the T-dimension (length 19 for A and length 1 for B)
gets concatenated. I can then re-order back (swapping Z for T
again) to get what I think you want, that is, a hyperstack with Z
of length 20;.

Does this work-around address your issue?

It sounds like your approach would work (assuming that, unlike
me, you can concatenate the mismatched-Z hyperstacks).

To me, the re-order, concatenate, re-order back method seems
a little more intuitive, but I don’t really see any good reason to
prefer one method over the other.

Thanks, mm