Visual Neuroscience Lab
  • Home
  • Neurodesktop
  • Behavioral
  • Labmeeting
  • DICOM to GLM
  • MRI
  • People
  • Internship
  • Other Topics
  • Archive
  1. MRI: from DICOM to GLM Analysis
  2. 05 - Removing Noise Scan
  • Home
  • Neurodesktop
  • MRI: from DICOM to GLM Analysis
    • 00 - Overview
    • 01 - DICOM to BIDS
    • 02 - Check IntendedFor field of the fmap’s JSON
    • 03 - T1w for PBn
    • 04 - Defacing
    • 05 - Removing Noise Scan
    • 06 - fMRIprep
    • 07 - Retinotopic Mapping
    • 08 - first level GLM
    • 09- second level GLM
    • Troubleshooting
  • MRI
    • MRI-Studies: General Information
    • 3D printing a brain
    • 7T anatomical analysis on neurodesk
    • MRI BIDS and OSF
    • fMRIprep analysis
    • MNI space
    • Old MRI setup
    • Update to the MRI lab setup
    • Physiological noise correction
  • Behavioral
    • Vision tests
    • BIDS for behavioral studies
    • Custom-built chin rests
  • People
    • Stipends and prizes for master and PhD students
    • Coffee time
    • Participant compensation
    • Things to do if you are leaving the lab
    • Scientific writing in practice
    • Research funding opportunities
  • Internship
    • Pflichtpraktikum
    • Internship Checklist
    • internship/claustrum_segmentation.qmd
  • Other Topics
    • Calculating a priori sample size using G Power
    • Gamma correction
    • Contribute to the website
    • Older ways to access the server
  • Labmeeting
  • Archive

On this page

  • 1 Check for noise scan in nifti file
    • 1.1 Open freeview
    • 1.2 Load a functional volume
    • 1.3 Check for noise Scan
  • 2 Remove noise scan from the data
  • 3 Confirm successful removal
  • 4 Next steps
  1. MRI: from DICOM to GLM Analysis
  2. 05 - Removing Noise Scan

05 - Removing Noise Scan

MRI
Preprocessing
Neurodesk
Step by step description of how to remove the denoising scan from your data
Author

MG

Published

March 8, 2025

For this step, you need to already have nifti files! If you currently only have DICOM files, please convert them to nifti’s first!

Depending on the sequence used in the scanner session, you might have data that were acquired with a denoising sequence. This is sometimes done, since it doesn´t take much time in the scanner, but you have the ability to denoise the data if it turns out to be necessary.

But by default, we don´t use this denoising information. Additionally, some applications (like fmriprep) cannot process data with this additional information!

Thus, before running our default pipeline with fmriprep, we have to remove this information from our scans!

1 Check for noise scan in nifti file

1.1 Open freeview

You can check if the denoising sequence was used in for your data, by checking the functional scans in freeview. For this, you first have to source freesurfer and then open freeview:

  1. Open a terminal (Monitor Icon at the bottom left on neurodesk) Open Terminal

  2. Type ml freesurfer and press enter

  3. Type freeview and press enter (from time to time, it can take a while until freeview opens, be patient! It is also possible, that some messages about runtime are printed in the terminal, but that is nothing to worry about!) Opening freeview

\(\to\) When freeview opened successfully, it should look like this: Freeview Opened

1.2 Load a functional volume

Now you have to look at a functional scan to see if there is a denoising scan at the end.

For this, select File > Load Volume (top left corner in freeview): File > Load Volume

A new window opens, asking you to Select volume file. Either type in the path(s) to your/a functional scan manually, or start by clicking on the folder symbol Click on Folder Symbol

Navigate to your func directory in your BIDS, select one of the nifti files of one of the runs and press Open afterwards Select functional nifti file of a run in your bids directory

Now, with the field Select volume file specified with the path(s) to the nifti file, you can click OpenOpen Volume

When the volume loaded, it should see some kind of data and something that looks like a brain: First Frame of Functional Scan

1.3 Check for noise Scan

To check if a noise scan is included in you data, use the slider next to Frames (left side, roughly in the middle), to navigate to the last frame. If a denoising sequence was used during data acquisition in the scanner, this frame looks “empty”. Toggle between the last and second to last frame, to visualize the difference even more Denoising Included in your Scan

If you confirmed a noise-scan in one functional run, they will probably be there for all your runs. It might be good to check every run anyway.

2 Remove noise scan from the data

You confirmed noise information being present in your data in the last section. To run fmriprep, we have to remove this information. To achieve this:

  1. Get the following script and copy it to your own storage: /shared/website/remove_noiseScan.sh

  2. Open the script (left-click + gedit)

  3. Adjust the variables subject_ids and constant_path

    • with constant_path as it is right now, every subdirectory in bids would need to start with sub-1400
    • then it would look for all subjects indicated in subject_ids
  4. run the script (either cd to the directory and run bash ./remove_noiseScan.sh or from anywhere run bash /path/to/remove_noiseScan.sh)

  5. After the script starts, you have to indicate if you want to remove the last frame from the fmap (Press 1), from the functional runs (Press 2), or from both (Press 3)

Information: this code basically searches for all files in your working directory that end on _bold.nii.gz (when functional files are processed) or _epi.nii.gz (when the fmap is processed), gets the information about how many frames it includes using mri_info and then removes the last frame (which we confirmed to be the noise scan prior)

This process can take a while, especially in the beginning. Don´t get stressed out, when nothing happens for a while and only info statements get printed, be patient!

After some time, you will get the information, that the first nifti is processed. This will be repeated for all files in your working directory that end in _bold.nii.gz/_epi.nii.gz. Remove Noise from all nii.gz files

3 Confirm successful removal

To confirm that the noise scan was removed, start freeview, load a functional scan (or the fmap) and finally check the last frame. The original “empty” frame should now be removed and final scan should picture “normal” data.Noise Scan removed

4 Next steps

Congratulations, you successfully removed the noise scans from your functional and fmap and you are one step closer to analyzing your data!

To continue in your journey to your Analysis, please return to the Overview-Page to check what to do next.

Alternatively, here is a list of potential next steps to continue with

  1. Defacing

  2. Check JSON of fmap

  3. Provide participants with their T1w file

  4. run fmriprep

Back to top