Skip to content

Orientation issues when going from nibabel to itk #863

@atylermorgan

Description

@atylermorgan

I am trying to create a tool that has EPI outlines like the nibabel example (https://nipy.org/nibabel/coordinate_systems.html#the-affine-as-a-series-of-transformations), but with the ability to move the outlines by hand. The best tool I know for manual movements of scans is ITK-SNAP, so I have been trying to import "outline" EPI scans from nibabel. This is not working properly (EPI images appear much larger than anatomical images when overlaid), and I am not sure why.

Here is some code that I have used to create the EPIs:

# create outline data
data = np.ones((192, 192, 27))
data[1:-1, 1:-1, 1:-1] = 0   # creates an outline only

# create blank rotation with scaling
rot = np.diag([0.8, 0.8, 0.8, 1])

# create a nifti image and save
img = nb.Nifti1Image(data, rot)
img.set_qform(img.affine, 1)
img.to_filename('epi.nii.gz')

I added the line setting the qform based on this comment: #801 (comment)

ITK-SNAP still cannot properly read the orientation of the outline scan. However, FSL is able to read it just fine. Are there other nibabel methods required to properly prepare a header for use in ITK?

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