CHAPTER 7: CARET

The following sections describe the steps needed to analyze functional and anatomical data using CARET. The manual addresses those steps that require user judgment. However, if questions arise, contact Donald McLaren () or Harold Burton (). For help specifically with CARET please contact John Harwell or Donna Dierker.

Gain Field Correction

Gain Field Correction (GFC) must be performed after atlas registration. It is beneficial to collect multiple MPRAGE images. If you collect multiple images, they should be collected at the same time. GFC makes tissue intensities homogeneous. The result is equal intensity white matter and gray matter throughout the brain. This is critical for creating surfaces in CARET. The steps require substantial user interaction!!!GFC must be used for data collected on the Allegra 3T and probably will be needed for images generated by the Trio 3T.

The procedure requires two steps: (1) computing the gain field using a blurred image as detailed in step D., and (2) applying the gain field to the atlas image as detailed in step E.

GFC works by dividing the image by a gain field. In the case of fine MPRAGE images (e.g., T1W images), the gain field is a 10 parameter parabolic image. The parameters are estimated based on the intensity differences within a tissue class (e.g., white matter, gray matter, etc.). The end product is achieved based on the following equation:

/=

MPRAGE image/Gain Field=GFC MPRAGE

*.gfc file

The *.gfc file is used to create the gain field image.

Procedural steps to complete GFC are detailed below:

  1. Computer set-up to run GFC:
  2. Remote shell to petsun23, petsun24, or petmr5 (if these are being used, petsun59 is also an option) at the command prompt from a UNIX (or SSH) terminal window.
  3. Change to participant’s atlas directory (e.g., drumcp/drumcp_pilot6/atlas)
  4. Set the DISPLAY environment (e.g., st, st2, etc.)
  1. Open Analyze:
  2. At command prompt, type:

analyze_avw &

or type:

analyze_avw petsun24 &

  1. Image blurring:
  2. At the command prompt type:

imgblur_4dfp atlas_img#

  1. The imgblur_4dfp command performs a 3d isotropic Gaussian blur of an image(e.g., atlas_img).
  2. The value specified for #designates the FWHM in mm of blur.
  3. atlas_img should be replaced by the participant’s atlas registered MPRAGEimage file in 111 space.
  4. # should be replaced by 1. This is a very small amount of blurring and is specific for gain field correction. Other procedures may use more blurring.A higher number, and hence wider filter, produces more blurring.
  1. Example:

imgblur_4dfp drumcp5_mpr_n1_111_t88.4dfp.img 1

  1. The result of this command is a file with _b?? appended to the root of the file name. ?? is the amount of blurring (#) times 10 (e.g., if the blur was 1, then?? is 10. This new file is referred to as atlas_img_b10.
  2. Example result:

drumcp5_mpr_n1_111_t88_b10

  1. Preparing image for GFC:
  2. At the command prompt type:

4dfptoanalyzeatlas_img_b10

  1. The 4dfptoanalyze command converts a .4dfp file to a .4dint file, which is the necessary format needed to obtain the GFC via the partitiond_gfccommand.
  2. atlas_img_b10should be replaced by the name of blurred atlas registered MPRAGE image; see B.5. and B.6. above for details.
  1. Example:

4dfptoanalyze drumcp5_mpr_n1_111_t88_b10

  1. The resulting files are:

drumcp5_mpr_n1_111_t88_b10.4dint*

  1. Obtaining the gain field parameters (*.gfc file):
  2. The *.gfc files provide the coefficients of the 10 parameters in the parabolic gain field. The following process will determine the coefficients and check the results to ensure the result is acceptable. As with any curve fitting, the computed solution may not be acceptable. The inspection of the *.dat file and of the region image will determine if a solution is acceptable.
  3. Atthe command prompt type:

partitiond_gfc –b#–l##atlas_img_b10.4dint

  1. partitiond_gfc automatically searches the current directory for atlas_img_b10.4dint.gfc. The *gfc file must have the same name as the file specified in the command line with the exception of the .gfc tail being added. The *gfc file contains the coefficients of the gain field. If the file does not exist, then the program assumes all coefficients are zero. If the file exists, it uses those coefficients as a starting point, rather than at a starting point of zeros. An example *gfc file containing the 10 coefficents:

1.0797 0.0016 0.0237 0.0119 -0.0710 -0.0754 -0.1943 0.0019 -0.0477 -0.0515

  1. -b option specifies the bandwidth (in intensity units of MR signal) of the tissue classes. Gain field correction uses the tissue classification [HB1]to remove inhomogenieties in the image (see details below).[DGM2] Basically, it aims to make the tissue class a single value. Typically, # is replaced by the value 140 as a first pass.
  2. –l option specifies the maximum number of iterations to be performed with the command. Reaching the maximum number of iterations is bad; it means no stable solution for the gain field was found. Partitiond_gfc will stop automatically, when the drms value is below .0002 (.02 in the *.dat file) or the maximum number of iterations is reached. Typically, ## is replaced by the value of 12. This usually does need to be changed in subsequent steps.
  3. atlas_img_b10.4dint should be replaced by the 4dint version of the blurred atlas registered MPRAGE image. You must include the .4dint tail.
  4. Other options can also be used, including changing the background threshold (-z) and changing the number of tissue classification (-m). The defaults for these options are 180 and 24, respectively. This is very very rare and has not been done in the Burton lab.
  5. partitiond_gfc produces the following files:
  6. *gfc.img and *gfc.hdr are the files associated with the Analyze format image that have been corrected by the computed gain field using the formula mentioned in the introduction; however, this is done on the blurred image and is not used in CARET.
  7. *gfc_region.* is an Analyze format image that shows the tissue classification[DGM3]. The program selects a voxel and then grows the region using face-connected voxels that are within the specified bandwidth of the mean. However, if the gradient of voxels is high, it will exclude a voxel from a region. Typically, the procedure chooses NOT to include a voxel in a region near where the tissue class should change (e.g., gray/white border). The value of the voxel in a region is the mean of the region.
  8. *gfc_gain.* is an Analyze format image that shows the gain field.
  9. *gfc_border.* is an Analyze format image that shows the borders of different tissue classifications.
  10. *gfc is a text file that contains the 10 coefficients needed to compute the gain field image.
  11. *dat is a text file that contains the coefficients for the procedure iterations. It also contains all of the drms values and can be used to determine if the procedure reached a stable solution, see below.
  12. The partitiond_gfc command takes several minutes. While the command is running; open up a new terminal window.
  13. At the command prompt, change to the participant’s atlas directory.
  14. At the command prompt, type:

ll *gfc.dat

  1. If there is only one file then, type:

tail –f *gfc.dat

  1. If there is more than one file, type:

tail –f file

(a)File should be replaced by the dat file being created currently

  1. The screen will print the gain field coefficients after they are created bysuccessive iterations. It will also print out the drms value in the far right column.
  1. Determining whether a stable solution for the gain field was found:
  2. At the command prompt, type:

more *gfc.dat.

  1. Each row of the output reflects an iteration of the partitiond_gfc command operation. Find the last row of the document and ascertain that it does not begin with a number equal to ##, the number of specified iterations. This step will determine if a stable solution for the gain field was found.
  2. If the number is equal to ##, then remove the just created files by typingrm *gfc*hdr *gfc*img *gfc and go back to step D.2.
  3. Now look at the *dat file again. Find the last row that is labeled 0. If this row contains all zeros, then continue, otherwise see footnote[1].Next, increment the intensity bandwidth (e.g.,#) by 10.
  4. Below is an examplewhere the number of iterations equaled##, which means that all tissue inhomogenieties were not removed in 20 attempted image corrections:

# x0y0z0 x0y0z1 x0y1z0 x1y0z0 x0y0z2 x0y1z1 x0y2z0 x1y0z1 x1y1z0 x2y0z0

0 1.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000

1 1.0141 -0.0061 0.0002 0.0036 -0.0206 -0.0082 -0.0374 -0.0119 0.0043 -0.0167 0.0625

2 1.0293 -0.0127 0.0042 0.0082 -0.0416 -0.0157 -0.0783 -0.0104 0.0119 -0.0319 0.0727

3 1.0443 -0.0200 0.0075 0.0104 -0.0596 -0.0251 -0.1215 -0.0082 0.0154 -0.0472 0.0698

….

….

20 1.3356 -0.1226 0.0557 -0.0174 -0.3491 -0.1982 -0.5818 -0.0492 -0.0254 -0.4619 0.3956

  1. If thenumber is less than ##, then continue.
  2. Below is an example where the number of iterations was less than ##, which means that all tissue inhomogenieties were removed in fewer than 20 attempted image corrections:

# x0y0z0 x0y0z1 x0y1z0 x1y0z0 x0y0z2 x0y1z1 x0y2z0 x1y0z1 x1y1z0 x2y0z0

0 1.1404 -0.0812 0.0415 0.0010 -0.1315 -0.0918 -0.3620 -0.0547 0.0090 -0.2174 0.0631

1 1.1559 -0.0846 0.0451 -0.0009 -0.1488 -0.1057 -0.3855 -0.0571 0.0049 -0.2450 0.0578

2 1.1708 -0.0887 0.0450 -0.0038 -0.1649 -0.1193 -0.4120 -0.0600 0.0013 -0.2676 0.0501

3 1.1853 -0.0919 0.0485 -0.0054 -0.1846 -0.1286 -0.4320 -0.0624 -0.0054 -0.2886 0.0500

4 1.2003 -0.0938 0.0508 -0.0069 -0.2045 -0.1400 -0.4537 -0.0581 -0.0092 -0.3104 0.0501

5 1.2192 -0.1024 0.0538 -0.0120 -0.2379 -0.1349 -0.4838 -0.0482 -0.0201 -0.3390 0.0007

  1. Comments on the *dat files:
  2. The first column value (labeled # in the above examples) specifies iteration number of the partitiond_gfc command.
  3. The next 10 columns (labeled x0y0z0 x0y0z1 x0y1z0 x1y0z0 x0y0z2 x0y1z1 x0y2z0 x1y0z1 x1y1z0 x2y0z0) specify the parameters of the parabolic image.These are the gain field correction solutions.
  4. The last column (with no header) lists the drms value. The command uses 0.0002 as the drms[HB4][DGM5]convergence criteria. Once the drms drops below this value, the command exitsto the command prompt.In the example from 2c above, there were no iterations after 5 because the convergence criteria were met (i.e., drms=0.0007). This theoretically means that a stable solution for gain field correction was found. However, only an inspection of the images can confirm this conclusion.
  1. Use the Analyze program to compare the blurred atlas registered and gain field corrected images and assess the quality of gain field corrections.
  2. At the command prompt type:analyze_avwor type: analyze_avw petsun24
  3. A dialogue box appears: Analyze 6.1
  4. Click ‘I Accept’.
  5. A dialogue box appears: Message of the Day-Analyze
  6. Click ‘Done’.
  7. The dialog box closes and Analyze opens.
  8. Click the dumptruck icon to load the blurred atlas image.
  9. A dialogue box appears: Load as 6.1
  10. Click ‘File’.

(a)Browse the directory for the blurred atlas registered 4dint image (e.g., *b10.4dint.hdr). The directory should be the participant’s atlas directory.If not, navigate to the atlas directory.The image is prior to gain field corrections.

(b)Once located, double click on the *.hdr filename.

(c)If no *.hdr file exists, you have done something wrong; start the gain field correction process over again.

  1. Click ‘Load’[2].
  1. This file should now appear in Analyze.
  2. Click the dumptruck icon to load the gain field corrected image.
  3. A dialogue box appears: Load as 6.1
  4. Click ‘File’.

(a)Browse the directory for the gain field correction region image (e.g., *gfc_region.hdr). The directory should be the participant’s atlas directory.If not, navigate to the atlas directory.

(b)Once located, double click on the *.hdr filename.

(c)If no *.hdr file exists, you have done something wrong; rerun the partitiond_gfc after removing all files containing *gfc*.

  1. Click ‘Load’.
  1. This file should now appear in Analyze.
  2. Hold the shift key and click on both file icons.
  3. Click ‘ROI’ icon to view files.
  4. [DGM6]Inspect the two images. You should look for the following features in the images:
  5. Clear separation of gray and white matter throughout the brain, especially in the visual cortex and inferior temporal regions in the vicinity of the hippocampi.
  6. Each tissue type should be homogenous in color intensity throughout the brain. (e.g., white matter should be represented with one (and maybe two) intensities of white, andnot multiple shades of white.Note:intensity of the cerebellum probably appears in three colors, which are different from the rest of the brain. This is okay.
  7. If either tissue type is patchy, which reflects missing tissue, or has multiple color intensities, rerun the gain field correction, as described in step 4. below.

(a)Click ‘Exit’

(b)Select ‘File’  ‘Close’

(c)Click ‘Unload and Exit’

  1. If you are satisfied with the separation of tissue intensity produced by this running of partitiond_gfc,

(a)Click ‘Exit’

(b)Select ‘File’  ‘Close’

(c)Click ‘Unload and Exit’

(d)Skip to Step H.

  1. There are two options whenrepeating partitiond_gfc. Choose (a) if your[DGM7] results are close to having homogeneous tissue intensities and (b) if your image is very far from being homogeneous.
  2. Rerun the command starting with the previous end point. Do not remove any files, goto Step G.1. This searches for *gfc and uses those coefficients as the starting point for computing the gain field. Change the bandwidth[3] when repeating partitiond_gfc.
  3. Rerun the command from the very beginning. Before repeating partitiond_gfc command, remove all files created with the previous partitiond_gfc (use rm *gfc*; warning this permanently removes all .gfc files within this directory.)
  1. Apply the gain field to the fine MPRAGE image
  2. Make a .4dint file of the fine MPRAGE for the partitiond_gfc command
  3. At the command prompt type: 4dfptoanalyze atlas_img
  4. The 4dfptoanalyze command converts the .4dfp file to a .4dint file, which is the necessary format needed to apply the gain field correction via the partitiond_gfccommand.
  5. atlas_imgshould be replaced by the name of atlas registered MPRAGE image.
  6. Example:

4dfptoanalyze drumcp5_mpr_n1_111_t88

  1. At the command prompt, type:

ln –satlas_img_b10.4dint.gfc atlas_img.4dint.gfc

  1. The command ln –s links and creates a shortcut between two files. The first file of this command is in the participant’s atlas directory, and the second file is to be made.Therefore, the second file is not in the participant’s directory, but is created with the ln –s command. Make certain that the files have the same filename endings as the two above (e.g., end in .4dint.gfc). The only difference between these two filenames is that the second filename does not contain “_b10”).
  2. atlas_img andatlas_img_b10 should be replaced by the root of their filenames.
  3. See Step D.1. for details on the *.gfc text file.
  4. An example:

ln –s DMS_vib_pilot2_mpr_n1_111_t88_b10.4dint.gfcDMS_vib_pilot2_mpr_n1_111_t88.4dint.gfc

  1. At the command prompt, type:partitiond_gfc –gatlas_img.4dint
  2. atlas_img should be replaced by the root filenames.
  3. Make sure you use the atlas registered .4dint file and not the blurred image.
  4. The –g option causes the program to apply the gain field to the MPRAGE image. The application simply means that the MPRAGE is divided by the gain field image as specified in the introduction.
  5. Explanation of the process:
  6. Computer finds atlas_img.4dint.gfc, which is a linked file
  7. Computer then locates atlas_img_b10.4dint.gfc which contains the coefficients of the gain field
  8. Computer creates the gain field image from those coefficients.
  9. Computer computes the gain field corrected MPRAGE image using the formula specified in the introduction.
  1. Converting the gain field corrected image to CARET format
  2. Convert gain field corrected image to a .4dfp file
  3. At the command prompt, type: analyzeto4dfpatlas_img_gfc
  4. atlas_img_gfc should be replaced with the root of the atlas_img file appended with _gfc
  5. Create an ifh file for CARET
  6. At the command prompt, type:

cp atlas_img.4dfp.ifh atlas_img_gfc.4dfp.ifh

  1. The cp command is needed because Analyzeto4dfpdoes not properly create an .ifh file since the partitiond_gfc uses an analyze format image that does not store the image center.
  2. atlas_imgand atlas_img_gfc should be replaced by the root of their respective file names.
  3. When asked: Do you want to overwrite file (yes/no)? type ‘yes’.
  1. Gain Field Correction is now completed.

Surface creation using CARET

The following section describeshow to create a surface representation of the cortex for an individual participant and how to align with the PALS-B12 target surface.

Supplementary information can be obtained from Caret5 Advanced Tutorial: Segmentation, Flattening, Registration and Analysis, available from brainvis.wustl.edu and dated June 2006.

(1)Atlas registered MPRAGE images from each participant are segmented approximately along layer 4 of the cortex and participant-specific fiducial surfaces are generated using an in-house variant of the marching cubes algorithm[4][5]. The algorithm creates a surface mesh and the corresponding three-dimensional x,y,z coordinates of each node, which are computed based on their spatial location.

(2)Registration to a standard fiducial surface mesh is based on aligningsix core landmarks from each brain (Sylvian Fissure, Central Sulcus, Calcarine Sulcus, superior edge of Temporal Gyrus, and dorsal and ventral components of the medial wall) to these landmarks on the PALS B12 atlas ( A deformation map is created to transform the participant-specific surface mesh to standard mesh lattice defined by the PALS-B12 atlas[6][7][8]. Participant-specific fiducial surface coordinates are interpolated to the standard fiducial mesh using the deformation map and barycentric averaging[9].

(3)Requirements for segmenting a volume in CARET:

a)The volume must be in an LPI orientation. That is, the negative X is left, negativeY is posterior, and negative Z is inferior.Note: 4dfp images are already in this format. If you are not using 4dfp images, then you must check this before starting CARET.

b)The voxels must be 1mm cubic voxels.Note: It is important to use the 111 MPRAGEimage.

c)The volume’s stereotaxic coordinates must be set so that the coordinate (0, 0, 0) isat the anterior commissure.Note: 4dfp images are centered at the anterior commissure already, unless the .ifh file is incorrect (not common). In CARET, it will be clear if the (0,0,0) coordinate is incorrect.

d)The volume must contain only a single hemisphere or part of a single hemisphere.Note:Hemisphere selection is done within CARET.

