Difference between revisions of "Correcting Volume Conductor Segmentations"

From BESA® Wiki
Jump to: navigation, search
(Created page with "Using BESA MRI it is possible to compute EEG leadfields using individual, realistic models of a subject's head. These models are automatically created based on a T1-weighted M...")
 
 
(14 intermediate revisions by 4 users not shown)
Line 1: Line 1:
 +
{{BESAInfobox
 +
|title = Module information
 +
|module = BESA MRI
 +
|version = BESA MRI 2.0
 +
}}
 +
 +
== Introduction ==
 +
 
Using BESA MRI it is possible to compute EEG leadfields using individual, realistic models of a subject's
 
Using BESA MRI it is possible to compute EEG leadfields using individual, realistic models of a subject's
 
head. These models are automatically created based on a T1-weighted MRI and optionally an
 
head. These models are automatically created based on a T1-weighted MRI and optionally an
Line 22: Line 30:
 
BESA MRI and used for the generation of the FE meshes and, thus, also for the individual FEM leadfield
 
BESA MRI and used for the generation of the FE meshes and, thus, also for the individual FEM leadfield
 
computation. This procedure is described in detail below.
 
computation. This procedure is described in detail below.
 +
 +
== Exporting the Data Files from BESA MRI ==
 +
 +
To manually correct the automatically created segmentation several data files have to be exported from BESA MRI. In particular, the segmentation mask, the T1- and the T2-weighted image must be available in a format which can be read by third-party tools. To create those data files, please, follow these steps:
 +
 +
* Switch on the output of the user accessible image files and segmentation masks. To do this, using any text editor open the project file which is located in the project data folder under <tt>'''\MRIFiles\ProjectFiles\<Project name>.seg'''</tt>. Find the line starting with <tt>'''UseUserModSegm'''</tt> in the <tt>'''[VolCondSegm]'''</tt> section. Modify the line so that it says '''<tt>UseUserModSegm=1</tt>'''. If the line does not exist add it to project file.
 +
* Open a segmentation project in BESA MRI and run the volume conductor segmentation. If the project was already finished press the '''Modify''' button to re-load the project data.
 +
* After the volume conductor segmentation has finished the segmentation mask, a copy of the T1-weighted image and, if available, a copy of the T2-weighted image are written to the temporary project folder.
 +
* '''Save the project''' to store the data to the BESA MRI project data folder.
 +
* The user accessible image files and masks can now be found in the following subfolders of your project folder:
 +
** <tt>\MRIFiles\VMRFiles\<Project name>_VCS_WS.hdr</tt>
 +
** <tt>\MRIFiles\VMRFiles\<Project name>_T1_WS.hdr</tt>
 +
** <tt>\MRIFiles\VMRFiles\<Project name>_T2_WS.hdr</tt>
 +
* For each of the files ending on '''.hdr''' you will also find an '''.img''' file to complete the Analyze image.
 +
 +
== Modifying the Mask in A Third-party Tool ==
 +
 +
There are several third-party tools available which are able to read the data from Analyze format, and which allow to manually correct the segmentation mask (e.g., [https://fsl.fmrib.ox.ac.uk/fsl/fslwiki/FslView FslView] and [http://www.itksnap.org/pmwiki/pmwiki.php ITK-SNAP]).
 +
 +
Here, as an example it will be described how [https://fsl.fmrib.ox.ac.uk/fsl/fslwiki/FslView FslView] can be used to correct the mask.
 +
 +
* Start '''FslView'''.
 +
* Load the T1-weighted MRI and optionally the T2-weighted MRI.
 +
* Load the volume conductor segmentation mask.
 +
* On the bottom of the screen there will be a selection window in which the currently active data set can be selected. Select the segmentation mask here.
 +
* Click the info button in the selection window and choose an suitable color scale for the mask.
 +
* Uncheck the check box next to the lock in the selection window. This will unlock the mask, so that it can be modified.
 +
* Choose the mask tool (pen icon) to modify the mask.
 +
* If the mask tool was chosen the label, that is to be painted, can be selected in the upper tool bar.
 +
* The numeric labels correspond to the tissues in the mask according to the following list:
 +
** Background: 0
 +
** Scalp: 1
 +
** Skull: 3
 +
** CSF: 5
 +
** Brain: 7
 +
* This means, if you want to mark some voxels as skull set the ''Pen Value'' in the tool bar to 3 and paint the voxels in the displayed mask.
 +
* For comparison with the underlying MRI the opacity of the mask can be changed using the slider in the selection window.
 +
* After you have finished modifying the segmentation mask save it using the ''File &rarr; Save as ...'' command.
 +
 +
'''Please make sure that the saved mask is still correctly oriented, especially, with regard to a potential left-right flip.'''
 +
 +
'''In addition, ascertain that the image parameters (dimensions and voxels size) are exactly the same in the modified, saved image header as in the original image header. If this is not the case then BESA MRI will ignore the modified segmentation.'''
 +
 +
== Using the Modified Segmentation Mask in BESA MRI ==
 +
 +
After saving the mask copy it back to the project folder where the original segmentation was written (i.e.,
 +
'''<tt>MRIFiles\VMRFiles\<Project name>_VCS_WS.hdr</tt>'''). Please note, that both, the '''*.hdr''' and the '''*.img''' file,
 +
have to be copied.
 +
 +
Next, start BESA MRI and again open the segmentation project associated with the corrected mask. If the
 +
segmentation project has been finalized before, press the '''Modify''' button to re-load the project data.
 +
Now during the volume conductor workstep the manually corrected segmentation mask will be read. It
 +
replaces the original automatically computed segmentation mask, and the modified mask will be used in
 +
the following substep for the generation of the FE mesh, the FE surfaces and the source space
 +
information.
 +
 +
After finalization save the project. This will also save the manually corrected segmentation mask as the
 +
segmentation mask that was used for this project. The ''FE mesh'' and ''source space information'' now based
 +
on the manually corrected segmentation can finally be used in a coregistration project to compute the
 +
individual FEM leadfield.
 +
 +
[[Category:MRI]]

Latest revision as of 16:47, 4 March 2024

Module information
Modules BESA MRI
Version BESA MRI 2.0

Introduction

Using BESA MRI it is possible to compute EEG leadfields using individual, realistic models of a subject's head. These models are automatically created based on a T1-weighted MRI and optionally an additional T2-weighted MRI. The first step of the model creation is the segmentation of the head into the different tissues which are relevant for the EEG forward problem. This step is called the volume conductor segmentation. In BESA MRI a fully automatic, robust procedure is implemented which in general delivers very accurate segmentations.

In some rare cases, however, it might happen that the automatic segmentation result contains inaccuracies and might, thus, be considered as inadequate. Segmentation problems might occur for data sets with atypical anatomy, for example, data sets containing brain lesions. In these data sets the incorporated anatomical priors are not consistent with the anatomy of the subject or patient. This might lead to errors.

As an automatic segmentation of lesion data sets is currently not possible an alternative way of generating an adequate segmentation is to manually correct the segmentation mask, and then use the corrected segmentation mask as the basis for the FE mesh generation. This article explains how BESA MRI can be used to generate individual FEM leadfields based on a corrected volume conductor segmentation mask.

The procedure runs roughly as follows: The automatically generated segmentation mask and the associated T1 and T2 images are written to Analyze files, which can be read by many 3rd party tools. A suitable 3rd party tool can then be used to modify the segmentation mask. The modified mask is read by BESA MRI and used for the generation of the FE meshes and, thus, also for the individual FEM leadfield computation. This procedure is described in detail below.

Exporting the Data Files from BESA MRI

To manually correct the automatically created segmentation several data files have to be exported from BESA MRI. In particular, the segmentation mask, the T1- and the T2-weighted image must be available in a format which can be read by third-party tools. To create those data files, please, follow these steps:

  • Switch on the output of the user accessible image files and segmentation masks. To do this, using any text editor open the project file which is located in the project data folder under \MRIFiles\ProjectFiles\<Project name>.seg. Find the line starting with UseUserModSegm in the [VolCondSegm] section. Modify the line so that it says UseUserModSegm=1. If the line does not exist add it to project file.
  • Open a segmentation project in BESA MRI and run the volume conductor segmentation. If the project was already finished press the Modify button to re-load the project data.
  • After the volume conductor segmentation has finished the segmentation mask, a copy of the T1-weighted image and, if available, a copy of the T2-weighted image are written to the temporary project folder.
  • Save the project to store the data to the BESA MRI project data folder.
  • The user accessible image files and masks can now be found in the following subfolders of your project folder:
    • \MRIFiles\VMRFiles\<Project name>_VCS_WS.hdr
    • \MRIFiles\VMRFiles\<Project name>_T1_WS.hdr
    • \MRIFiles\VMRFiles\<Project name>_T2_WS.hdr
  • For each of the files ending on .hdr you will also find an .img file to complete the Analyze image.

Modifying the Mask in A Third-party Tool

There are several third-party tools available which are able to read the data from Analyze format, and which allow to manually correct the segmentation mask (e.g., FslView and ITK-SNAP).

Here, as an example it will be described how FslView can be used to correct the mask.

  • Start FslView.
  • Load the T1-weighted MRI and optionally the T2-weighted MRI.
  • Load the volume conductor segmentation mask.
  • On the bottom of the screen there will be a selection window in which the currently active data set can be selected. Select the segmentation mask here.
  • Click the info button in the selection window and choose an suitable color scale for the mask.
  • Uncheck the check box next to the lock in the selection window. This will unlock the mask, so that it can be modified.
  • Choose the mask tool (pen icon) to modify the mask.
  • If the mask tool was chosen the label, that is to be painted, can be selected in the upper tool bar.
  • The numeric labels correspond to the tissues in the mask according to the following list:
    • Background: 0
    • Scalp: 1
    • Skull: 3
    • CSF: 5
    • Brain: 7
  • This means, if you want to mark some voxels as skull set the Pen Value in the tool bar to 3 and paint the voxels in the displayed mask.
  • For comparison with the underlying MRI the opacity of the mask can be changed using the slider in the selection window.
  • After you have finished modifying the segmentation mask save it using the File → Save as ... command.

Please make sure that the saved mask is still correctly oriented, especially, with regard to a potential left-right flip.

In addition, ascertain that the image parameters (dimensions and voxels size) are exactly the same in the modified, saved image header as in the original image header. If this is not the case then BESA MRI will ignore the modified segmentation.

Using the Modified Segmentation Mask in BESA MRI

After saving the mask copy it back to the project folder where the original segmentation was written (i.e., MRIFiles\VMRFiles\<Project name>_VCS_WS.hdr). Please note, that both, the *.hdr and the *.img file, have to be copied.

Next, start BESA MRI and again open the segmentation project associated with the corrected mask. If the segmentation project has been finalized before, press the Modify button to re-load the project data. Now during the volume conductor workstep the manually corrected segmentation mask will be read. It replaces the original automatically computed segmentation mask, and the modified mask will be used in the following substep for the generation of the FE mesh, the FE surfaces and the source space information.

After finalization save the project. This will also save the manually corrected segmentation mask as the segmentation mask that was used for this project. The FE mesh and source space information now based on the manually corrected segmentation can finally be used in a coregistration project to compute the individual FEM leadfield.