- MNE version:0.22.0
- operating system: Windows 10
Hello! I am new with fnirs, and I hope someone kind could help me. I want to project the blood oxygen onto the model and save it as movie, also showing the optrodes and detectors.
I noticed that ,in the visual window as below, the place I circled is save movie, but it doesn’t work when I click on it.This visualization is exactly what I want, so I am wondering if there is someway to save it as a movie.I pasted my code below.
import numpy as np
import mne
import os.path as op
import pandas as pd
import mne_nirs
from mne_nirs.experimental_design import make_first_level_design_matrix
from mne_nirs.statistics import (run_glm, statsmodels_to_results)
from mne_nirs.channels import (get_long_channels, get_short_channels)
from mne_nirs.visualisation import plot_glm_surface_projection
raw_intensity = mne.io.read_raw_snirf("sub-01_task-tapping_nirs.snirf").load_data()
raw_intensity.annotations.description[:] = [
d.replace('/', '_') for d in raw_intensity.annotations.description]
raw_od = mne.preprocessing.nirs.optical_density(raw_intensity)
raw_haemo = mne.preprocessing.nirs.beer_lambert_law(raw_od, ppf=0.1)
raw_haemo.resample(0.3)
short_chs = get_short_channels(raw_haemo)
raw_haemo = get_long_channels(raw_haemo)
design_matrix = make_first_level_design_matrix(raw_haemo,
drift_model='cosine',
high_pass=0.005,
hrf_model='spm',
stim_dur=5.0 )
design_matrix["ShortHbO"] = np.mean(short_chs.copy().pick(
picks="hbo").get_data(), axis=0)
design_matrix["ShortHbR"] = np.mean(short_chs.copy().pick(
picks="hbr").get_data(), axis=0)
glm_est = run_glm(raw_haemo, design_matrix)
cha = glm_est.to_dataframe()
cha["ID"] = 'subject'
cha["theta"] = [t * 1.e6 for t in cha["theta"]]
df_cha = pd.DataFrame()
df_cha = pd.concat([df_cha, cha], ignore_index=True)
ch_summary = df_cha.query("Chroma in ['hbo']")
ch_model = smf.mixedlm("theta ~ -1 + ch_name", ch_summary,
groups=ch_summary["ID"]).fit(method='nm')
model_df = statsmodels_to_results(ch_model, order=raw_haemo.copy().pick("hbo").ch_names)
brain = plot_glm_surface_projection(raw_haemo.copy().pick("hbo"), model_df, colorbar=True)
brain.save_movie('1.mp4',time_dilation=20, tmin=0.05, tmax=0.16, framerate=10,
interpolation='linear', time_viewer=True)
brain.add_sensors(raw_haemo.info, trans='fsaverage', fnirs=['channels', 'pairs', 'sources', 'detectors'])
If the visualizations currently in use can not be saved as movie, can someone tell me about other ways to achieve my desired effect? I would be very grateful.