diff --git a/AFQ/utils/conversion.py b/AFQ/utils/conversion.py index 5574c53b..5553aef6 100644 --- a/AFQ/utils/conversion.py +++ b/AFQ/utils/conversion.py @@ -18,8 +18,8 @@ "CST_R": "Right Corticospinal", "CGC_L": "Left Cingulum Cingulate", "CGC_R": "Right Cingulum Cingulate", - "IFO_L": "Left Inferior Fronto-Occipital", - "IFO_R": "Right Inferior Fronto-Occipital", + "IFO_L": "Left Inferior Fronto-occipital", + "IFO_R": "Right Inferior Fronto-occipital", "ILF_L": "Left Inferior Longitudinal", "ILF_R": "Right Inferior Longitudinal", "SLF_L": "Left Superior Longitudinal", diff --git a/AFQ/viz/fury_backend.py b/AFQ/viz/fury_backend.py index 034505c2..42d9d7e6 100644 --- a/AFQ/viz/fury_backend.py +++ b/AFQ/viz/fury_backend.py @@ -36,7 +36,7 @@ def _inline_interact(scene, inline, interact): return scene -def visualize_bundles(sft, n_points=None, bundle_dict=None, +def visualize_bundles(seg_sft, n_points=None, bundle=None, colors=None, color_by_direction=False, opacity=1.0, @@ -50,22 +50,14 @@ def visualize_bundles(sft, n_points=None, bundle_dict=None, Parameters ---------- - sft : Stateful Tractogram, str - A Stateful Tractogram containing streamline information - or a path to a trk file - In order to visualize individual bundles, the Stateful Tractogram - must contain a bundle key in it's data_per_streamline which is a list - of bundle `'uid'`. + seg_sft : SegmentedSFT, str + A SegmentedSFT containing streamline information + or a path to a segmented trk file. n_points : int or None n_points to resample streamlines to before plotting. If None, no resampling is done. - bundle_dict : dict, optional - Keys are names of bundles and values are dicts that specify them. - Default: bundles are either not identified, or identified - only as unique integers in the metadata. - bundle : str or int, optional The name of a bundle to select from among the keys in `bundle_dict` or an integer for selection from the sft metadata. @@ -110,7 +102,7 @@ def visualize_bundles(sft, n_points=None, bundle_dict=None, figure.SetBackground(background[0], background[1], background[2]) for (sls, color, name, dimensions) in vut.tract_generator( - sft, bundle, bundle_dict, colors, n_points): + seg_sft, bundle, colors, n_points): sls = list(sls) if name == "all_bundles": color = line_colors(sls) @@ -501,9 +493,8 @@ def _draw_core(sls, n_points, figure, bundle_name, indiv_profile, return line_color_untouched -def single_bundle_viz(indiv_profile, sft, +def single_bundle_viz(indiv_profile, seg_sft, bundle, scalar_name, - bundle_dict=None, flip_axes=[False, False, False], labelled_nodes=[0, -1], figure=None, @@ -516,13 +507,9 @@ def single_bundle_viz(indiv_profile, sft, indiv_profile : ndarray A numpy array containing a tract profile for this bundle for a scalar. - sft : Stateful Tractogram, str - A Stateful Tractogram containing streamline information. - If bundle is an int, the Stateful Tractogram - must contain a bundle key in it's data_per_streamline which is a list - of bundle `'uid'. - Otherwise, the entire Stateful Tractogram will be used as the bundle - for the visualization. + seg_sft : SegmentedSFT, str + A SegmentedSFT containing streamline information + or a path to a segmented trk file. bundle : str or int The name of the bundle to be used as the label for the plot, @@ -531,12 +518,6 @@ def single_bundle_viz(indiv_profile, sft, scalar_name : str The name of the scalar being used. - bundle_dict : dict, optional - This parameter is used if bundle is an int. - Keys are names of bundles and values are dicts that specify them. - Default: Either the entire sft is treated as a bundle, - or identified only as unique integers in the metadata. - flip_axes : ndarray Which axes to flip, to orient the image as RAS, which is how we visualize. @@ -564,7 +545,7 @@ def single_bundle_viz(indiv_profile, sft, n_points = len(indiv_profile) sls, _, bundle_name, dimensions = next(vut.tract_generator( - sft, bundle, bundle_dict, None, n_points)) + seg_sft, bundle, None, n_points)) _draw_core( sls, n_points, figure, bundle_name, indiv_profile, diff --git a/AFQ/viz/plotly_backend.py b/AFQ/viz/plotly_backend.py index fbfc2a81..33e48380 100644 --- a/AFQ/viz/plotly_backend.py +++ b/AFQ/viz/plotly_backend.py @@ -229,7 +229,7 @@ def _plot_profiles(profiles, bundle_name, color, fig, scalar): yaxis_title=dict(text=vut.display_string(scalar), font=font))) -def visualize_bundles(sft, n_points=None, +def visualize_bundles(seg_sft, n_points=None, bundle=None, colors=None, shade_by_volume=None, color_by_streamline=None, n_sls_viz=3600, sbv_lims=[None, None], include_profiles=(None, None), @@ -241,12 +241,9 @@ def visualize_bundles(sft, n_points=None, Parameters ---------- - sft : Stateful Tractogram, str - A Stateful Tractogram containing streamline information - or a path to a trk file. - In order to visualize individual bundles, the Stateful Tractogram - must contain a bundle key in it's data_per_streamline which is a list - of bundle `'uid'`. + seg_sft : SegmentedSFT, str + A SegmentedSFT containing streamline information + or a path to a segmented trk file. n_points : int or None n_points to resample streamlines to before plotting. If None, no @@ -347,7 +344,7 @@ def visualize_bundles(sft, n_points=None, set_layout(figure, color=_color_arr2str(background)) for (sls, color, name, dimensions) in vut.tract_generator( - sft, bundle, colors, n_points, + seg_sft, bundle, colors, n_points, n_sls_viz=n_sls_viz): if isinstance(color_by_streamline, dict): if name in color_by_streamline: @@ -731,7 +728,7 @@ def _draw_core(sls, n_points, figure, bundle_name, indiv_profile, return line_color_untouched -def single_bundle_viz(indiv_profile, sft, +def single_bundle_viz(indiv_profile, seg_sft, bundle, scalar_name, flip_axes=[False, False, False], labelled_nodes=[0, -1], @@ -745,13 +742,9 @@ def single_bundle_viz(indiv_profile, sft, indiv_profile : ndarray A numpy array containing a tract profile for this bundle for a scalar. - sft : Stateful Tractogram, str - A Stateful Tractogram containing streamline information. - If bundle is an int, the Stateful Tractogram - must contain a bundle key in it's data_per_streamline which is a list - of bundle `'uid'. - Otherwise, the entire Stateful Tractogram will be used as the bundle - for the visualization. + seg_sft : SegmentedSFT, str + A SegmentedSFT containing streamline information + or a path to a segmented trk file. bundle : str or int The name of the bundle to be used as the label for the plot, @@ -795,7 +788,7 @@ def single_bundle_viz(indiv_profile, sft, n_points = len(indiv_profile) sls, _, bundle_name, dimensions = next(vut.tract_generator( - sft, bundle, None, n_points)) + seg_sft, bundle, None, n_points)) line_color = _draw_core( sls, n_points, figure, bundle_name, indiv_profile,