File tree Expand file tree Collapse file tree 1 file changed +12
-8
lines changed
Expand file tree Collapse file tree 1 file changed +12
-8
lines changed Original file line number Diff line number Diff line change @@ -41,14 +41,18 @@ def __init__(self, filename):
4141 The path to your ``.nii`` file. Can be a string, or a
4242 ``PosixPath`` from python3's pathlib.
4343 """
44- self .filename = Path (filename ).resolve ()
45- if not os .path .isfile (self .filename ):
46- raise OSError ('File ' + self .filename .name + ' not found.' )
47-
48- # load data in advance
49- # this ensures once the widget is created that the file is of a format
50- # readable by nibabel
51- self .data = nib .load (str (self .filename ))
44+ if hasattr (filename , 'get_data' ):
45+ self .data = filename
46+ else :
47+ filename = Path (filename ).resolve ()
48+ if not os .path .isfile (filename ):
49+ raise OSError ('File ' + filename .name + ' not found.' )
50+
51+ # load data in advance
52+ # this ensures once the widget is created that the file is of a format
53+ # readable by nibabel
54+ self .data = nib .load (str (filename ))
55+
5256 # initialise where the image handles will go
5357 self .image_handles = None
5458
You can’t perform that action at this time.
0 commit comments