Creating Masks

How to adapt a mask file in BrainVoyager

Using masks (either based on anatomical or functional definition) is a reasonable approach to limit the multiple comparisons problem within your statistical analysis.

The following parapraphs describe an approach to adapt previously created mask files within BrainVoyager QX. Although there is to direct way to load an .msk file, we can use the following simple workaround to adapt a mask file.

First we open a Talairach VMR file. It has been previously brainpeeled (during the automatic inhomogeneity correction).

We load a previously created mask file as a secondary VMR (“File” menu).

The mask is displayed in yellow.

We save the secondary VMR as a “real” VMR (File menu). Currently the mask file is only represented as a temporary VMR and we cannot interact with it (except showing it).

We save the file as “BrainMask.vmr”

We open the new “BrainMask.vmr”.

Now we are able to interact with the voxels included in the mask-based VMR. We have to turn the yellow color (numerical value 235) into blue (numerical value 240) to be able to adapt the voxels and the save the result as a new VOI (and finally mask file). We open the Segmentation tab of the 3D Volume tools and enter 235 into the “Min” and “Max” fields. We use the “Range” button to fill all the yellow voxels with blue in one step.

Now we are ready to adapt the voxels. To allow an optimal / guided adaptation, we load the original Talairach VMR as a secondary VMR.

By using the “F9” button we blend in the mask-based VMR and the original Talairach VMR this way, we just see the outline of the mask-based VMR.

We enable to drawing tool on the Segmentation tab. We can adapt the size of the drawing tool as well as the drawing style (2D vs 3D).

It is usually helpful to zoom into one of the slice views (e.g. axial) to adapt the mask-based VMR in a slice-by-slice fashion.

In this case, we also remove the cerebellum part of the mask-based VMR.

In a couple of minutes, we can e.g. clean the “edges” a bit an also remove the cerebellum from the mask-based VMR.

Now we are ready to turn the adapted VMR into a VOI. We open the Options of the Segmentation tab. We click the “Define VOI” button.

Now we turn the VOI into a new mask file by opening the options of the VOI tool and switching to the “VOI Functions” tab. We use the “Create MSK...” button. Make sure the Use “Use selected VOIs” radio button is checked when more than one VOI is saved in the VOI file.

The new mask file is again visualized in yellow and the number of voxels included is displayed in the “Info” tab.

As a test, we use the original as well as the adapted mask within the same single run GLM analysis. In the next screenshot, both result maps are displayed side by side (original mask used on the left). In this case, approximately 8000 voxels have been removed based on the mask adaptation.

 

Grey Matter Mask ("quick and dirty")

First, we have to load a VMR, in this case a dataset in Talairach space.

To get a quick grey matter selection without using the automatic segmentation, we peel the brain out of the head using the corresponding entry in the “Volumes” menu.

Notice that this procedure may not automatically work out in every dataset. The procedure relies on a proper data quality (esp. with respect to the distribution of intensities in the different matter types). The user can partially influence this when working with the contrast and brightness settings in BrainVoyager. We save the result as a new VMR.

The resulting VMR includes white as well as grey matter. To “get rid“ of the white matter, we have to mark it first, as is explained in this article.

To get rid of the white matter, we use the “Reload Non-Marked” button to get rid of the marked white matter.

We save the new dataset.

The resulting VMR is nicely stripped off the skull as well white matter. Now, we want to mark the grey matter to be able to finally create a mask out of it.

We adapt the Min and Max values to the grey matter, position the mouse inside the grey matter and click the Grow Region button.

We expand the selection by reducing the Min value and clicking the expand button.

In the current selection, the cerebellum is still included, so we may decide to just leave it into the dataset or to remove it manually. This can be done by holding down the Shift button while drawing with the mouse.

We open the “Options” of the Segmentation tab to save the grey matter just marked as a VOI.

Clicking the “Define VOI” button, we create a VOI.

Now, we have to turn the VOI into a mask file to be able to use it in the GLM procedure. We click the “Options” button in the VOI analysis window.

On the “VOI Functions” tab, we will find the corresponding option to create a mask from one or multiple VOIs.

We use the “Create MSK…” button to create a mask out of the loaded VOI. Please make sure that the proper VTC is linked when clicking this button to make sure the dimensions of the mask fit.

BrainVoyager will automatically color the mask and report the number of voxels included in the mask in the INFO tab of the global tools.

Using the “F8” button, we can switch back and forth between the VMR and the mask.

Grey Matter Mask using the segmentation result

As soon as a proper segmentation has been created with a dataset, one can easily use the reconstructed surface to create a mask file. To do this, one usually loads the reconstructed and smoothed boundary representation between the grey and white matter (“Recosm”.srf). In this case, we load the result for the left hemisphere.

The option to create a mask on the basis of the surface reconstruction can be found in the “Meshes” menu

In the “create cortex based VTC mask” dialog, one can set different properties, e.g. the “sampling depth” of the mask. The default value is from -1 to +3mm.

Using this technique, one may also create a mask for the left and right hemisphere by adding both hemispheres to the surface module. The second mesh can be added by going to Meshes and clicking "Add Mesh".

Masking the VTC

In some cases, one wants to exclude specific areas from the functional data itself. There is no option to exclude something from the volume time course (VTC) itself within BrainVoyager, but there is an easy workaround to create a mask based on the properties of VTC.

First, we have to link a VTC file to the VMR.

We visualize the VTC by using the “Show VTC Vol” button on the "Spatial Transf" tab of the 3D volume tool. Here, the first VTC volume is displayed.

Now, we first have to save the VTC – which is temporarily displayed as “EPI.vmr” in the VMR format. To do so, we use the option “save seconday VMR” in the File menu.

We save the first VTC volume as VTC1.vmr and then load this new VTC1.vmr.

One idea may be to get rid of the ventricles in our mask. Moving the mouse over the ventricles shows that the ventricles are very bright (intensity value of 225). Now we could follow two different strategies. We could a) either mark the ventricles first and reload the non-marked area afterwards or b) mark everything except the ventricles. Here, we show the first approach.

a) We position the mouse inside the ventricles and set a very high intensity for the Min and Max values (here, we use just a single value - 225).

Only a part of the ventricles has been marked. By using the expansion tool, we can increase the size of the marked area.

Depending on the specific distribution of intensities in the current dataset, we have to adapt the minimum value more or less. As an additional approach, we may also use manual drawing to mark fine structures.

The drawing tool can be enabled on the Segmentation tab.

Depending on the size of the region to be manually marked, one may adjust the mouse size.

We use the expand button to increase the marked area and use to “Reload Non-Marked” button to get rid of the marked area.

The new VMR should be saved before applying the next step.

To finally create the mask (after some manual corrections within the VTC1.vmr), we use exactly the same technique as performed in the first step. First, we mark all the voxels in the VMR using region growing / expansion. Due to the fact that we basically want to include everything larger than zero in the mask, we can use a quite large intensity range.

Second, we save the marked region as VOI file in the Options of the Segmentation tab.

Third, we create a mask on the basis of the VOI.

We apply the mask for a GLM analysis and can nicely test that the mask has been properly used by setting the minimal threshold to a very low value (but slightly above zero).

The following screenshot shows the corresponding result when no mask is used.