diff --git a/fsl/data/image.py b/fsl/data/image.py index 846e8abb7ec66946a2d5862556f724222f441b5b..2560cffdb35b76d2d4ade66f3f23b8327bf20a9c 100644 --- a/fsl/data/image.py +++ b/fsl/data/image.py @@ -295,8 +295,8 @@ class Image(Nifti1, notifier.Notifier): In addition to the attributes added by the :meth:`Nifti1.__init__` method, - the following read-only properties are present on an ``Image`` instance as - properties (https://docs.python.org/2/library/functions.html#property): + the following attributes/properties are present on an ``Image`` instance + as properties (https://docs.python.org/2/library/functions.html#property): ============== ====================================================== @@ -408,23 +408,26 @@ class Image(Nifti1, notifier.Notifier): else: nibImage = image - # Figure out the name of this image. If it has - # not beenbeen explicitly passed in, and this - # image was loaded from disk, use the file name. - if name is None and isinstance(image, six.string_types): - name = removeExt(op.basename(image)) + # Figure out the name of this image, if + # it has not beenbeen explicitly passed in + if name is None: - # Or the image was created from a numpy array - elif isinstance(image, np.ndarray): - name = 'Numpy array' + # If this image was loaded + # from disk, use the file name. + if isinstance(image, six.string_types): + name = removeExt(op.basename(image)) - # Or image from a nibabel image - else: - name = 'Nibabel image' + # Or the image was created from a numpy array + elif isinstance(image, np.ndarray): + name = 'Numpy array' + + # Or image from a nibabel image + else: + name = 'Nibabel image' Nifti1.__init__(self, nibImage.get_header()) - self.__name = name + self.name = name self.__dataSource = dataSource self.__nibImage = nibImage self.__saveState = dataSource is not None @@ -458,12 +461,6 @@ class Image(Nifti1, notifier.Notifier): """See the :meth:`__str__` method.""" return self.__str__() - - @property - def name(self): - """Returns the name of this ``Image``. """ - return self.__name - @property def dataSource(self): diff --git a/fsl/data/tensorimage.py b/fsl/data/tensorimage.py index 2587cc18929e49aff413721166a37f28b5845e77..0cee5380c78e206537fe7f810ec64505382e3230 100644 --- a/fsl/data/tensorimage.py +++ b/fsl/data/tensorimage.py @@ -125,16 +125,15 @@ class TensorImage(fslimage.Nifti1): else: paths = path - fslimage.Nifti1.__init__(self, paths['l1'], - loadData=False, - calcRange=False) self.__v1 = fslimage.Image(paths['v1']) self.__v2 = fslimage.Image(paths['v2']) self.__v3 = fslimage.Image(paths['v3']) self.__l1 = fslimage.Image(paths['l1']) self.__l2 = fslimage.Image(paths['l2']) - self.__l3 = fslimage.Image(paths['l3']) + self.__l3 = fslimage.Image(paths['l3']) + + fslimage.Nifti1.__init__(self, self.__l1.header) l1dir = op.abspath(op.dirname(paths['l1']))