Lab4 - 3 Instruction
Lab4 - 3 Instruction
However, there exist some difficulties with this approach. They are very sensitive to
initialization; they cannot follow the topological changes such as merging and splitting; and
different parametric methods lead to different solutions. To solve the mentioned problems,
some methods were introduced such as Gradient Vector Flow and Dynamic Directional
Gradient Vector Flow.
In the non-parametric methods, the concept of “Level Set” function is utilized. In this method,
we map the information from image plane to a smooth function (Level Set). When we set the
initial contour on the image, we can consider that we divided the image into two parts: outside
of the contour and inside of the contour. Also, the contour itself is the edge between inside and
outside regions. Therefore, we map the image in a way which the inside part represented by
negative values, the outside by positive values and the zero-level set is related to the contour
boundary.
1
3D Image Reconstruction and Analysis in Medicine
𝜑(𝐱, 𝑡) < 0 𝐱 ∈ Ω
{ ̅
𝜑(𝐱, 𝑡) > 0 𝐱 ∈ Ω
𝜑(𝐱, 𝑡) = 0 𝐱 ∈ Ω𝜕 = Γ(t)
By this function, we can follow the contour evolution by only finding the zero values of the level set
function.
As we look at the whole process more carefully, we can find that the level set based method is exactly
a PDE equation, because we try to evolve a function through the time on an image (we have to variable,
spatial and temporal). The whole evolution function can be written as:
𝜕𝜑
+ 𝑉. ∇𝜑 = 0
𝜕𝑡
This equation can be read as: level set function (𝜑) will be changed though the time spatially with the
speed (energy) of V.
Regarding this formula, there are some notation:
∇𝜑
• Normal vectors can be calculated as: 𝐍 = |∇𝜑|
∇𝜑
• The evolution should be done only toward normal vector of each point: 𝑣𝑛 = 𝑉. |∇𝜑|
∇𝜑
• Curvature of the contour (surface) can be calculated as: 𝜅 = −∇. (|∇𝜑|)
• The boundaries of the level set function can be obtained by: 𝛿(𝜑)|∇𝜑| where 𝛿 is Dirac delta
function.
• We can use Heaviside function to find inside and outside of the function:
𝐻(𝑥) ≡ 1 𝑖𝑓 𝑥 > 0
{
𝐻(𝑥) ≡ 0 𝑖𝑓 𝑥 < 0
• Integral over the contour (surface) for a quantity like 𝑃(𝑥, 𝑡) is presented by:
∫ 𝑝(𝑥, 𝑡)𝛿(𝜑)|∇𝜑|𝑑𝐱
𝐑𝑛
• “Reinitialization” process helps the contour to hold its zero level after each iteration and prevent
it from being too flat or too sharp.
• Level set function 𝜑(𝐱, 𝑡) defines over the whole image but in order to speed up the evolution
process, the computation will often be done in a narrowband around the zero-level set.
2
3D Image Reconstruction and Analysis in Medicine
𝜕𝜑 ∇𝜑 ∇𝜑
+ (𝛼(𝑥) − µ(𝑥)∇. ( )) . ∇𝜑 = 0
𝜕𝑡 |∇𝜑| |∇𝜑|
Where
∫ (1 − 𝐻(𝜑(𝑥))) . 𝐼(𝑥)𝑑𝑥
𝑢=
∫(1 − 𝐻(𝜑(𝑥)))𝑑𝑥
∫ 𝐻(𝜑(𝑥)). 𝐼(𝑥)𝑑𝑥
𝑣=
∫ 𝐻(𝜑(𝑥))𝑑𝑥
Therefore, the evolution equation will be:
𝜕𝜑
(𝑥) = 𝛿(𝜑(𝑥))((𝐼(𝑥) − 𝑣)2 − (𝐼(𝑥) − 𝑢)2 )
𝜕𝑡
I correspond to the main image and x refers to coordinates (pixels).
First, try to find out how this equation works.
Then, implement this on the provided framework.
3
3D Image Reconstruction and Analysis in Medicine
1
𝑔(𝐼) =
1+ ‖∇(𝐺 ∗ 𝐼)‖2
I(.) correspond to the image intensity, Г is the curve and G is a gaussian filter of variance 1.
Evolution equation:
𝜕𝜑
(𝑥) = 𝑔(𝐼(𝑥))‖∇𝜑(𝑥)‖(𝑐 + 𝑘) + ∇𝑔(𝐼(𝑥))∇𝜑(𝑥)
𝜕𝑡
∇𝜑(𝑥)
Where 𝑘 = 𝑑𝑖𝑣(‖∇𝜑(𝑥)‖)
Again, find out how this energy works and then implement it in the framework.
Try to use MiaLab to segment the bigger disk in also “TestLeak.bmp”, “TestLeak12.bmp”
and “TestLeak15.bmp”. Can it do it and why?
Task 7) Brain Segmentation
Use the “open mhd file” option to open the “T1_1mm_brain.mhd” file. Try to segment the
white matter of the brain. Try to increase/ decrease the smoothing factor and observe the
changes.
4
3D Image Reconstruction and Analysis in Medicine
In step 2, enable “show blocking region”, and draw a blocking bubble in the brain stem. Re-
run the segmentation.
Try to find a way to segment the whole brain (so-called skull stripping). (What are the means
to prevent leaking?)
Task 8) Abdominal Artery Segmentation
Load aorta.mhd and try to segment out the abdominal arteries using the threshold-based
method. You can also try to segment the kidneys using the interactive tool. (Compare the result
with the result from Task 4, which is better and why).
Task 9) Multi-structure segmentation
The purpose of this task is to segment several bony structures in one framework.
Open the software by clicking on “MiaLab” icon. Load the data by click on “Open DataSet”/
open Nifti file and then select the file “fracture.nii”. From top menu choose “WorkFlow” and
click on “Bone segmentation and print”. Here, you can set different labels on different
structures; these seeds work as initial surfaces. After that, click on “Start Segmentation”; this
will use watershed segmentation method which leads to over-segmenting the region.
After it gives back the results in different color, click “Next” to use threshold-based level set
method for each of the structure. In this step, you have to find the intensity range and set initial
seeds for each structure separately.
This process, generate a final mask in which each segmented region will be labeled by a
different integer. The final mask and the mesh grid (that can be useful for 3D printing) will be
automatically generated as “fracture_mask.nii” and “fracture_mask.sed”in the same path of the
original file.
Good Luck!