-
Notifications
You must be signed in to change notification settings - Fork 262
nibabel.concat_images returns 5D images from 4D images #207
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
Comments
Yes, I agree it can be confusing. An axis argument seems like a good solution. |
Is there a recommended solution to this? I couldn't find any elegant ways to eliminate the unary 4th dimension. Since my images were size 1 in the 4th dimension, I could do: all_files = glob.glob('fM00223/*.img')
all_images = [nibabel.funcs.four_to_three(nibabel.load(f))[0] for f in all_files]
func_img = nibabel.funcs.concat_images(all_images) |
I'm sorry, I just ran out of time for the 2.0 release, but I still agree that an axis keyword would be good. Do you have any time to hack that up as a pull-request? That would be the best solution. Otherwise it's pretty easy to do by hand, by adapting the code in |
MRG: Add an 'axis' parameter to concat_images, plus two tests Add ability to concatenate images over given axis, with tests. Closes nipy#207
If I concat a list of 4D images, I get a 5D image.
I was a bit surprised by this behavior: this is not what I was expecting from the docstring.
Maybe an option to avoid this behavior, and concat along the last axis, and not the last+1 axis would be useful. Another option would be to concat along a specified axis (given as a kwarg to concat_images), that could be '4' by default.
The text was updated successfully, but these errors were encountered: