Skip to content

Type checking issues #1252

Closed
Closed
@blakedewey

Description

@blakedewey

Hi Nibabel community,

Great job on getting some type checking into this package! I wanted to point out two scenarios that I use frequently that have run me into type checking issues based on 5.1.0.

  1. nb.load shows a return type of FileBasedImage. This is all well and good, but unfortunately FileBasedImage does not define get_fdata(). A common code example that I use (and see around) is:
obj = nb.load(filepath)
data = obj.get_fdata()
  1. nb.Nifti1Image doesn't want to take None for the affine. I previously saw this code used frequently:
nb.Nifti1Image(data_array, None, header)

Just bringing these to your attention. I'm also flexible to change up my code, if better patterns are recommended.

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