Skip to content

Commit 112b90c

Browse files
committed
RF: use map instead of list comprehensions
map looks a little nices here; from suggestion by Alexandre Gramfort
1 parent 9d5a5fe commit 112b90c

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

nibabel/nicom/dicomwrappers.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ def image_orient_patient(self):
131131
if iop is None:
132132
return None
133133
# Values are python Decimals in pydicom 0.9.7
134-
iop = np.array([float(i) for i in iop])
134+
iop = np.array((map(float, iop)))
135135
return np.array(iop).reshape(2,3).T
136136

137137
@one_time
@@ -184,7 +184,7 @@ def voxel_sizes(self):
184184
zs = 1
185185
# Protect from python decimals in pydicom 0.9.7
186186
zs = float(zs)
187-
pix_space = [float(i) for i in pix_space]
187+
pix_space = map(float, pix_space)
188188
return tuple(pix_space + [zs])
189189

190190
@one_time
@@ -204,7 +204,7 @@ def image_position(self):
204204
if ipp is None:
205205
return None
206206
# Values are python Decimals in pydicom 0.9.7
207-
return np.array([float(i) for i in ipp])
207+
return np.array(map(float, ipp))
208208

209209
@one_time
210210
def slice_indicator(self):
@@ -572,7 +572,7 @@ def image_position(self):
572572
if None in (ipp, md_rows, md_cols, iop, pix_spacing):
573573
return None
574574
# PixelSpacing values are python Decimal in pydicom 0.9.7
575-
pix_spacing = np.array([float(i) for i in pix_spacing])
575+
pix_spacing = np.array(map(float, pix_spacing))
576576
# size of mosaic array before rearranging to 3D.
577577
md_rc = np.array([md_rows, md_cols])
578578
# size of slice array after reshaping to 3D

0 commit comments

Comments
 (0)