e)The voxels must be in the range 0 to 255.Note:This is done within CARET.

f)Tissue (e.g., gray matter, white matter) must be homogeneous in order for segmentation to work properly. Gain field correction should be performed to achieve homogeneity.

Procedural steps for surface creation and registration:

  1. Getting the anatomical files into the Caret Directory on Bedrock
  2. Open SSH Secure File Transfer
  3. Connect to a Unix Machine (e.g.,“light”)
  4. Profiles  light_wustl_edu (note this is only available from Bedrock)
  5. Set the remote directory to the directory that contains the gain-field corrected image files.
  6. Set the local directory to c:\caret\study\participant. If the directory does not exist, then create one by right clicking the mouse and selecting new folder; type in the name of the new folder.
  7. Go into the participant directory
  8. Drag the gain-field corrected image files (*ifh, *img, *hdr, *img.rec) from the remote directory to the local directory.
  9. Note: if data was collected in Bay 1 or Bay 3, and perhaps the future 3T Trio, then references to gain field correction may not apply and can be ignored. Instead, the reference should be atlas registered image.
  10. Create a LH subdirectory by right clicking the mouse and selecting new folder; type in the name of the new folder. This process needs to berepeated to create a RH subdirectory as well.
  1. Set Current Directory in CARET
  2. Open CARET
  3. File  Set Current Directory
  4. A dialog box appears: Choose Directory
  5. Browse to C:\CARET\study\participant\hemisphere
  6. Click OK
  7. If there is no hemisphere directory, then you need to create one outside of CARET and repeat this step.
  8. The anatomical image(s) should not be in the hemisphere directory. They should be located in the participant directory.
  1. Reading the Anatomical Volume into CARET
  2. You should have 4dfp files in the participant directory, if not then you need to find the anatomical files and move them to the participant directory.
  3. The anatomical files should be atlas registered and gain field corrected priorto starting CARET. If they have not been, then start over at the beginning of this chapter.Gain field correction might not be needed for images obtained with the Bay 3 Trio.
  4. File  Open Data File…
  5. A dialog box appears: Open data File
  6. Change the File Type:

Volume Anatomy Files (*.HEAD *.hdr *.nii *.ifh)