Skip to content

Image visualization and mask creation

etiaum edited this page Sep 16, 2024 · 10 revisions

By Etienne Aumont

MincTools offers two main options for visualization:

  1. register is ideal to look at several images of different modalities (PET & MRI) and/or different subjects in the same space.
  2. Display is ideal to look at one specific image and overlay it with masks. It has more options than register.
    If you enter display (no capital letter), you'll see a window with a wizard instead of the visualization software.

Register

Register works like this:

 register image1.mnc image2.mnc image3.mnc

Each image will be represented by one column in the order that they have been entered. The last image is the average of all the images present. The parameters for each image are independent.
Register

In general, we will "Sync" the images. Click on the "Not Synced" button in the top left corner

  • The scale can be adjusted by clicking on the white rectangles containing the numbers. By default, they will be the maximum and minimum values found in the image
  • Values that are beyond the scale will take the color defined by the "over" and "under". Click on it to choose a different one.
  • You can change the image's contribution to the average image by changing the "opacity"
  • The color coding option allows you to change the colors associated with values across the scale.
  • The purple cross in the images points towards a specific coordinate just below the images.
    • You can change them by clicking on the images or by entering another number.
    • The image's value associated with that coordinate is found in the blue box below the coordinates.
    • You can also move around by holding the middle click in an image and moving your mouse up or down.
  • You can Zoom with the scroll while hovering the mouse over an image.
  • You can move around an image by pressing shift + left click and moving the mouse around.
  • The white bars that separate all 3 views can be moved up or down by drag and dropping. (this can be tedious as you need to click on just the right pixel)

Display

Display is built on the same principles as register, but it is focused on visualizing one single image. It possible to visualize two overlayed images (e.g. PET and MRI) at the same time. To view one image + a mask, you'll typically enter something like:

 Display image.mnc -label mask.mnc

This will open 2 windows: the visualization and the menu.
You can go through the menu using the keys, but it's always possible to look at the menu to search for the option you're looking for.
Display

Viewing options

Default visualization is not great. Let's improve things a little bit.

  • Since we're viewing an MRI, let's use the grayscale by pressing D twice.
    • This will bring us to the colour coding menu (D) and select the grayscale option (D).
  • With H, enter a new range, say 150 to 700 instead of the default (this varies from one image to another)
  • With V, we can turn the labels on or off.
    • Otherwise, we can make them more transparent with C, say with 0.2.
  • This is a hippocampal subfields segmentation, so let's focus on the hippocampus by:
    • Enlarging the coronal view by moving the crossing point of the blue lines towards the lower left quadrant.
    • Zooming in with the scroll and centering ourselves on the right hippocampus with Shift + left click just like with register

To launch Display with those settings, we can add options like this:

 Display -gray -range 150 700 image.mnc -label label.mnc
Display2

Selecting labels

Now, let's say that I only want to focus on grey matter volumes to take a screenshot. I want to remove all of the white matter segments.

  • First identify the labels you don't want to see. I want to hide the brown, the indigo and the purple ones.
    • When hovering over one of the labels, I can see the label value in the lower left corner. Brown = 111
  • Press the spacebar to leave the colour coding menu and press F to enter the segmenting menu.
  • Press 2 and enter one label you want to hide, then press enter.
  • Repeat for every labels you want hidden The labels will stay hidden even when you turn them on or off, but they will reappear if you change the opacity.
Display3

Drawing a mask using Display

Preparing the image

Let's say I want to draw a mask of the entorhinal and transentorhinal cortex on the MNI-152 standard image. Images related to this standard template are available here, including brain region labels and many different types of images depending on your preferences. Here, I'm using the symmetrical 09b with high resolution.

Before getting started, always adjust your image to maximize the contrast between your target and your non-target areas. It doesn't have to look good.

  • In my case, the entorhinal cortex has a signal between 50 and 60, so I've adjusted my range between 40 and 70.

Compare these two images: the first with a range 40-70 and the second, with a range 10-90
High-contrast low-contrast

Drawing options overview

To draw masks, we use the right-click:

  • Right-click alone: paints with the designated label (default = 1)
  • Shift + right-click: applies the second paint (default = 0 - it erases)
  • You can cancel your last move by using CTRL + Z

In addition, we will mostly use the F (segmenting) menu with the following options:

  • D to change the paint color
  • 1 to change the second paint color (if you want to draw 2 masks at the same time)
  • F changes the paint brush size
Paint 1

It seems like 1.2mm is the ideal radius to draw the cortex. Let's also set the second paint to 2 so that we can draw the entorhinal and the transentorhinal cortex in parallel.

Where to start

This is an anatomical segmentation, but we could apply the same principle by basing ourselves on a PET overlay image using different criteria do delineate the region.

  • First, let's find the first slice to draw. For this, I recommend looking at all 3 views.
  • The "+" and "-" keys next to the numpad are also particularly useful for segmenting: They will move you up or down one slice.
  • Here, I'm looking for the first slice posterior to the bend in the rhinal sulcus.
After the bend

And this is right before the bend, the rhinal sulcus has a completely different orientation.
Before the bend

Drawing process

You'll first draw the mask on one view - the most informative one. Here, the coronal view is ideal.
You'll draw the mask slice by slice using the + and - keys until you find the other end of your region.
Slice example:
Anterior slice

Reviewing your mask

When you've gone through all the slices, look for inconsistencies by looking at all 3 views. For example, you can see that, on the sagittal view, I've been inconsistent in delineating the border between entorhinal and transentorhinal regions.
Middle slice

The most time-consuming process is to review the slices so that they are consistent with one another. Here, we see how the borders of the entorhinal (Red) cortex vary a little bit in the sagittal view.
Posterior slice

Saving your mask

To save an image file, leave the segmenting menu (spacebar) and go into the file menu (T). Save the labels (W) at the desired location.
Saving

Additional tips and tricks

  • For large areas with details contours, you can use a small brush to draw the contours, place the cursor in the center of the contoured area, and press E to fill the contour.
  • If your region is similar from slice to slice, press H to bring the segmentation of the previous slice onto the one you've working on.

Clone this wiki locally