Skip to content
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

data.shape has one more dimension #1324

Open
wxr521314 opened this issue May 27, 2024 · 1 comment
Open

data.shape has one more dimension #1324

wxr521314 opened this issue May 27, 2024 · 1 comment

Comments

@wxr521314
Copy link

wxr521314 commented May 27, 2024

   Thank you for your contributions.I have a question which I hope you can help me to answer
   The dual_channel_image.shape I saved with sitk is (275, 386, 386, 386, 2), why the shape I read with nibabel is (386, 386, 275, 1, 2), the result is one dimension more? 

Here's my code

        dual_channel_image = np.stack((image_R, image_L), axis=-1)
        heatmap_sitk = sitk.GetImageFromArray(dual_channel_image)
        output_file = f"/mnt/nas/temp/sch/landmark/{data[i]}/{data[i]}_666channel.nii.gz"
        heatmap_sitk.SetSpacing(spacing)
        heatmap_sitk.SetOrigin(Origin)
        sitk.WriteImage(heatmap_sitk, output_file)
        img = nib.load(output_file)
        data_array = img.get_fdata()
        data_shape = img.shape
        print("Data shape:", data_shape)
        print("OKOKOK")
@effigies
Copy link
Member

There's not enough here to go on. Can you create a minimal reproducible example that demonstrates the issue you're having?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants