-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ImageJFunctions.wrap mixes up channels with slices, and slices with time frames #29
Comments
CZT is the canonical ImageJ1 order. E.g., from the /** Sets the 3rd, 4th and 5th dimensions, where
<code>nChannels</code>*<code>nSlices</code>*<code>nFrames</code>
must be equal to the stack size. */
public void setDimensions(int nChannels, int nSlices, int nFrames) { And: /** Sets the current hyperstack position and updates the display,
where 'channel', 'slice' and 'frame' are one-based indexes. */
public void setPosition(int channel, int slice, int frame) {
...
setSlice((frame-1)*nChannels*nSlices + (slice-1)*nChannels + channel); So the rasterization order is definitely (channel, slice, frame) <-> planeIndex, with channel fastest moving. This looks consistent with
That would break backwards compatibility very thoroughly, would it not? On the other hand, adding more methods allowing to override the dimension order would preserve compatibility. But would make things more complicated. Is there some reason you cannot simply use |
Thanks for the comments, @ctrueden . So your approach would be to insert an additional dimension, with size 1, to account for the channels, prior to calling Given that that is cumbersome, I'd rather add a new |
@acardona How about something like:
So that one can explicitly state the dimensional axis index for each of C, Z and T? So for your XYZT images you might write:
And it would take care of adding and/or permuting dimensions accordingly. @tpietzsch @maarzt What do you think? |
I am not sure I understand the -1 for the channel index? You are thinking in terms of permutations of axes? |
The idea is to identify the index of the C dimension within your Other examples:
The last one, with interleaved channels, brings up an interesting point, though: what if X and Y are not the first two dimensions? More properly, we probably want to have:
I.e. to include all 5 dimensions. But a signature without |
@acardona You can already use the following solution:
Do we want to make this part of ImageJFunctions? |
Why do you want to put any new functionality into |
Hi @maarzt, the attractiveness of
... and that'd be that. Short of that, I have to create a function that inserts an additional dimension with value 1 just to handle my always-empty the channels dimension. Kind of defeats the simplicity of |
I don't like the I like @maarzt solution. I would put it into |
This issue has been mentioned on Image.sc Forum. There might be relevant details there: https://forum.image.sc/t/imglib2-force-wrapped-imageplus-rai-dimensions-to-xyczt/56461/1 |
When calling
ImageJFunctions.wrap( RandomAccessibleInterval )
for aRandomAccessibleInterval
with 3 dimensions, the third dimension is interpreted as channels rather than Z slices. For a 4D, the 4th dimension is interpreted as stack slices (the Z axis) rather than time frames.This issue is bad enough that I am not using
wrap
anymore, because it makes further work with these virtual stacks hard. For example, theImagePlus.setPosition( channels, slices, frames )
is entirely messed up, in that one has to use channels for slices, and slices for frames.A solution would be to edit the private method
ImageJFunctions.makeImagePlus
to stop interpreting the 3rd dimension as channels by default. I am not sure what motivated this, given that awrap
over an RGB image shows it as a single-sliceColorProcessor
.According to
git blame
, the author ofImageJFunctions.makeImagePlus
is @tpietzsch . I wonder if a comment could be made about the mix up between channels and slices, and slices with frames.I'd like to rewrite the method
ImageJFunctions.makeImagePlus
to do the right thing. Perhaps some of the methods that call it withinImageJFunctions
could specify the number of channels that they want as an argument. Otherwise, the default number of channels should be 1, and the 3rd dimension be interpreted by default as the Z axis.The text was updated successfully, but these errors were encountered: