Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

0.2.0 #51

Merged
merged 4 commits into from
Sep 23, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified examples/figures/showcase.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion examples/showcase_image.py
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@
nodecmap='Dark2',
nodecolor='yeo7networks',
nodealpha = 0.8,
subtitle = 'Highlight a community',
subtitles = 'Highlight a community',
highlightnodes={'yeo7networks': 'Cont'},
highlightlevel=0.95,
fig=fig, ax=ax,
Expand Down
2 changes: 1 addition & 1 deletion netplotbrain/__version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "0.2.0-alpha7"
__version__ = "0.2.0"
2 changes: 1 addition & 1 deletion netplotbrain/plot.py
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ def plot(nodes=None, fig: Optional[plt.Figure] = None, ax=None, view: str = 'L',
hemisphere=hemi_frame,
azim=azim[fi], elev=elev[fi],
**profile)

# Template voxels will have origin at 0,0,0
# It is easier to scale the nodes from the image affine
# Then to rescale the ax.voxels function
Expand Down
6 changes: 3 additions & 3 deletions netplotbrain/plotting/plot_parcels.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,9 @@ def _get_nodes_from_nii(img, nodes=None, voxsize=None, template=None):
z_coord = []
for r in rois:
allcoords = np.where(imgdata == r)
x_coord.append(np.median(allcoords[0]))
y_coord.append(np.median(allcoords[1]))
z_coord.append(np.median(allcoords[2]))
x_coord.append(np.mean(allcoords[0]))
y_coord.append(np.mean(allcoords[1]))
z_coord.append(np.mean(allcoords[2]))

# If nodes is None, define the dataframe
if nodes is None:
Expand Down
3 changes: 2 additions & 1 deletion netplotbrain/utils/coloring.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def _highlight_nodes(nodes, nodecolor, highlightnodes, **kwargs):
elif isinstance(highlightnodes, str):
if highlightnodes not in nodes:
raise ValueError('If highlightnodes is a str it must be a column in nodes')
highlightnodes = nodes[highlightnodes].values()
highlight_idx = nodes[highlightnodes].values
else:
highlight_idx = np.zeros(len(nodes))
highlight_idx[highlightnodes] = 1
Expand Down Expand Up @@ -127,6 +127,7 @@ def _get_colorby_colors(df, colorby, datatype='node', **kwargs):
# Get relevant kwargs
cmap = kwargs.get(datatype + 'cmap')
color_vminvmax = kwargs.get(datatype + 'colorvminvmax')
#TODO: Add flag if colours are in column
colortype = _detect_coloring_type(df, colorby)
cmap = cm.get_cmap(cmap)
if colortype == 'discrete':
Expand Down
Binary file modified tests/baseline/test_edges_df.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/baseline/test_highlightedges_df.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/baseline/test_highlightedges_np.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/baseline/test_printlayout.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.