Skip to content

How to use SaveImaged #1678

Answered by rijobro
JumpLK asked this question in Q&A
Mar 2, 2021 · 1 comments · 1 reply
Discussion options

You must be logged in to vote

Hi @JumpLK. SaveImage and SaveImaged require the image to be passed with the channel dimension first. So firstly you should add AddChanneld just after the LoadImaged. This also might solve your data allocation problem (currently Spacingd and Orientationd will be assuming that you have an image that is 512x75 with 512 channels).

I took your code, added the AddChanneld and then could open the saved image in ITKSnap. However, image metadata still says that the image is 4D (with a singleton channel dimension). This may not cause any problems for you, but I've submitted a PR to allow the user to squeeze the final dimensions, which would remove the singleton channel dimension, giving a 3D nifti…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@JumpLK
Comment options

Answer selected by JumpLK
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants