Skip to content

Commit 6bd123b

Browse files
committed
Fix(io.volumes): implement flip in MappedArray instead of CatArray
1 parent 1ce7516 commit 6bd123b

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

nitorch/io/volumes/mapping.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -923,6 +923,13 @@ def split(self, chunks, dim=0):
923923
previous_chunks += chunk
924924
return out
925925

926+
def flip(self, dim):
927+
dim = make_list(dim)
928+
slicer = [slice(None)] * self.dim
929+
for d in dim:
930+
slicer[d] = slice(None, None, -1)
931+
return self[tuple(slicer)]
932+
926933
def channel_first(self, atleast=0):
927934
"""Permute the dimensions such that all spatial axes are on the right.
928935
@@ -1194,13 +1201,6 @@ def permute(self, dims):
11941201
new.shape = tuple(self.shape[d] for d in dims)
11951202
return new
11961203

1197-
def flip(self, dim):
1198-
dim = make_list(dim)
1199-
slicer = [slice(None)] * self.dim
1200-
for d in dim:
1201-
slicer[d] = slice(None, None, -1)
1202-
return self[tuple(slicer)]
1203-
12041204
def raw_data(self, *args, **kwargs):
12051205
# read individual arrays and concatenate them
12061206
# TODO: it would be more efficient to preallocate the whole

0 commit comments

Comments
 (0)