From ee2c6c496246d90973d70249af85e23d3b72055a Mon Sep 17 00:00:00 2001 From: Dawn Smith Date: Thu, 3 Nov 2022 16:16:03 -0400 Subject: [PATCH 1/3] [FIX] Update references to nibabel's getArraysFromIntent --- ciftify/bin/ciftify_peaktable.py | 4 ++-- ciftify/niio.py | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/ciftify/bin/ciftify_peaktable.py b/ciftify/bin/ciftify_peaktable.py index e4687b3..1443c5e 100755 --- a/ciftify/bin/ciftify_peaktable.py +++ b/ciftify/bin/ciftify_peaktable.py @@ -232,7 +232,7 @@ def load_hemisphere_labels(filename, wb_structure, map_number = 1): # loads label table as dict and data as numpy array gifti_img = nibabel.gifti.giftiio.read(labels_gii) - atlas_data = gifti_img.getArraysFromIntent('NIFTI_INTENT_LABEL')[map_number - 1].data + atlas_data = gifti_img.get_arrays_from_intent('NIFTI_INTENT_LABEL')[map_number - 1].data atlas_dict = gifti_img.get_labeltable().get_labels_as_dict() atlas_df = pd.DataFrame.from_dict(atlas_dict, orient = "index") @@ -321,7 +321,7 @@ def build_hemi_results_df(surf_settings, atlas_settings, clust_array = load_hemisphere_data(clusters_dscalar, surf_settings['wb_structure']) ## load the coordinates - coords = nibabel.gifti.giftiio.read(surf_settings['surface']).getArraysFromIntent('NIFTI_INTENT_POINTSET')[0].data + coords = nibabel.gifti.giftiio.read(surf_settings['surface']).get_arrays_from_intent('NIFTI_INTENT_POINTSET')[0].data surf_va = ciftify.niio.load_gii_data(surf_settings['vertex_areas']) ## put all this info together into one pandas dataframe diff --git a/ciftify/niio.py b/ciftify/niio.py index 56430f1..23a6d54 100644 --- a/ciftify/niio.py +++ b/ciftify/niio.py @@ -183,7 +183,7 @@ def load_gii_data(filename, intent='NIFTI_INTENT_NORMAL'): ## read all arrays and concatenate in numpy try: - array1 = surf_dist_nib.getArraysFromIntent(intent)[0] + array1 = surf_dist_nib.get_arrays_from_intent(intent)[0] except IndexError: logger.error("Invalid intent: {}".format(intent)) sys.exit(1) @@ -191,7 +191,7 @@ def load_gii_data(filename, intent='NIFTI_INTENT_NORMAL'): data = array1.data if numDA >= 1: for DA in range(1,numDA): - data = np.vstack((data, surf_dist_nib.getArraysFromIntent(intent)[ + data = np.vstack((data, surf_dist_nib.get_arrays_from_intent(intent)[ DA].data)) ## transpose the data so that it is vertices by TR @@ -267,7 +267,7 @@ def get_surf_distances(surf, orig_vertex, radius_search=100, def load_surf_coords(surf): '''load the coordinates from a surface file''' - coords = nibabel.gifti.giftiio.read(surf).getArraysFromIntent('NIFTI_INTENT_POINTSET')[0].data + coords = nibabel.gifti.giftiio.read(surf).get_arrays_from_intent('NIFTI_INTENT_POINTSET')[0].data return coords @@ -282,7 +282,7 @@ def load_hemisphere_labels(filename, wb_structure, map_number = 1): # loads label table as dict and data as numpy array gifti_img = nibabel.gifti.giftiio.read(labels_gii) - atlas_data = gifti_img.getArraysFromIntent('NIFTI_INTENT_LABEL')[map_number - 1].data + atlas_data = gifti_img.get_arrays_from_intent('NIFTI_INTENT_LABEL')[map_number - 1].data atlas_dict = gifti_img.get_labeltable().get_labels_as_dict() From 2caa8371144aae8da902478c219b424bd26e363c Mon Sep 17 00:00:00 2001 From: Dawn Smith Date: Thu, 3 Nov 2022 16:57:34 -0400 Subject: [PATCH 2/3] [FIX] Set based indexing is deprecated by pandas --- ciftify/bin/ciftify_PINT_vertices.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ciftify/bin/ciftify_PINT_vertices.py b/ciftify/bin/ciftify_PINT_vertices.py index 9c76ee0..f694bd8 100755 --- a/ciftify/bin/ciftify_PINT_vertices.py +++ b/ciftify/bin/ciftify_PINT_vertices.py @@ -404,7 +404,7 @@ def pint_move_vertex(df, idx, vertex_incol, vertex_outcol, # loop through each time series, calculating r if pcorr: - o_networks = set(netmeants.columns.tolist()) - {network} + o_networks = list(set(netmeants.columns.tolist()) - {network}) seed_corrs[idx_mask] = mass_partial_corr(meants, func_data[idx_mask, :], netmeants.loc[:,o_networks].values) From 997474f0d8418eeaeebdf1b9114d8c38c4c09dba Mon Sep 17 00:00:00 2001 From: Dawn Smith Date: Fri, 4 Nov 2022 18:46:37 -0400 Subject: [PATCH 3/3] [FIX] Update deprecated references to nibabel's .get_header() and .get_affine() --- ciftify/niio.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ciftify/niio.py b/ciftify/niio.py index 23a6d54..0170703 100644 --- a/ciftify/niio.py +++ b/ciftify/niio.py @@ -97,8 +97,8 @@ def load_nifti(filename): logger.error("Cannot read {}".format(filename)) sys.exit(1) - affine = nifti.get_affine() - header = nifti.get_header() + affine = nifti.affine + header = nifti.header dims = list(nifti.shape) # if smaller than 3D