Skip to content
Snippets Groups Projects
Commit 79cf2dc7 authored by Paul McCarthy's avatar Paul McCarthy
Browse files

New ProxyImage class, to represent derived images. This may change.

parent 796cafd8
No related branches found
No related tags found
No related merge requests found
...@@ -5,8 +5,9 @@ ...@@ -5,8 +5,9 @@
# #
# Author: Paul McCarthy <pauldmccarthy@gmail.com> # Author: Paul McCarthy <pauldmccarthy@gmail.com>
# #
"""This module provides the :class:`Image` class, for representing 3D/4D NIFTI1 """This module provides the :class:`Nifti1` and :class:`Image` classes, for
images. The ``nibabel`` package is used for file I/O. representing 3D/4D NIFTI1 images. The ``nibabel`` package is used for file
I/O.
.. note:: Currently, only NIFTI1 images are supported. .. note:: Currently, only NIFTI1 images are supported.
...@@ -570,6 +571,34 @@ class Image(Nifti1, props.HasProperties): ...@@ -570,6 +571,34 @@ class Image(Nifti1, props.HasProperties):
self.dataSource, newMin, newMax)) self.dataSource, newMin, newMax))
return newMin, newMax return newMin, newMax
class ProxyImage(Image):
"""The ``ProxyImage`` class is a simple wrapper around an :class:`Image`
instance. It is intended to be used to represent images or data which
are derived from another image.
"""
def __init__(self, base, *args, **kwargs):
"""Create a ``ProxyImage``.
:arg base: The :class:`Image` instance upon which this ``ProxyImage``
is based.
"""
if not isinstance(base, Image):
raise ValueError('Base image must be an Image instance')
self.__base = base
kwargs['header'] = base.nibImage.get_header()
Image.__init__(self, base.data, *args, **kwargs)
def getBase(self):
"""Returns the base :class:`Image` of this ``ProxyImage``. """
return self.__base
# TODO The wx.FileDialog does not # TODO The wx.FileDialog does not
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment