Exercise: Segment a Brain Tumor
Overview
This exercise is based on the following Slicer tutorial: pdf
What is a meningioma?
- The most common type of primary brain tumor: ~30% of all brain tumors
- These tumors originate in the Meninges
- Three protective layers that surrounds and supports the brain
- Dura, Arachnoid, and Pia mater
- Meningiomas grow out of the arachnoid (the middle layer of the meninges).
- Their growth can press against the brain or spinal cord and cause serious problems.
- Meningiomas are named by their location:
- e.g. Falcine meningiomas form in the falx, whereas parasagittal meningiomas form near the falx (The falx is a very thin layer of tissue between the two sides of the brain.)
Localization of intracranial meningiomas. Left: Axial view of meningiomas at the base of the skull. Right: Coronal view of meningiomas in the cranial dome, the falx cerebri, and intraventricular. For more information on meningiomas, click here. Image: University Department of Neurosurgery, Inselspital Bern.
What is gadolinium?
- Gadolinium (Gd) is a malleable and ductile rare-earth element
- It can be used as a contrast agent for MRI.
- When injected intravenously into the body, gadolinium enhances and improves the quality of the MRI images.
- This helps improve the visibility of inflammation, tumors, blood vessels, and—for some organs—blood supply.
- Gd is eliminated from the body through the kidneys.
How does Gadolinium improve contrast in MRIs?
- Gadolinium is paramagnetic at room temp
- helps with contrast by increasing nuclear spin relaxation rates
- Gd does not readily cross the blood-brain barrier
- But, brain tumors degrade the BBB, allowing Gd to penetrate
Required Extension
This exercise requires the following extensions:
- HDBrainExtraction.
- PyTorch
Be sure to install those extensions before continuing.
Load the Tumor datasets
- Select the
Sample Dataset
module - Select MRBrainTumor1 and MRBrainTumor2
- Explore the volumes.
- Notice the tissue contrast in the brain.
Inspect Volume
Bring up the Data module
You should see two volumes:
- MRBrainTumor1
- MRBrainTumor2
Hover over the names of these volumes. Notice that you get some information on the volumes themselves.
Do the volumes have the same dimensions and voxel sizes?
No.
Volume Module
Bring up the Volume module
The volume module gives you more detailed information on the volumes and allows you to change the display properties of the volumes.
What are the dimensions of the volume (Image Dimensions) and voxels (Image Spacing)? What is the Scalar type and Range?
- MRBrainTumor1
- Image Dimensions: 256 X 256 X 112
- Image Spacing: 0.94 X 0.94 X 1.4 mm
- Scalar Range: 0 to 695
- Scalar Type: short (16-bit)
- MRBrainTumor2
- Image Dimensions: 256 X 256 X 130
- Image Spacing: 0.94 X 0.94 X 1.2 mm
- Scalar Range: 0 to 986
- Scalar Type: short (16-bit)
Inspect the Tumors
Starting with MRBrainTumor1, find the tumor and get all three slice viewers aligned onto the tumor.
Then inspect Tumor 2.
Baseline radiologist's clinical impression:
- large falcine lesion is identified.
- measures 3.10 cm anteroposteriorly and 3.51 cm in height.
- enhances moderately on post gadolinium imaging.
volume Render the Tumors
In this step, we will render the MRI volume in 3D and then use the crop tool to crop the volume down to the tumor.
- Bring up the Volume Rendering Module
- Set Volume: to
MRBrainTumor1
- Click open Eye Icon next to Volume to render
- Select the
MR-Default
display preset - Enable Crop and Display ROI
- In the 2D Viewers, drag the ROI so that it captures just the Tumor.
-
Make sure to scrub through the slices in all three planes to verify that you captured the tumor.
-
When you're done sizing the ROI, hide it by closing the eye next to "Display ROI".
- Adjust the display by sliding the Shift slider
Overlay Volumes
- Use the Slice controllers to overlay the volume.
- Foreground:
Tumor2
- Background:
Tumor1
- Foreground:
- Change the transparency between the 2 volumes to 50%
- Are the volumes aligned?
Register the Volumes
In the previous step, we saw that the two brains (from the same human) are not aligned. This is due to the fact that the MRIs were captured at two separate time points and the subject wasn't precisely positioned in the same location in the machine. In this step, we will register the brains, which means we will align their positions.
Under the Registration Modules Menu, choose the "General Registration (BRAINs)"
Change the following settings:
- Fixed Image Volume:
MRBrainTumor1
- Moving Image Volume:
MRBrainTumor2
- Slicer Linear Transform: Create New Linear Transform
- Output Image Volume: Create new volume as "MRBT2mvd"
- Initialize Transform Mode:
useMomentsAlign
- Registration Phases:
Rigid (6 DOF)
- Click apply. Should take about 1 minute.
Check registration
In the Volumes Module, change the colormap of the newly created "MRBT2mvd" volume to a different color like shades of magenta (CoolShade3) or inverse gray
Use the Slice controllers to overlay Tumor1 with MRBT2mvd.
- Foreground:
MRBrainTumor1
- Background:
MRT2mvd
- Adjust LUT for MRT2mvd (so its not so overexposed)
- Set transparency to 50%
Are they aligned?
Yes? Good.
SAVE YOUR WORK!
Segmentation
Next, we'll segment the tumors using the segmentation tool.
Segment Tumor1
We will use the Grow-from-seeds method to segment the Tumor in the MRBrainTumor1 volume. First, though, we need to segment three orthogonal sections from the tumor (and sample the background).
2D Slice Viewers
- Find the largest cross-section of the tumor in the Sagittal viewer (yellow viewer).
- Ensure that the slice includes some of the bright white meninges layer as well.
- Align 2D viewers (Hold the shift button and hover the mouse) so all three viewers are aligned with the Yellow viewer
- Compare with the image below for an example of how the 2D viewers (in the 4up layout) should look (but without any green label yet)
Segment Editor
Bring up the Segment Editor and use the following settings:
- Segmentation: Rename new segmentation as
SegTumor1
- Master Volume: Set to
MRBrainTumor1
- Create a new Segmentation called Tumor1
- Create another segmentation called Not_tumor
Threshold
The threshold tool allows you to select a range of intensities to segment. Here, we will use the threshold tool for masking.
- Bring up the threshold tool to set the masking range
- Move the cursor over to the center of the tumor cross-section in one of the slice viewers
- Notice that the cursor has the icon of the Threshold tool in one corner
- Click and hold on the center of the tumor
- A yellow circle will appear. As you drag, the circle gets larger
- Drag to the edge of the tumor to to capture the intensities in that tumor
- Release the mouse button
- Notice that you have just set the Threshold Range in the Threshold module.
- Adjust the range to 125-500 if needed
- The flashing color in the view slicers indicates what will be segmented if you were to click
Apply
(but don't do that) - Click on the
Use for masking
button.- This will restrict the paint tool to only paint voxels with an intensity that falls in the intensity range (125-500)
Paint Tool
After clicking on the Use for masking
button, Slicer should have automatically switched over to the paint tool. If not, do so now by clicking on the paint tool button.
In the Masking settings of the paint tool, the "Editable intensity range" should now be turned on:
Now when you paint, you will only be able to paint inside the tumor and other bright areas, like the meninges, where the intensities fall inside of the editable intensity range.
Go ahead and paint the three orthogonal slices of the tumor, as follows:
Next, in the Paint tool, change the masking to the following settings:
Notice that we have un-checked the "Editable Intensity range". With these settings, you will be unable to overwrite the tumor labels you have already drawn, but you should be able to paint everywhere else.
Select the "Not_Tumor" label in the segmentations table and paint the background surrounding the tumors, as follows:
Grow-From-Seeds
- Select the "Tumor1" label in the segmentations table and then bring up the Grow From Seeds tool
- Use the following Masking settings:
- Editable Area:
Everywhere
- Modify other Segments:
Overwrite all
- Editable Area:
- Click on the
Initialize
button - Scrub through the slices and ensure that the two labels are properly labeled. If not, use the paint tool to correct any label errors, making sure you select the right segmentation in the segmentation table before painting
- Click
Apply
and wait. - Enjoy segmented tumor (Be sure the Show 3D button is selected in the segment editor tool)
- Clean-up tumor noise using the Smoothing tool
- Enjoy a freshly segmented tumor!
SAVE YOUR WORK!
Tumor2
Ok, repeat the segmentation for Tumor2, with the following changes:
- Create a New Segmentation as
SegTumor2
- Change the Master Volume to
MRBT2mvd
- Create a new Segment called Tumor2. Change the color of this segment to Blue (or a different color from the original tumor)
Final Comparison
Go to the Data Module. You should see the following in your Node list:
- MRBrainTumor1 (Volume)
- MRBrainTumor2 (Volume)
- Slicer Linear Transform (LinearTransform)
- MRBT2mvd (Volume)
- SegTumor1 (Segmentation)
- Tumor1 (Segment)
- SegTumor2 (Segmentation)
- Tumor2 (Segment)
Review how slicer organizes the data.
- Each Segmentation contains segments that are specific to a volume (MRBrainTumor1 or MRBT2mvd, in this case)
- Click on MRBrainTumor1
- Notice how other items in the Data table light up - these are connected to Tumor1 in some fashion
- Hover over one of the Segmentations (Like Tumor1). After a beat, you get information about that volume: >Segment - ID, Segment_1, Representations: Binary labelmap, Closed Surface, Colol: (128, 174,128)
- Compare that information to the information that you get for the volumes, like "MRBrainTumor1" >Volume (Dimensions: 256 X 256 X 112 Spacing: 0.938 x 0.938 x 1.42mm )
Review Segments
- Display only the MRBrainTumor1 volume to slice viewers (add to the background). Hide any other volumes
- Display the Tumor1 segment and the Tumor2 segment by opening the eye icons in the Data hierarchy
- Compare their dimensions. Do they look the same size?
Region Properties
So, have the tumors changed in size?
Manually Measure Tumor With Ruler
You can measure objects in Slicer using the Markups tools, which includes a points list, line, angle, curve, closed curve, plane, ROI etc. To reveal the Markups toolbar, click on the Markups Toggle Button
Switch to the Markups module to keep track of your markup measurements.
Measure the tumor using the Line tool
- Scrub the viewers so that you see the widest aspect of the tumor in each view.
- Select the Line Markup tool (the second button from the left)
- Measure the tumor by click on one side of the tumor and then on the other side
- Each time you click, Slicer adds a control point (red dot) to the viewer
- Slicer measures the distance between two sequential control points.
- Be consistent how you make your measurements
- Be sure to measure all three anatomical axes of the tumors: A-P, L-R, S-I
- Make sure that you measure across the widest part of the tumors in each plane.
Making Multiple Sequential Line Measurements
You can make several measurements at the same time by turning on the "Place Multiple Control Points" setting. In the Markups tool bar, bring up the Place Control Points menu by clicking on the triangle next to this icon:
Now when you are done with one line measurement, you can go on to the next. Double-click the last control point when you are done. If you accidentally get an extra measurement point in the Markups table, just delete that measurement.
Label and Organize each measurement
- As you measure each length, an entry will be added into the Markups table, prefaced by an "L" (for length)
- Double-click on that name and rename it to indicate tumor number and Anatomical Axes, e.g.
T1-LR
- Also, for each measurement, under the Display:Advanced tab, uncheck
Properties Label
to remove text from the slices - When you are ready to Measure the second tumor, hide all of the first tumor markups by closing the eye icons for each measurement in the Markups table
- Finally, when you have made all of your measurements, create a new folder in the Markups module called Line Measurements and drag all of your measurements into this folder
You should end up with something that looks like this:
Segment Statistics
You can calculate properties like volume and surface area using the Segment Statistics Module
Switch to the Modules:Quantification:Segment Statistics module and enter the following settings
Inputs
Set the inputs as follows:
- Segmentation: Select a Segmentation node (e.g. "SegTumor1" or "SegTumor2")
- Scalar Volume: Should automatically update to the appropriate volume
Advanced
Under the advanced tab, there are several statistics that can be calculated: Labelmap Statistics, Scalar volume statistics, and Closed Surface Statistics. Labelmap and Scalar will likely give you very similar results. Closed Surface stats will assume that the volume is completely sealed and give you slightly different results. You can add or remove stats by clicking on the relevant Options
button next to the statistics.
Choose the following options:
- Labelmap Statistics
- Voxel Count
- Volume cm3
- Feret Diameter mm
- OBB diameter mm (oriented bounding box)
- Surface mm2
- Scalar volume statistics
- Minimum
- Maximum
- Mean
- Median
- Standard deviation
- Closed Surface: uncheck (don't calculate)
Once you have set-up all of the options, click Apply
- A table should appear under the slice viewers. You will get one row for each segment in the segmentation (in our case, 1 row).
- Highlight the row
- Copy
- Open Microsoft Excel
- Paste
Repeat the steps for "Tumor2".
Follow-up radiologist's clinical impression
- left frontal lobe mass appears unchanged on all series.
- measures 3.3 x 3.2 cm in maximum dimension.
- enhances moderately on post gadolinium imaging.
Skull Stripping
In this step, we will remove the skulls from the volumes using the HD Brain Extraction tool. This is not strictly necessary to segment the tumors but it does highlight a cool new technique.
Select the HD Brain Extraction tool from the Modules Menu
And set:
- Input volume to
MRBrainTumor1
- Skull-stripped volume to
Create New Volume
- Brain Segmentation to
Create New Segmentation
as "MRBT1SkullStrip" - Click Apply.
- You may get a notice that PyTorch will be installed. Just wait...
Eventually, you should get something awesome, like the following:
Review Stripping Results
Switch to the Data Module and notice that:
- There is a new Volume: "MRBrainTumor1 stripped"
- A new segmentation node has been added called
MRBT1SkullStrip
and it contains one segment: "brain"
Go to the Segment Editor and turn on the 3D view to see the brain in 3D
Challenge
How would you create this scene?
Volume Rendering with Tumors
- Turn on Tumor Segmentations in 3D view
- Turn on coronal slice view in 3D
- Render the Stripped Skull volume
- Crop the volume along the interhemispheric fissure
- Make sure your tumor model is visible