Skip to content

Commit c1c427b

Browse files
committed
FIX: Accept mmap keep_file_open for Ecat and Minc, with no effect
1 parent e72fad5 commit c1c427b

File tree

3 files changed

+10
-3
lines changed

3 files changed

+10
-3
lines changed

nibabel/ecat.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@
5454
from .arraywriters import make_array_writer
5555
from .wrapstruct import WrapStruct
5656
from .fileslice import canonical_slicers, predict_shape, slice2outax
57+
from .keywordonly import kw_only_meth
5758
from .deprecated import deprecate_with_version
5859

5960
BLOCK_SIZE = 512
@@ -873,7 +874,8 @@ def _get_fileholders(file_map):
873874
return file_map['header'], file_map['image']
874875

875876
@classmethod
876-
def from_file_map(klass, file_map):
877+
@kw_only_meth(1)
878+
def from_file_map(klass, file_map, mmap=True, keep_file_open=None):
877879
"""class method to create image from mapping
878880
specified in file_map
879881
"""

nibabel/minc1.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
from .spatialimages import SpatialHeader, SpatialImage
1818
from .fileslice import canonical_slicers
1919

20+
from .keywordonly import kw_only_meth
2021
from .deprecated import FutureWarningMixin
2122

2223
_dt_dict = {
@@ -310,7 +311,9 @@ class Minc1Image(SpatialImage):
310311
ImageArrayProxy = MincImageArrayProxy
311312

312313
@classmethod
313-
def from_file_map(klass, file_map):
314+
@kw_only_meth(1)
315+
def from_file_map(klass, file_map, mmap=True, keep_file_open=None):
316+
# Note that mmap and keep_file_open are included for proper
314317
with file_map['image'].get_prepare_fileobj() as fobj:
315318
minc_file = Minc1File(netcdf_file(fobj))
316319
affine = minc_file.get_affine()

nibabel/minc2.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
"""
2828
import numpy as np
2929

30+
from .keywordonly import kw_only_meth
3031
from .optpkg import optional_package
3132
h5py, have_h5py, setup_module = optional_package('h5py')
3233

@@ -158,7 +159,8 @@ class Minc2Image(Minc1Image):
158159
header_class = Minc2Header
159160

160161
@classmethod
161-
def from_file_map(klass, file_map):
162+
@kw_only_meth(1)
163+
def from_file_map(klass, file_map, mmap=True, keep_file_open=None):
162164
holder = file_map['image']
163165
if holder.filename is None:
164166
raise MincError('MINC2 needs filename for load')

0 commit comments

Comments
 (0)