Importing Subject Specific Anatomy - BUNPC/AtlasViewer GitHub Wiki

Importing MRI anatomy in AtlasViewer is the process by which AtlasViewer searches for and assembles subject-specific segmented volumes (created by other tools, such as SPM and Freesurfer) in the same coordinate space, into the segmented volume hseg.nii. (Hseg.nii is then turned into headvol.vox which is in AtlasViewer. This resulting volume is used by AtlasViewer to run Monte Carlo simulations for forward modeling and image reconstruction.) The initial segmented volumes can be in the following file format:

  • NIFTI (usually with a .nii extension)
  • MGH (usually with a .mgz extenstion if compressed, or .mgh if not).

In addition to separate segmented volumes from which AtlasViewer can assemble a single segmented volume, AtlasViwer also accepts whole segmented volume named hseg.nii (or .mgz). This is a complete already assembled segmented volume that contains all the tissue types available.

The importing process of subject anatomy also creates surface meshes for the head and the brain surface which are used for displaying the anatomy. These meshes can be created from already available meshes such as Freesurfer's brain meshes rh.pial and lh.pial or if these are not available Freesurfer will generate the head and brain meshes from the completed segmented volume.

Lastly this process allows the user to select basic EEG reference points, Nz, Iz, LPA, RPA, Cz after which it offers to calculate all the EEG reference points, that is the 10-5 system.

Step-by-Step Instructions with an example:

1. Open AtlasViewer in the subject folder where the subject-specific anatomical files are stored.


2. Select the File menu --> Import MRI Anatomy.



3. The ImportMriAnatomy pop-up window will appear as shown below.


After the File menu selection, AtlasViewer looks for NIFTI (usually with a .nii extension) or MGH (usually with a .mgz or .mgh extenstion) files and brain surface meshes in the subject folder which it thinks corresponds to components in AtlasViewer and brings up the ImportMriAnatomy GUI. This GUI shows all the files it found and which files it thinks it corresponds to which component. It leaves blank all components for which it didn't find anything. The user is given the option to fill in the name if they know of a file that is not recognized by AtlasViewer.

Note that it is okay to leave most components blank if files for those components are unavailable. The ONLY exceptions are the non-optional components of head and brain volumes. Without the head and brain volumes files the import process will fail.

The example in the following figures shows the file selections for a child subject.


4. When satisfied with the file selections, click the SUBMIT button to start the import process.

NOTE: AtlasViewer can detect the presence of an already generated segmentation file in the subject folder and skip the assembly part. For instance, if you have your own segmented volume (hseg.nii or hseg.mgz) which was generated outside of AtlasViewer. In this case, ImportMriAnatomy GUI will fill in the 'segmented head' field if it finds a file named hseg.nii or hseg.mgz in the subject folder. If your segmented volume is named something else, then you have to fill in the 'segmented head' field manually. Lastly, to make sure that only your own segmentation file is used in the generation of all graphics components then leave all other fields blank.




5. After the anatomical files for AtlasViewer are generated, AtlasViewer asks if the user wants to select the basic reference points Nz, Iz, LPA, RPA, and Cz. It brings up the Find Refpts GUI if the user clicks OK (instead of Cancel).



NOTE also that you can launch the FindRefptsGUI dialog, re-select the 5 landmarks and regenerate the EEG 10-5 points through the menu Tools --> Reference Points --> Find Nz, Iz, RPA, LPA, Cz

6. The Find Ref Points GUI displays in red text R and L markings indicating which side of the head is left and which is right based on the direction cosines from the NIFTI headers, as shown in the following figure.


NOTE: The R and L markings indicate the subject actual left and right sides even if they appear reversed. The left and right might appear reversed because the surface is displayed in Find Ref Points GUI as is, with no modification to the coordinates to correct for some MRI volumes' mirror-image displays (in Matlab). Different MRI-processing tools (e.g, SPM, Freesurfer, Afni, etc) output different head orientations. Some appear as a mirror image - when displayed in Matlab's right-handed coordinate system - some appear as non-mirror-image. It all depends on the volume's specific orientation. BUT once the user finishes selecting the reference points in Find Ref Points GUI, AtlasViewer does correct for mirror image in the main GUI and always displays it as a non-mirror image.


7. Use the rotate and zoom buttons in the bottom control panel to position the head conveniently for selecting each reference point. Use the mouse to click on a head location and the upper control panel buttons to tell the GUI which one of the 5 reference points it is. The button turns green and the button name changes from Select to Reselect , which means you can reposition the reference point if you're not satisfied with your initial location, and click the button for the same ref point again.



8. When all 5 reference points have been selected, click DONE to save as in the figure below.



9. After clicking DONE, a pop-up window will appear and ask if you want to generate the EEG 10-5 reference points. Click OK to generate 10-5 reference points.


NOTE: If any one of the basic 5 reference points is missing a message will pop up saying that the EEG reference points cannot be calculated. At the end of the calculation, AtlasViewerGUI displays the 10-20 reference points on the head. To display other reference point sets, select the menu Tools --> Display Ref Points --> {10-20, 10-10, 10-5}.

Import an existing probe to visualize on true subject anatomy:

After successfully importing MRI anatomy in AtlasViewer, the user could import an existing probe to visualize it on the true anatomy by following these steps:

  1. Go into Tools menu --> Import Probe.
  2. Select the exiting SD file or the SD file designed in SDgui.
  3. Click the “Register Probe to Surface” button.
  4. Click to “Left” under the Rotate/Zoom Axes panel or rotate the head to visualize the probe.
  5. Unclick “Hide measurement list” and click “Show srcs/dets” in the Probe panel. Then the probe would be displayed on the true subject anatomy.

⚠️ **GitHub.com Fallback** ⚠️