Skip to content

image indexing for Brain and Nifti objects #96

@jeremymanning

Description

@jeremymanning

We can make Brain and Nifti objects indexable by making them iteratable objects: https://stackoverflow.com/questions/5359679/python-class-accessible-by-iterator-and-index

It looks like this involves adding __iter__ and __getitem__ methods:

  • __iter__ returns the next item in the sequence (i.e. start a counter at 0 when the objects is initialized, and each time __iter__ is called, return object[counter+1] if len(object) < counter, or None otherwise, and then increment counter
  • __getitem__ returns the given item(s)

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions