Commit 33a09260 authored by Paul McCarthy's avatar Paul McCarthy 🚵
Browse files

RF: Ignore calcRange if loadData=False (fsl/fslpy#374). New ImageWrapper

propertk to check load state
parent 2b304a8a
......@@ -1042,7 +1042,8 @@ class Image(Nifti):
calculated immediately (vi a call to
:meth:`calcRange`). Otherwise, the image range is
incrementally updated as more data is read from memory
or disk.
or disk. If ``loadData=False``, ``calcRange`` is also
set to ``False``.
:arg threaded: If ``True``, the :class:`.ImageWrapper` will use a
separate thread for data range calculation. Defaults
......@@ -1065,8 +1066,11 @@ class Image(Nifti):
nibImage = None
saved = False
if loadData:
threaded = False
# disable threaded access if loadData is True
threaded = threaded and (not loadData)
# don't calcRange if not loading data
calcRange = calcRange and loadData
# Take a copy of the header if one has
# been provided
......
......@@ -388,6 +388,14 @@ class ImageWrapper(notifier.Notifier):
self.__data = np.asanyarray(self.__image.dataobj)
@property
def dataIsLoaded(self):
"""Return true if the image data has been loaded into memory, ``False``
otherwise.
"""
return self.__data is not None
def __getData(self, sliceobj, isTuple=False):
"""Retrieves the image data at the location specified by ``sliceobj``.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment