McStrip: Setting the Parameters

(using the "Tune McStrip on one volume" option in McStrip_INC)

The parameter list may seem long, but most of them are about filenames, locations and such.  Only a few (marked in green) are things that you may need to adjust based on the results.
 
-- Set the Verbose option as oposed to "Taciturn".
    Specify a parameter filename (existing or new).
    Select a typical volume to work on.
General Note:  For tuning each stage, you have two choices, Accept default/paramfile values if present and Prompt for all parameters.    We'll assume the latter case in the discussion below.  You will need to type in the command window for this!  If you are using the IDL Virtual Machine on a Windows  machine there IS no command window.  In that case you will have to edit the parameter file.  Bold type in the discussion of each stage indicates a message or prompt.

Stage 0   Stage 1   Stage 2   Stage 3   Stage 4   Stage 5   Stage 6   Stage 7   Final words  

Stage 0: Check Orientation

Because McStrip needs to understand the position of the head, it is a good idea to check on it here.  Head orientation in McStrip is expressed as a 6-character string that describes how volume indices relate to world positons (the last two characters correspond to the dimension that varies slowest).  A typical orientation string would be "lrpais", where lr or rl = left to right (or the reverse), ap or pa = anterior to posterior (or the reverse), is or si = inferior to superior (or the reverse).

* The specified PARAMFILE "McStrip.params " does not exist.
Create it (y/n)   If the specified parameter file does not exist, you will asked to confirm its creation.

First you will be shown three slices through your volume and asked to specify the order in anatomical terms,  for example, "sag cor axi"  (sagittal, coronal, axial).  Next you will be shown 8 cases; choose the case number that fits the conditions printed in the bottom of the window.   The program will report both the orientation as it understood it from the file header and the one you just specified.

The volume orientation that you specify will be written into the parameter file.  

Top
Stage 1: Skin mask

* Enter the storage orientation tuple, or enter "header" to read it from the file.  If you did Stage 0, reenter that orientation code here, or type 'header" to accept the specification in the file header.

* Enter the output directory:   This can be specifed relative to where you started the program (e.g.  ./ in unix).

* Enter skinfrac (between [-1.0, 1.0] for [loose, tight])    The recommended  initial setting is 0.0.  You will be shown (briefly) a histogram of the mrivolume.  The skinfrac selects an intensity threshold that is expressed as a fractional distance away from the low intensity valley we think of as a breakpoint between background/CSF values and grey matter intensities.  When the stage completes you get to examine the effect of applying the skinmask.  

The purpose of the skinmask is only to remove large aliasing artifacts (wrap around of slices at the edges of the volumes), because they can affect the computation of the warp mask.  If your volume is clean, the skinfrac should be low (near zero), if not:

INCREASE the skinfrac value to remove crud  present on the edges of the volume.  This did not remove enough!

This skinfrac barely removed anything.

DECREASE it if there is a lot of erosion into ears, or up through the neck area.   This was too high!

This fraction was too high!


Top
Stage 2: Warp Mask

The skin mask, warp mask, and coarse mask are all actually created by the same subroutine, so you will be prompted for the same things you just used in Stage 1.  Just reenter them.  This is the slowest stage.

* A file-picker asks you to Select template mri name.   Use the one supplied with McStrip or supply your own.

*A  file-picker asks you to Select template skinmask name.   Use the one supplied with McStrip or supply your own.

*A  file-picker asks you to Select template brainmask name.   Use the one supplied with McStrip or supply your own.

* Enter order of polynomial warp to be computed [0,2-12]:   The warp mask is created by registering the template brain to your subject brain using AIR (R. Woods).  However, this is never a really good match when one brain is not stripped.  The recommended warp order to start out with is 3.  Less than that won't be enough, and more than that may take a long time for little return.

* Enter cutoff for skinmask discord (0-100).   Once the warp transformation has been computed, McStrip tries to guess whether it is any good by comparing the fit of the subject's skinmask and the transformed template skinmask.  You get to control how much mismatch you will accept -- 15% is reasonable.  If you set it to zero, the warp mask will never be accepted and the program will not attempt to use one in the next stage.

*  Enter dilation kernel (e.g. 9,9,9).  The warp mask is going to be transformed into a coarsemask in the next stage by dilating it.  This is a dilation kernel expressed in voxels.  It is hard to judge what you need just yet -- see Stage 3.

* Enter cleanup flag (0,1).   When tuning, set this to zero.  That means that you will be able to take multiple passes through stage 3 without recomputing the warp mask.

BE ALERT -- To be doubly safe, a window will pop up that shows axial slices through the subject and the template volume.   If the nose is up in one and down in the other the warp mask will be terrible!!!   If you miss the window, you can also view "McWorking_....._orientation.png" (or .tif).

What to adjust and how
This is an example of a case where the warpmask clipped off some of the inferior frontal lobe.  The rest of the fit is good, so try to adjust the coverage in the next stage.

This is a pretty good warpmask


Top
Stage 3: Coarse Mask

The warp mask is going to be transformed into a coarsemask in this stage by dilating it.  The coarse mask should NOT clip out any tissue you want, but it SHOULD clip out most of the neck, eyes and skull.  You control this with the dilation kernel.  The rule for the coarse mask is to make it only as big as it needs to be -- otherwise you do not get much help from it.

* Enter cutoff for skinmask discord (0-100).   Note:  If your warp mask failed to make the cut, McStrip will make do without it by using an eroded version of the subject's skinmask instead of a dilated version of the warp mask.  The erosion kernel used is the same as the dilation kernel you specify.  So, you need to erode heavily to cut anything out!

*  Enter dilation kernel (e.g. 9,9,9).   Again, this is expressed in voxels -- it does not have to be a symmetric kernel.  In fact, it is often better to dilate more in the horizontal plane (first 2 values) and less in the vertical plane (last value) if your axial slices are thicker than the others.  A kernel of 9,9,9 is large -- you can go smaller, for example 7,7,5.  

Top
Stage 4: Thresh Mask

The thresh mask operates only on data inside the coarse mask that you just created.  The desired result contains NO extraneous tissue, but ventricular and sulcal CSF are usually missing from this mask -- that is fine.  If the mask harsher than necessary (a lot of grey matter tissue also missing), the subsequent BSE stage is likely to make a suboptimal mask too.

* Enter the output directory:   This can be a different directory than that used in the previous stages if you like.

* Enter the fraction for how far up the grey peak to set the grey threshold (e.g. 0.15):    This tells the program how far up the grey peak to set the intensity threshold.  In the picture below,  the grey  matter intensity peak is at around intensity  120, and the white matter peak  (not much of a peak here) is  near 150.  When tuning, it is worth while to start at a low threshold, for example,  0.05 and increase from there.

Histogram

* Enter the fraction for how far up the grey peak to allow automatic adjustment (e.g. 0.65):   McStrip will automatically try higher thresholds up to the specifed level if the initial threshold fails to discard a chunk of tissue.  The example of 0.65 is not realistic for most volumes -- try setting this value no more than 0.15 greater than the initial value.  

The mask shown below is a reasonable result for this stage.

This thresh mask is ok.


Top
Stage 5: BSE Mask

A BSE (Brain Surface Extraction) mask is computed for a suite of parameters and a score computed based on its overlap with the threshold mask.  The mask that has the "Match score" closest to zero is selected.  The parameters for this stage just determine how many combinations of parameters to test.  It's quick to compute each individual mask; the default settings result in 15 combinations.

* Enter the output directory:
 Again, this can be a different directory.

* Enter anisotropic smoothing kernels (e.g. 5.0,15.0):  The default values are 10, 5, 15 -- they need not be in order.  Anisotropic smoothing is like simple smoothing, except that the smoothing is restricted to homogeneous neighborhoods -- edges are protected.  Larger kernels mean greater smoothing.  A value of zero would mean no smoothing.

* Enter smoothing iteration(s) (e.g. 3): The default value is 3, but you can enter mutliple values here.  

* Enter edge detection kernels (e.g. 0.65,0.90):   The default values are 0.70, 0.64, 0.60, 0.80, 0.90 -- again, the order is not important.

* Enter the "early exit" percentage deviation:
 The default value is 1.0.     This is just a mechanism to save time -- on the first occasion that the match score is within 1% of zero, the program will accept that as the best case.

The BSE algorithm employs lots of erosion and dilation operations that can often gnaw out bits of tissue, as shown below (this example is not severe).  In the next stage the threshold and BSE masks are combined, which usually eliminates the problem.   When you examine the mask, you might also find that there is tissue included that was not inside the coarse mask -- the coarsemask is used in this stage ONLY to define the rectangular subvolume for the algorithm to work in.

This BSE mask is pretty goog

Top
Stage 6: Consensus Mask

Here's where it all comes together.  The coarsemask, threshmask and BSE mask are combined into a "vote" mask, which is then thresholded.  Finally, the consensus mask (binary) is smoothed with a Gaussian kernel to soften up jagged edges and to permit a degree of expansion if desired.   The mask is forced to be a single connected blob. Completely enclosed voids can be filled.

* Enter the output directory:   Again, a different directory is possible.

* Enter the number of votes for mask1 (coarsemask):   The default value is 1.  

* Enter the number of votes for mask2 (threshmask):   The default value is 1.

* Enter the number of votes for mask3 (bsemask):  The default value is 1.

* Enter the number of votes to pass: The default value is 2.   In effect this means that a) the voxel has to be inside the coarsemask and b) it must be in at least one of the other masks.

* Enter the FWHM of the gaussian smoothing kernel (in cm): The default value is 0.30.  

* Smoothing causes expansion. How much should be kept? (0.0 = a little, 0.99 = all):  The default value is 0.90.   When the smoothing is carried out the edges of the mask will have fractional values due to the gaussian kernel profile.

* Enter flag for detecting enclosed voids and fill them (1 = do so):  The default is 1 -- really, I can't think of a case where I would not want to fill internal voids!

  What to adjust and how
Top
Stage 7: Tidy up Parameter File.

McStrip only uses the LAST instance of any parameter in the parameter file.  So to make it easier for you to read, you can clean it up here.
Top

Final words

If you choose parameters on a representative volume from a set of volumes acquired the same way you should get decent results for the entire set.

Strip masks are not one-size-fits-all -- whether you think a mask is good depends greatly on what you will use it for.   The multiple parameters and stages in McStrip give it a lot of flexibility, but your final mask may not satisfy you no matter how much you tweak the parameters.  Sorry!  We recommend using a manual editor (see EditMan from our site) to do any final touch up.

Top


Last modified October 14, 2004.