Topographic plots in MNE-NIRS

  • MNE-version: 1.6.1
  • MNE-NIRS version: e.g. 0.5.0
  • operating system: Windows 11

Why are my topographic plots coming outside the head and zoomed out so much? When i load my nirx data that is basically a folder contain some files and two .wl files, it is showing the topographic plots like this.

Here is my code where i loaded the dataset and ran a glm model over it on jupyter notebook:

import mne
import mne_nirs 

#For ignoring depreciations
import warnings
from cryptography.utils import CryptographyDeprecationWarning
warnings.filterwarnings(action='ignore', category=CryptographyDeprecationWarning)
 
#Import required libraries - os for interacting with the os and matplotlib for visualizations
import os 
import matplotlib.pyplot as plt
# %matplotlib notebook
%matplotlib qt

#Loading the directory or folder
fname='C:/Users/Yameen/mne_data/infinity-walking-data/Abubakar_2020-09-20/2020-09-20_Exp01'
raw_intensity = mne.io.read_raw_nirx(fname, preload=True, verbose=None)

print("\nYour dataset has been loaded! Here is the visualization for it:")
plt.rcParams["figure.figsize"]= (6,6) #w,h
# raw_intensity.plot_sensors()
#raw_intensity.plot()

#Code for GLM

#Imports
import numpy as np
from mne_nirs.experimental_design import make_first_level_design_matrix
from mne_nirs.statistics import run_glm
from mne_nirs.channels import (get_long_channels,
                               get_short_channels,
                               picks_pair_to_idx)
from nilearn.plotting import plot_design_matrix


#Cleaning up annotations
#raw_intensity.annotations.rename({'0': 'Rest', '1': 'Walking'})
#raw_intensity.annotations.set_durations(5)
raw_intensity.annotations.set_durations(5)
raw_intensity.annotations.rename({'2.0': 'Rest',
                                  '3.0': 'Thumb',
                                  '4.0': 'Index',
                                  '5.0': 'Middle',
                                  '6.0': 'Ring',
                                  '7.0': 'Little',
                                  '8.0': 'Final Rest'
})
unwanted = np.nonzero(raw_intensity.annotations.description == '1.0')
raw_intensity.annotations.delete(unwanted)


montage = mne.channels.make_standard_montage('standard_1005')
raw_intensity.set_montage(montage)

# View the position of optodes in 2D to confirm the positions are correct.
raw.plot_sensors()


#Converting the raw density to optical density
raw_od = mne.preprocessing.nirs.optical_density(raw_intensity)

#Plotting
plt.rcParams["figure.figsize"]= (6,6) #w,h
print("Converting to optical densities:")
#raw_intensity.plot()
#print(dataset.info)

#Converting the optical densities to concentrations
from mne.preprocessing.nirs import beer_lambert_law
print("Now converting the optical densities into concentration with the help of Modified Beer-Lambert's Law")

#Using beer_lambert_law for converting into haemoglobin conentrations
raw_haemo = mne.preprocessing.nirs.beer_lambert_law(raw_od) 
print("---------------------------------------------------------")

##Plotting
print("Converting to the haemoglobin concentrations:")
#raw_haemo.plot()
#print(raw_haemo.info)
#return raw_haemo

#Selecting short channels and long channels
#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,  # Must be specified per experiment
                                   hrf_model='spm',
                                   stim_dur=5.0)

channels_of_interest = ['S1_D1 hbo', 'S1_D1 hbr', 'S8_D6 hbo', 'S8_D6 hbr'] 
data_subset = raw_haemo.copy().pick(picks=channels_of_interest)
glm_est = run_glm(data_subset, design_matrix)

#Fitting glm to all data and viewing topographic distribution
glm_est = run_glm(raw_haemo, design_matrix)
glm_est.plot_topo(conditions=['Rest', 'Thumb'])

Please help me if you can, I need to know how to get the topographic views inside and more zoomed in. I tried with the sphere parameter inside the plot_topo function , it doesnt work. Anybody who knows how to solve it, would really appreciate your help.

Thanks in advance,
Yameen

@rob-luke is the fNIRS expert around here :slight_smile: Maybe he has some thoughts!