Introduction To Medical Image Analysis
Introduction To Medical Image Analysis
http://courses.compute.dtu.dk/02512
Week 3
Pixelwise operations and colour images
5 17 53 75 99 180
0 1
0.5
in
Point processing
Input Output
1 2 0 1 3
12
2 1 4 2 2
9
1 0 1 0 1
1 2 1 0 2
2 5 3 1 2
• The value of the output pixel is only dependent on the value of one input pixel
• A global operation – changes all pixels
Point processing
Grey level enhancement
– Process one pixel at a time independent of all other pixels
– For example used to correct Brightness and Contrast
Known from the television remote control
Brightness
𝑔𝑔 𝑥𝑥, 𝑦𝑦 = 𝑓𝑓 𝑥𝑥, 𝑦𝑦 + 𝑏𝑏
Brightness
Contrast
The contrast describes the level of details
we can see
Change contrast
Each pixel is multiplied by a
– f(x, y) is the input image
– g(x, y) is the (enhanced) output image
If a>1 => more contrast
If a<1 => less contrast
out
in
𝑔𝑔 𝑥𝑥, 𝑦𝑦 = 𝑎𝑎 ∗ 𝑓𝑓 𝑥𝑥, 𝑦𝑦 + 𝑏𝑏
15 DTU Compute, Technical University of Denmark Image Analysis 2020
DTU Compute
in
𝑔𝑔 𝑥𝑥, 𝑦𝑦 = 𝑎𝑎 ∗ 𝑓𝑓 𝑥𝑥, 𝑦𝑦 + 𝑏𝑏
19 DTU Compute, Technical University of Denmark Image Analysis 2020
DTU Compute
Histogram Reminder
A histogram normally contains the same number of “bins” as
the possible pixel values
A bin stores the number of pixel with that value
Histogram inspection
Dark image
Bright image
Histogram inspection
Low contrast
High contrast
Histogram stretching
Histogram stretching
We want
– Min = 0
– Max = 255
We have
– Min = 32
– Max = 208
𝑣𝑣𝑚𝑚𝑚𝑚𝑚𝑚,𝑑𝑑 − 𝑣𝑣𝑚𝑚𝑖𝑖𝑖𝑖,𝑑𝑑
𝑔𝑔 𝑥𝑥, 𝑦𝑦 = 𝑓𝑓 𝑥𝑥, 𝑦𝑦 − 𝑣𝑣𝑚𝑚𝑚𝑚𝑚𝑚 + 𝑣𝑣𝑚𝑚𝑚𝑚𝑚𝑚,𝑑𝑑
𝑣𝑣𝑚𝑚𝑚𝑚𝑚𝑚 − 𝑣𝑣𝑚𝑚𝑚𝑚𝑚𝑚
Histogram stretching
255
𝑔𝑔 𝑥𝑥, 𝑦𝑦 = 𝑓𝑓 𝑥𝑥, 𝑦𝑦 − 32
176
31 DTU Compute, Technical University of Denmark Image Analysis 2020
DTU Compute
208 255
32 0
– Changing gray / color levels in the Computer Vision (ICCV). Vol. 1. 2017.
image
– Point wise operations
https://www.quora.com/What-does-the-term-
semantic-segmentation-mean-in-the-context-
of-Deep-Learning
Other mappings
Non-linear mappings
Not always nice to work with byte images
– Better to work with image with values in [0,1]
Conversion to [0,1]
Back to bytes
Byte image
Non-linear transformation Byte image
1
𝑔𝑔 𝑥𝑥, 𝑦𝑦 = 𝑓𝑓(𝑥𝑥, 𝑦𝑦)
255
39 DTU Compute, Technical University of Denmark Image Analysis 2020
DTU Compute
Gamma mapping
Gamma mapping is used in televisions and flat
panels
Can increase the contrast (dynamics) in more
selected part of the histogram
Many games have a possibility for a gamma
correction
Gamma curves
Named after the Greek letter
gamma
What happens to the dark
areas
– With 0.45?
– With 2.22?
Conversion to [0,1]
Back to bytes
Byte image
Gamma mapping Byte image
Logarithmic mapping
Why?
𝑔𝑔 𝑥𝑥, 𝑦𝑦 = 𝑐𝑐 log (1 + f x, y )
255
𝑐𝑐 =
log(1 + 𝑣𝑣𝑚𝑚𝑚𝑚𝑚𝑚 )
Thresholding
A threshold T is a value
– Pixels below that value is set to 0 (background)
– Pixels equal or above is set to 1 (object)
One threshold value for the entire image
– Difficult to choose!
Thresholding
T=110
Background
and bone
have same
value!
T=128 T=140
T=128 T=140
T=110
Automatic Tresholding
Automatic Tresholding
Otsu’s method
Ideal
Histogram shaping
It is not possible to “unmix”
using gray level
transformations
Should be Should be
higher lower
https://askabiologist.asu.edu/rods-and-cones
Color sensitivity
https://askabiologist.asu.edu/rods-and-cones
62 DTU Compute, Technical University of Denmark Image Analysis 2020
DTU Compute
Object colors
Subtractive colors
Object colors
Additive colors
Additive colours: Final colour
is made by mixing red,
green, and blue
RGB = Red, Green, and Blue
Television, computers, digital
cameras use the “RGB color
space”
Typically the values of R, G,
and B lie between 0 and 255
RGB Colours
When alle three “Lamps” are turned of we get
black
When all three “lamps” are on what do we get?
(0,255,0)
RGB = (0,0,0) (255,0,0) (0,0,255)
(255,255,0) (0,255,255)
(255,0,255)
RGB = (255,255,255)
65 DTU Compute, Technical University of Denmark Image Analysis 2020
DTU Compute
http://www.skyandtelescope.com/astronomy-resources/astrophotography-tips/redeeming-
color-planetary-cameras/
(r,g,I)
Melanoma segmentation
An algorithm that can
do pixelwise
classification
– Background / skin
– Melanoma
Color thresholding
Color thresholding
Color variation
The major variation is in the brightness
– This will spread out the values in RGB space
The Hue is rather constant
HSI Space
– HUE and saturation rather stable
– Only variation in intensity / value
Cancer metabolism
Cancer cells typically have a
high metabolism
– They eat more!
A tracer
PET-FDG image
PET
Wikipedia
PET Image
Areas with high glucose
intake will be brighter
– Higher intake of
radioactive molecules
Bimodal histograms in
areas with cancer cells
Big research topic
Wikipedia
88 DTU Compute, Technical University of Denmark Image Analysis 2020
DTU Compute
Combining Images
CT is good for bone
PET is good for cancer
What if I want to see both?
PET/CT scanner
– Patient scanned in both a CT and a PET
scanner
Image registration
– Take two or more separate
images
– Combine them using image
registration
– More about that later
Thresholds visited
The tumour became much
more separated from the
background
Perhaps a simple threshold is
enough now?
The best solution
– Clever imaging techniques
and
– Intelligent image analysis
Next week
Neighbourhood processing
– Filtering