This manual describes the study protocol for neurofeedback on sustained attention in ADHD, conducted by Alexander Cohen's Lab of Translational Neuroimaging at Boston Children's Hospital. This study uses the rt-Cloud platform (https://github.com/brainiak/rt-cloud) and adapts stimulus presentation scripts from the multivariate and univariate real-time functional imaging (MURFI) program (https://github.com/cccbauer/MURFI-user-manual). For more detailed instructions on how to use the rt-Cloud platform, see: https://rt-cloud.readthedocs.io/en/latest/index.html.
Source Documentation: https://rt-cloud.readthedocs.io/en/latest/index.html
**Note: every year security certificates expire on January 1. To share the renewed version with other machines, connect via ethernet cable and adapt the following code to your machine: scp -r certs [email protected]:/certificates/folder
• May need to edit permissions in web browser
• Firefox instructions: https://support.mozilla.org/en-US/kb/Certificate-contains-the-same-serial-number-as-another-certificate
• Chrome: settings → privacy and security → manage certificates → authorities → import → import 1000.pem
• If you get errors with certificate permissions, you can run your commands with the --test flag
• Instead of logging in using the username rt, use "test" with password "test"
DATA_STREAMER: runs on machine that receives/sends DICOMs (i.e., the MRI console) • Watches for new DICOM brain images and sends them to the machine analyzing the data
DATA_ANALYSER: runs on machine that analyses data in real-time (i.e., the Dell laptop) • Runs experimenter’s script to process DICOMs • Provides a web-based user interface for experimenter control
ANALYSIS_LISTENER: runs on machine that runs presentation software (i.e., personal laptop)
• Listens for results from DATA_ANALYSER to inform experiment presentation (i.e., from PsychoPy)
- Connect Connection 1 Cable (NO ADAPTER) to the Dell Computer
- Connect Connection 2 w/ Adapter to the Mac Computer
Note: Don't Need to Use the Ethernet cable usually used to connect the two computers.
- type
pingdell
from the Macbook - type
pingmac
from the Dell computer - to test the connection with the scanner, type
ping 192.168.2.1
orpingmri
from the neurofeedback laptop.
- Attach C2G extension cable to the research PC cord
- Attach cord to Macbook
- Click Research PC Button (Push down 1-2 seconds, wait a few seconds), make sure all three lights (keyboard, audio, cable) transfer. - The top button can be yellow, the bottom two must be green.
- slices = 1, Trigger = 1, volumes = 364
- In Options Menu, set USB Mode = "HID"
- everything is ‘1’
- works for MSIT and NF NOTE: quit after each run and restart, as number of volumes is higher than needed
- Open Terminal
- Type
start
and put in the password - Type
analyse
and click the link to open Docker
- Open Terminal
- After setting up Dell Computer, type
listener
- In a new terminal, type
psychopy
- Open
msit_neurofeedback.py
- click play
- Quit button box and start again
- start
rest.py
from PsychoPy app - during the first resting state, run the MSIT ACC localizer script on the neurofeedback laptop
a. type
nifti
into a terminal to convert the dicoms to nifti b. typelocalize_acc
,localize_motor
,localize_motor_hotspot
or any other localizer alias created
- Quit button box and start again
- Run the
rt_feedback_single_roi.py
script from the PsychoPy app.
- This script will begin as soon as it receives the first pulse from the scanner, and it will begin sending feedback as soon as it receives a json file with the neurofeedback score.
- Click 'run' in the web interface on the neurofeedback laptop. The script will start when it sees the first DICOM image.
- NOTE: Change the run number from 1 to 2 to 3 depending on which run it is
- NOTE: Quit button box and start again after every run
- Open
msit_neurofeedback.py
- click play
After all 3 runs are finished for the session, click "finalize session" in the web browser.
- Connect the neurofeedback and stimulus laptops to the two ethernet cables that are at the scanner. If you haven't set up the ethernet connections in the past, configure them manually in your laptop's settings, making sure the IP address is set to 192.168.2.6 and the net mask is 255.255.255.240.
- Make sure the IP addresses are 192.168.2.5 for the neurofeedback laptop and 192.168.2.6 for the stimulus laptop. The scanner's IP address should always be 192.168.2.1. To check the IP address on Ubuntu, type:
ifconfig
and to check on Mac, type:ipconfig
. NOTE: To Ping Dell and Mac: type ping 192.168.2.5 from your laptop and ping 192.168.2.6 from the Dell - Have the MR tech connect the scanner to the neurofeedback laptop's samba share. From File Explorer, right-click on This PC, then select Add A Network Location. Follow the directions to enter the samba share address: //192.168.2.5/sambashare. When it asks for credentials, click on guest. • After it is set up once, you should be able to click on it in the left sidebar, but you may have to go through this setup again if it gets deleted from the scanner console.
- To test the connection with the scanner, type
ping 192.168.2.1
from the neurofeedback laptop.
- Plug the "Research Computer" LCD Monitor Cord into the computer and click the "Research Computer" Button on the Box next to the Cord.
- Click Research PC Button (Push down 1-2 seconds, wait a few seconds), make sure all three lights (keyboard, audio, cable) transfer. The top button can be yellow, the bottom two must be green.
- Make sure that NNL (Button Box): go to Options-> slices = 1, Trigger = 1, volumes = 364, USB Mode = "HID"
- Hit Start, should see screen with brain
NOTE: Once you plug the laptop into the LCD monitor, you should be able to use the laptop screen while projecting the stimuli onto the LCD. However, this has posed some problems. If it does, set your display to 'mirror'. The script should work now, but the participant will be able to see anything you are seeing on the laptop screen.
You can set up the rt-cloud connections while the MR tech is running the anatomical scans. To do this:
-
On the Neurofeedback (Dell) laptop, type
start
in Terminal. If this alias doesn't work, type:sudo smbd nmbd start
-
Start DATA_ANALYSER on Neurofeedback laptop: You should only have to type
analyse
. However, if this command doesn't work, try typing:PROJ_DIR=/home/rt/rtcloud-projects/adhd_rt/ docker run -it --rm --link-local-ip=192.168.2.5 -p 8888:8888 --cap-add=SYS_ADMIN -v ~/certs:/rt-cloud/certs -v /home/rt/rt-cloud/projects/adhd_rt:/rt-cloud/projects/adhd_rt -v /home/rt/sambashare:/home/rt/sambashare julianawall/adhd_rtcloud scripts/data_analyser.sh -p adhd_rt --subjectRemote
or
PROJ_DIR=/home/rt/rtcloud-projects/adhd_rt/ docker run -it –rm –link-local-ip=192.168.2.5 -p 8888:8888 -v ~/certs:/rtcloud/certs -v $PROJ_DIR:/rt-cloud/projects/adhd_rt brainiak/rtcloud:latest scripts/data_analyser.sh -p adhd_rt –subjectRemote –dataRemote
If you get errors around this step or a little later, it would be good to check what is going on in this step and look for errors here.
• This should pop up a link that you can click on, which will bring you to the login page. Enter username and password, then, in the second tab, click "initialize session".
- Start ANALYSIS_LISTENER on stimulus laptop:
listener
if that doesn't work, do these four commands in order:
WEB_IP=192.168.2.5
conda activate rtcloud
cd rt-cloud/
bash scripts/analysis_listener.sh -s $WEB_IP:8888 -u rt
Once the stimulus and neurofeedback laptops are connected, this message will pop up on the stimulus laptop's terminal:
INFO:root:Connected to: wss://192.168.2.5:8888/wsSubject
Connected to: wss://192.168.2.5:8888/wsSubject
Also, in the righthand corner of the web interface, you should see 'subjConn: connected'
- Start PsychoPy on Macbook: • In a new terminal:
psychopy
if this alias doesnt work, do:
conda activate rtcloud
psychopy
Note: Make sure to stay in Psychopy window, do not navigate away from screen
1. start psychopy, 2. participant reads instructions and presses button, 3. then scanner can be started
Right Thumb = volume up (regardless of keyboard)
Right Index Finger = c, 3
Left Thumb = a, 2
Left Index Finger = b, 1
- The first task-based scan is the multi-source interference task (MSIT). The stimuli for this task will be presented using PsychoPy. To start the task, type:
psychopy
if the above alias doesn't work, do:
conda activate rtcloud
psychopy
and start MSIT_neurofeedback.py from the app. Make sure to check which monitor is selected.
Note: Have every component / machine listening and ready for the scanner before having the MRI Tech start the scanner.
- After the MSIT is a resting-state scan. Press "a" to end instructions screen, and have it wait for scanner Make sure to repeat this step for each resting-state scan throughout the session.
- start rest.py from PsychoPy app
- During the first resting state, run the MSIT ACC localizer script on the neurofeedback laptop.
Start by converting the DICOMs to nifti:
- type
nifti
into a terminal. It will ask you to either choose from a list of directories in the sambashare folder (most recent first) or provide the name of the directory yourself. - If this doesn't work:
Copy the name of the directory with the DICOMs, then type this command:
conda activate rtcloud dcm2niix /home/rt/sambashare/{DICOM directory}
To localize the subject's anterior cingulate cortex, type localize_acc
.
if the acc localizer doesn't work, try:
python3 /home/rt/rt-fMRI_Neurofeedback_of_ADHD/adhd_rt/msit_preproc_script.py {subject id}
To localize the subject's motor cortex, type localize_motor
.
if the motor localizer doesn't work, try:
python3 /home/rt/rt-fMRI_Neurofeedback_of_ADHD/adhd_rt/msit_preproc_script_motor_cortex.py {subject id}
- Before moving on, it is a good idea to check that the mask looks okay. Pull up the new mask in FSLeyes with the functional data as the background.
** Note: The MSIT will be repeated at the end, but you don't need to run this script the second time.
-
Neurofeedback runs
-
Run the rt_feedback_single_roi.py script from the PsychoPy app. This script will begin as soon as it receives the first pulse from the scanner, and it will begin sending feedback as soon as it receives a json file with the neurofeedback score.
-
Click 'run' in the web interface on the neurofeedback laptop. The script will start when it sees the first DICOM image.
NOTE: Change the run number from 1 to 2 to 3 depending on which run it is
-
After all 3 runs are finished for the session, click "finalize session" in the web browser.
- neurofeedback laptop: the Dell laptop running the data_analyser script
- stimulus laptop: laptop that is running PsychoPy scripts
- session: entire scan, each time a participant visits 2BP (participants will come for 3-8 sessions)
- run: single neurofeedback scan within a session (there are 3 during each session)
- block: single round of neurofeedback during a run (there are 2 blocks in each run)