Skip to content

Push .imageclass.class_map logic into Image classes #323

Closed
@bcipolli

Description

@bcipolli

Adding new images is easier if the information about the image is encapsulated by the Image class. Even better if the SpatialImage super class can define a common interface.

Currently, a number of properties about an image are defined in the imageclasses.py:class_map variable, including (pulling from imageclasses.py):

                'ext': '.img', # characteristic image extension
                'has_affine': False, # class can store an affine
                'makeable': True, # empty image can be easily made in memory
                'rw': True}, # image can be written

I suggest that these all get defined as properties on SpatialImage, and overridden with appropriate values by each subclass. Note that we're already discussing pushing the extension metadata to the image class in #317.

If we think class_map (and ext_map) are being used by external libraries, we can simply build these maps with a simple dictionary comprehension (or list comprehension if Python 2.6 compatibility matters).

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