|
5 | 5 | import os |
6 | 6 | import os.path as op |
7 | 7 | import warnings |
| 8 | +from importlib.resources import files |
8 | 9 |
|
9 | 10 | import nibabel as nb |
10 | 11 | import numpy as np |
11 | 12 | import pandas as pd |
12 | 13 | from nilearn import image, plotting |
13 | | -from nilearn._utils import check_niimg |
| 14 | +from nilearn.image import check_niimg |
14 | 15 | from nilearn.regions import connected_regions |
15 | | -from pkg_resources import resource_filename |
16 | 16 | from scipy.ndimage import center_of_mass, label |
17 | 17 | from scipy.spatial.distance import cdist |
18 | 18 | from skimage.feature import peak_local_max |
@@ -63,8 +63,7 @@ def get_atlas(atlastype, cache=True): |
63 | 63 | atlastype = atlastype.lower() |
64 | 64 |
|
65 | 65 | # get the path to atlas + label files shipped with package |
66 | | - # resource_filename ensures that we're getting the correct path |
67 | | - data_dir = resource_filename("atlasreader", "data/atlases") |
| 66 | + data_dir = str(files("atlasreader").joinpath("data/atlases")) |
68 | 67 | atlas_path = op.join(data_dir, f"atlas_{atlastype}.nii.gz") |
69 | 68 | label_path = op.join(data_dir, f"labels_{atlastype}.csv") |
70 | 69 |
|
@@ -901,7 +900,7 @@ def create_output( |
901 | 900 |
|
902 | 901 | # get template image for plotting cluster maps |
903 | 902 | bgimg = nb.load( |
904 | | - resource_filename("atlasreader", "data/templates/MNI152_T1_1mm_brain.nii.gz") |
| 903 | + str(files("atlasreader").joinpath("data/templates/MNI152_T1_1mm_brain.nii.gz")) |
905 | 904 | ) |
906 | 905 |
|
907 | 906 | # plot clusters |
|
0 commit comments