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

Filter out non-diagonal affine warning #1103

Merged
merged 5 commits into from
Jul 3, 2024
Merged
Changes from 1 commit
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
112 changes: 61 additions & 51 deletions tedana/reporting/static_figures.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import logging
import os
import warnings
from io import BytesIO

import matplotlib
Expand Down Expand Up @@ -223,20 +224,23 @@ def plot_component(
# Set range to ~1/10th of max positive or negative beta
imgmax = 0.1 * np.max(np.abs(stat_img.get_fdata()))

# Save the figure to an in-memory file object
display = plotting.plot_stat_map(
stat_img,
bg_img=None,
display_mode="mosaic",
cut_coords=5,
vmax=imgmax,
cmap=png_cmap,
symmetric_cbar=True,
colorbar=False,
draw_cross=False,
annotate=False,
resampling_interpolation="nearest",
)
with warnings.catch_warnings():
tsalo marked this conversation as resolved.
Show resolved Hide resolved
warnings.filterwarnings("ignore", message="non-diagonal affine")
# Save the figure to an in-memory file object
display = plotting.plot_stat_map(
stat_img,
bg_img=None,
display_mode="mosaic",
cut_coords=5,
vmax=imgmax,
cmap=png_cmap,
symmetric_cbar=True,
colorbar=False,
draw_cross=False,
annotate=False,
resampling_interpolation="nearest",
)

display.annotate(size=30)
example_ax = list(display.axes.values())[0]
nilearn_fig = example_ax.ax.figure
Expand Down Expand Up @@ -591,32 +595,36 @@ def plot_t2star_and_s0(

# Plot T2* and S0 maps
t2star_plot = f"{io_generator.prefix}t2star_brain.svg"
plotting.plot_stat_map(
t2star_img,
bg_img=None,
display_mode="mosaic",
symmetric_cbar=False,
black_bg=True,
cmap="gray",
vmin=t2s_p02,
vmax=t2s_p98,
annotate=False,
output_file=os.path.join(io_generator.out_dir, "figures", t2star_plot),
)
with warnings.catch_warnings():
warnings.filterwarnings("ignore", message="non-diagonal affine")
plotting.plot_stat_map(
t2star_img,
bg_img=None,
display_mode="mosaic",
symmetric_cbar=False,
black_bg=True,
cmap="gray",
vmin=t2s_p02,
vmax=t2s_p98,
annotate=False,
output_file=os.path.join(io_generator.out_dir, "figures", t2star_plot),
)

s0_plot = f"{io_generator.prefix}s0_brain.svg"
plotting.plot_stat_map(
s0_img,
bg_img=None,
display_mode="mosaic",
symmetric_cbar=False,
black_bg=True,
cmap="gray",
vmin=s0_p02,
vmax=s0_p98,
annotate=False,
output_file=os.path.join(io_generator.out_dir, "figures", s0_plot),
)
with warnings.catch_warnings():
warnings.filterwarnings("ignore", message="non-diagonal affine")
plotting.plot_stat_map(
s0_img,
bg_img=None,
display_mode="mosaic",
symmetric_cbar=False,
black_bg=True,
cmap="gray",
vmin=s0_p02,
vmax=s0_p98,
annotate=False,
output_file=os.path.join(io_generator.out_dir, "figures", s0_plot),
)


def plot_rmse(
Expand Down Expand Up @@ -690,19 +698,21 @@ def plot_rmse(
"figures",
f"{io_generator.prefix}rmse_brain.svg",
)
plotting.plot_stat_map(
rmse_img,
bg_img=None,
display_mode="mosaic",
cut_coords=4,
symmetric_cbar=False,
black_bg=True,
cmap="Reds",
vmin=rmse_p02,
vmax=rmse_p98,
annotate=False,
output_file=rmse_brain_plot,
)
with warnings.catch_warnings():
warnings.filterwarnings("ignore", message="non-diagonal affine")
plotting.plot_stat_map(
rmse_img,
bg_img=None,
display_mode="mosaic",
cut_coords=4,
symmetric_cbar=False,
black_bg=True,
cmap="Reds",
vmin=rmse_p02,
vmax=rmse_p98,
annotate=False,
output_file=rmse_brain_plot,
)


def plot_adaptive_mask(
Expand Down