1
- from collections import Sequence
1
+ try :
2
+ from collections .abc import Sequence
3
+ except ImportError : # Py 2.7
4
+ from collections import Sequence
2
5
from distutils .version import LooseVersion
3
6
import logging
4
7
import warnings
@@ -150,7 +153,7 @@ def load_curvature(self):
150
153
"""Load in curvature values from the ?h.curv file."""
151
154
curv_path = op .join (self .data_path , "surf" , "%s.curv" % self .hemi )
152
155
self .curv = nib .freesurfer .read_morph_data (curv_path )
153
- self .bin_curv = np .array (self .curv > 0 , np . int )
156
+ self .bin_curv = np .array (self .curv > 0 , int )
154
157
155
158
def load_label (self , name ):
156
159
"""Load in a Freesurfer .label file.
@@ -163,7 +166,7 @@ def load_label(self, name):
163
166
"""
164
167
label = nib .freesurfer .read_label (op .join (self .data_path , 'label' ,
165
168
'%s.%s.label' % (self .hemi , name )))
166
- label_array = np .zeros (len (self .x ), np . int )
169
+ label_array = np .zeros (len (self .x ), int )
167
170
label_array [label ] = 1
168
171
try :
169
172
self .labels [name ] = label_array
@@ -513,10 +516,10 @@ def create_color_lut(cmap, n_colors=256, center=None):
513
516
if np .ndim (cmap ) == 2 :
514
517
if cmap .shape [1 ] == 4 :
515
518
# This looks likes a LUT that's ready to go
516
- lut = cmap .astype (np . int )
519
+ lut = cmap .astype (int )
517
520
elif cmap .shape [1 ] == 3 :
518
521
# This looks like a LUT, but it's missing the alpha channel
519
- alpha = np .ones (len (cmap ), np . int ) * 255
522
+ alpha = np .ones (len (cmap ), int ) * 255
520
523
lut = np .c_ [cmap , alpha ]
521
524
522
525
return lut
@@ -548,7 +551,7 @@ def create_color_lut(cmap, n_colors=256, center=None):
548
551
raise ValueError ("Input %r was not valid for making a lut" % cmap )
549
552
550
553
# Convert from a matplotlib colormap to a lut array
551
- lut = (cmap (np .linspace (0 , 1 , n_colors )) * 255 ).astype (np . int )
554
+ lut = (cmap (np .linspace (0 , 1 , n_colors )) * 255 ).astype (int )
552
555
553
556
return lut
554
557
0 commit comments