Imaging Data: Structure And Formats


Figure 1

Clicking on the Applications in the upper left-hand corner and select the terminal icon. This will open a terminal window that you will use to type commands Launch terminal window


Figure 2

  • Affine transformation (qform): this field encodes a transformation or mapping that tells us how to convert the voxel location (i,j,k) to the real-world coordinates (x,y,z) (i.e. the coordinate system of the MRI scanner in which the image was acquired). The real-world coordinate system tends to be defined according to the patient. The x-axis tends to go from patient left to patient right, the y axis tends to go from anterior to posterior, and the z-axis goes from top to bottom of the patient. This mapping is very important, as this information will be needed to correctly visualize images and also to align them later. Coordinate systems Figure from Slicer

  • Figure 3

    Display toolbar The display toolbar allows you to adjust the display properties of the currently selected image. Play around with the controls and note how the image display changes (but leave the “overlay type” as “3D/4D volume”).


    Figure 4

  • Overlay display panel: Clicking on the gear button ( gear icon ) opens a panel with more display settings.

  • Figure 5

  • Overlay information: Clicking on the information button ( info ) opens a panel with information about the image.

  • Figure 6

    If FSLeyes does not have enough room to display a toolbar in full, it will display left and right arrows ( left ), ( right ) on each side of the toolbar - you can click on these arrows to navigate back and forth through the toolbar.


    Figure 7

    Ortho toolbar

    Figure 8

  • View settings panel spanner icon : Clicking on the spanner button opens panel with advanced ortho view settings.

  • Figure 9

  • Screenshot screenshot icon : Clicking on the camera button will allow you to save the current scene, in this ortho view, to an image file.

  • Figure 10

  • Toggle canvases sagittal icon , coronal icon , axial icon : These three buttons allow you to toggle each of the three canvases on the ortho view.

  • Figure 11

  • Canvas layout horizontal icon , vertical icon , grid icon : These three buttons allow you to choose between laying out the canvases horizontally (horizontal icon ), vertically (vertical icon ), or in a grid (grid icon ).

  • Figure 12

  • Movie mode movie icon : This button enables movie mode - if you load a 4D image, and turn on movie mode, the image will be “played” as a movie (the view will loop through each of the 3D images in the 4D volume).

  • Figure 13

  • Toggle cursor/labels add icon : This button allows you to toggle the anatomical labels and location cursor on and off.

  • Figure 14

  • Reset zoom add icon : This button resets the zoom level to 100% on all three canvases.

  • Figure 15

    Open a lightbox view using View > Lightbox View. If you drag the mouse around in the viewer you can see that the cursor position is linked in the two views of the data (the ortho and the lightbox views). This is particularly useful when you have several images loaded in at the same time (you can view each in a separate view window and move around all of them simultaneously). Lightbox toolbar


    Figure 16

  • View settings panel spanner icon : Clicking on the spanner button opens a panel with advanced lightbox view settings.

  • Figure 17

  • Screenshot screenshot icon : Clicking on the camera button will allow you to save the current scene, in this lightbox view, to an image file.

  • Figure 18

  • Z axis sagittal icon , coronal icon , axial icon : These three buttons allow you to choose which slice plane to display in the lightbox view.

  • Figure 19

  • Movie mode movie icon : This button enables movie mode.

  • Figure 20

    You can “unlink” the cursor position between the two views (it is linked by default). Go into one of the views, e.g., the lightbox view, and press the spanner button ( spanner icon ). This will open the lightbox view settings panel. Turn off the Link Location option, and close the view settings panel. You will now find that this view (the lightbox view) is no longer linked to the “global” cursor position, and you can move the cursor independently (in this view) from where it is in the other views.


    Figure 21

    Now load in a second image (sub-OAS30015_T1w_brain_pve_0.nii.gz) using File > Add from file. This image is a tissue segmentation image of the cerebrospinal fluid. In the bottom-left panel is a list of loaded images - the overlay list. Overlay list


    Figure 22

  • Show/hide each overlay with the eye button ( eye icon ), or by double clicking on the overlay name.

  • Figure 23

  • Link overlay display properties with the chainlink button ( chain icon ).

  • Figure 24

  • Save an overlay if it has been edited, with the floppy disk button ( disk icon ).

  • Figure 25

    In the bottom right corner of the FSLeyes window you will find the location panel, which contains information about the current cursor location, and image data values at that location. Location panel


    Figure 26

    The Atlas information tab displays information about the current display location, relative to one or more atlases: Atlas information panel The list on the left allows you to select the atlases that you wish to query - click the check boxes to the left of an atlas to toggle information on and off for that atlas. The Harvard-Oxford cortical and sub-cortical structural atlases are both selected by default. These are formed by averaging careful hand segmentations of structural images of many separate individuals.


    Figure 27

    The Atlas search tab allows you to browse through the atlases, and search for specific regions. Atlas search panel


    Figure 28

    The search field at the top of the region list allows you to filter the regions that are displayed. Atlas region search


    Figure 29

    Here are the screenshots you should see: Left Thalamus


    Figure 30

    Right Thalamus

    Figure 31

    Change the intensity range for both images to be between 0 and 1000. Show/hide images with the eye button ( eye icon ), or by double clicking on the image name in the overlay list.


    Structural MRI: Bias Correction, Segmentation and Image Registration


    Figure 1

    Clicking on the Applications in the upper left-hand corner and select the terminal icon. This will open a terminal window that you will use to type commands Launch the terminal


    Figure 2

    From the terminal window, type fsleyes to open up the image and have a look around. Open FSLeyes


    Figure 3

    Now we choose the file sub-OAS_30003_T1w.nii by going to the File menu and choosing the Add Image command Add fileChoose File


    Figure 4

  • Type spm pet to launch SPM Launch SPM

  • Figure 5

  • SPM will then create a number of windows. You want to look at the Main Menu Window that has all of the buttons. SPM windows

  • Figure 6

  • From main menu, select the Segment button. This will launch a window known as the batch editor, where you can adjust settings on the pipeline to be run. SPM Batch editor

  • Figure 7

  • Under Data->Channels->Volume, click on “Specify…”. Specify volumes

  • Figure 8

  • In the dialog box that opens up, please navigate to the folder data and then StructuralMRI. Then select the first image sub-OAS30003_T1w.nii. Once you click on it, you will notice the file move down to the bottom of the box which represents the list of selected files. Choose T1 image

  • Figure 9

  • Back in the batch editor, under Data->Save Bias Corrected, please choose “Save Field and Corrected” Choose bias correction option

  • Figure 10

  • Under the Tissues section, please make sure that the first three tissue types, which represent GM, WM, and CSF, have the native tissue subfield set to native, while the final three tissue types (4-6), which represent non-brain structures, have the native tissue subfield set to None. Native segmentation

  • Figure 11

  • Change the image lookup table to NIH [Brain colors] FSL eyes with NIH colormap

  • Figure 12

  • Then change the image minimum to 40 and the maximum to 600. This means that all intensities 40 and below will map to the first color in the lookup table, and all voxels 600 and above will map to the last color. The white matter should be yellow to red. Change min and max intensity

  • Figure 13

  • Next add the bias corrected image, which is called msub-OAS30003_T1w.nii. Change the lookup table to NIH as you did in Step 2. Change the minimum to 40 and maximum intensity to 500 similar to what you did in Step 2 and 3. Bias in image using NIH map

  • Figure 14

    When you add this image, it will overlay on top of the original image. Think of this new image a completely opaque, so that you no longer see the original one. If you want to see the original one, then you need to either turn it off using the eye icon ( eye icon ) right by the file, or you need to turn the opacity (slider near the top of the screen which is marked opacity.)


    Figure 15

  • Use the icon to turn off the original image. Select the bias corrected image and make sure the colormap is back to the first option “Greyscale” Bias correted image in greyscale

  • Figure 16

  • Use the opacity slider to make the grey matter probability map transparent. Looking at grey matter image

  • Figure 17

    You should have an output that looks something like this. Tissue segmentation check


    Figure 18

    This command masks our bias corrected image with the brain mask and makes a new file which has the name msub-OAS30003_T1w_brain.nii. Take a look at the image in fsleyes. Skull stripped image


    Figure 19

  • For the output image, please type in a new name msub-OAS30003_T1w_brain_MNI.nii The final command setup should look like the screenshot below. FLIRT window

  • Figure 20

    Let’s open fsleyes and open the output from the co-registration msub-OAS30003_T1w_brain_MNI.nii. T1w in MNI space


    Figure 21

    Now click on the Add Standard function. This is where fsleyes keeps all of the standard atlases and templates so that you can quickly access them. Add standard function


    Figure 22

    Select the MNI152_T1_1mm_brain from this list of files. Choose MNI image


    Figure 23

    The final command setup should look like the screenshot below: Coregistration of T1 and FLAIR


    Processing and analysing PET brain images


    Figure 1

    Select the ImCalc module. SPM ImCalc module


    Figure 2

    Enter the frame number corresponding to the frame that spans 50-55 min post-injection (frame number 14) and hit enter. Click on the sub001_pib.nii,14 file to add this to the list. Choose Frame 14


    Figure 3

    Enter the next framenumber and similarly add it to the list. Repeat until you’ve added the last four frames of the PiB image corresponding to 50-70 min post-injection (frames 14, 15, 16, and 17). Note the order you input the images corresponds to i1, i2, … in the Expression field later. Once you’ve selected the last four frames click Done to finalize the selection. Choose all


    Figure 4

    Output Filename – enter text sub001_pib_SUM50-70min.nii ImCalc output


    Figure 5

    Note that taking the average of these frames is equivalent to summing all of the detected counts across the frames and dividing by the total amount of time that has passed during those frames (i.e., 20 min). ImCalc expression


    Figure 6

    Data Type – specify FLOAT32 Choose float image


    Diffusion-weighted imaging (DWI)


    Figure 1

    example of bval and bvec file

    Figure 2

    FSLeyes of B0 image

    Figure 3

    Eddy also takes a lot of input arguments, as depicted below
    eddy
    Image adapted from https://open.win.ox.ac.uk/pages/fslcourse/practicals/fdt1/index.html


    Figure 4

    Example of the V1 file in RGB:
    example_RGB_V1


    Functional Magnetic Resonance Imaging (fMRI)


    Figure 1

    As mentioned in the imaging data section, the & at the end of the command allows us to keep working on the command line while having a graphical application (such as fsleyes) opened. Helpful options for reviewing fMRI data in fsleyes are the movie option ( movie ) and the timeseries option (-> view -> timeseries or keyboard shortcut ⌘-3). Check them out!


    Figure 2

    The standard procedure for spatial smoothing is applying a gaussian function of a specific width, called the gaussian kernel. The size of the gaussian kernel determines how much the data is smoothed and is expressed as the Full Width at Half Maximum (FWHM). Example of full-with at half maximum


    Figure 3

    Output components from FSL Melodic

    Extra: Using the Command Line


    Figure 1

    Picture of the command line

    Figure 2

    Example of the SPM GUI

    Figure 3

    In this section, we are going to go through some basic steps of working with the command line. Make sure you are able to connect to your working environment by following the directions in the Setup section of this website. As a reminder, you should have a desktop on your virtual machine that looks something like this: Screenshot of the VM desktop Click on the Applications icon in the top left of the window, and you should see a taskbar pop out on the left-hand side. One of the icons is a black box with a white border. This icon will launch the Terminal and give you access to the command line. Launching a terminal


    Figure 4

    The terminal should produce a window with a white background and black text. This is the shell. We will enter some commands and see what responses that the computer provdes. Picture of an open terminal