WARNING: THIS SITE IS A MIRROR OF GITHUB.COM / IT CANNOT LOGIN OR REGISTER ACCOUNTS / THE CONTENTS ARE PROVIDED AS-IS / THIS SITE ASSUMES NO RESPONSIBILITY FOR ANY DISPLAYED CONTENT OR LINKS / IF YOU FOUND SOMETHING MAY NOT GOOD FOR EVERYONE, CONTACT ADMIN AT ilovescratch@foxmail.com
Skip to content

Feature Request: Detect when writing to open mmap #492

@fepegar

Description

@fepegar

I have written a small function in IPython to delete the origin information from an image:
In [1]: def removeOrigin(imPath):
...: nii=nib.load(imPath)
...: affine = nii.affine
...: affine[:3, 3] = 0
...: data = nii.get_data()
...: new = nib.Nifti1Pair(data, affine)
...: nib.save(new, imPath)

My images are in Nifti1Pair format and very small (500 kB - 1 MB).

When I call my function, IPython crashes, the Terminal says Bus error and something very bad happens: my image data is gone!! The .hdr/.imgs file contain now 0 bytes, so I just lost my data.

I've tried outside the function and it happens the same when I try to overwrite the original image, i.e.:
nib.save(new, imPath) -> Bus error
nib.save(new, imPath.replace('.hdr', '_2.hdr')) -> Ok

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions