5/15/24
DEPARTMENT OF PHYSICS
MEDICAL IMAGE PROCESSING
MASTERS DEGREE IN BIOMEDICAL ENGINEERING
Ricardo Vigário
([email protected])
QUICK RECAP
2 Morph and tomography
q Morphological transformations
q Basic operations
q convex hull
q thinning and thickening original
q A couple of applications
q Image reconstruction from projections dilated
q Tomography
q Radon transform eroded
q From projection to tomographic reconstruction
q (filtered) Backprojection
1
5/8/24
CONVEX HULL
11 Find a convex shape that holds the image
q A is convex if the straight line segment joining any two points in
A lies entirely within A
q Convex hull, H, is the smallest convex
set containing A
q Iterative on Hit-and-Miss:
q With limiting growth
11
THINNING
12
q Still through hit-or-miss transformation
12
6
5/15/24
EXPECTED FLOW
3 Image coding / compression
q Image coding and data compression
q Basic considerations
q redundancies and the degree of information loss
q measures of distortion and fidelity
q key concepts
q Direct source coding
q Huffman coding
q Run-length coding
q Arithmetic coding
q Lempel-Ziv-Welch coding
q contour coding
q Transform coding
q Principal Component Analysis (PCA) and Karhunen-Loeve transform
q encoding of transform coefficient
q Interpolative coding
q Predictive coding
GETTING THE IMAGE
4 Reversing the process
q ”Inverse Radon Transform” or the Fourier Slice Theorem
1. Compute 1D FFT of the projection
2. Place them in polar orientation
3. Cartesian regridding
q uniformizes the spatial sampling
4. Perform inverse 2D FFT
2
5/15/24
PROBLEM… OVERSAMPLED LOW FREQUENCY
6
q No matter how many projections you make — blurr!
Gonzalez & W oods. “Digital Im age Processing”, Prentice Hall, 2010
Thorsten M . Buzug, Computed Tomography, 2008
FILTERED BACKPROJECTION
7 Filters… always filters
q Remove the centre
q Low frequencies
q Projection artefact
q Remove surrounding
q High frequencies
q Often associated
with noise
Thorsten M . Buzug, Computed Tomography, 2008
3
5/15/24
NUMBER OF PROJECTIONS AND FILTERING
8 Are they really relevant?
Thorsten M . Buzug, Computed Tomography, 2008
A SET OF LINEAR EQUATIONS
9 Projections as equations
q Each projection may be considered as a linear combination of the
attenuation caused along the ray
q !! are the attenuations
q "" are the projections
or image intensities
Thorsten M . Buzug, Computed Tomography, 2008
q The attenuations are solutions to the linear set of equations
4
5/15/24
ALGEBRAIC RECONSTRUCTION TECHNIQUE
10 No analytic… allows to add prior information
q FBP still the most widespread reconstruction approach
q Some considerations preclude analytic approaches (such as FBP)
q If you have just a few projections
q If projections are not equispaced
q If the X-Ray beam is polychromatic (ie., contains different energies)
q Algebraic methods solve some of those concerns
q May compensate energy heterogeneity
q Solve partial volume issues
q In addition… algebraic methods may be pedagogic J
10
JOINING BOTH
11 … projections as weighted sums of the attenuations
q Taking into consideration partial volume, heterogeneities and
other prior information
q Projections become weighted sums, within the system of equations
q Weights may be given as
q Projections can be related to the Radon
q Where the weight matrix is
Thorsten M . Buzug, Computed Tomography, 2008
11
5
5/15/24
THE KACSMARZ METHOD
12 Taking a simple example
q If we take a 2 pixel and two projections case
q The iterative method:
q Initialize randomly or with prior
q Project into the first hyperplane
q Then to the other one
q Convergence found by
q maximum number of iterations
Thorsten M . Buzug, Computed Tomography, 2008
q update smaller than a given threshold
q There are other algebraic methods… ART one is just one example
12
ART / KACZMARZ — A COUPLE OF EXAMPLES
13 Phantoms
q Comparing (filtered) Backprojection and ART
13
6
5/15/24
AND NOW FOR SOMETHING COMPLETELY DIFFERENT
IMAGE COMPRESSION / ENCODING
14
WHY?
15 Do we really need to do it?
q Moore’s law on computing power and data storage…
q But, how heavy are medical images?
q Many such recordings per day in a hospital
q MRI often collected with multiple sequences
q And various multi-modal studies also performed
q Telemedicine and remote work
15
7
5/15/24
ENCODING — BASIC PRINCIPLES
16 Setting some keywords
q Compression quality
q Lossy — visually similar to the original image, but not absolutely the same
q Lossless — exactly the same as the original
q Typically medical image avoids the former… but higher compression
q Possible if there is any form of redundancy, such as
q code — different probabilities of occurrence of all code words
q spatial — neighbouring pixels/voxels tend to be related (high correlation)
q Psychovisual (perceptual, diagnostics,…)
q Measures of similarity and fidelity
q Least-squares single-letter fidelity criterion:
q Or over complete images:
16
BASIC CONCEPTS II
17 … and
q Alphabet
q Predefined set of symbols
q binary → 0, 1
q decimal → 0, … , 9
q Word
q Finite sequence of symbols from alphabet
q Code
q Mapping of words from source alphabet to words of the code alphabet
q Distinct: codes are distinguishable from other
q Uniquely decodable: every word is identifiable when immersed in a sequence
q Optimal: a word is instantaneously decodable and has minimum average length
for a given PDF
17
8
5/15/24
DIRECT SOURCE CODING
18 A class of coding strategies
q Real-life sources of images bear
q limitations in dynamic range
q variability within small spatial neighbourhood
q not generate equally likely random, uncorrelated values
q Typically, grey level PDFs are nonuniform
q Efficient image representations may be based on coding
systems tuned to specific properties of the source image
q Direct source coding
q the method is applied directly to pixel values generated by the source
q without processing them by an algorithm to generate different series of
values
18
HUFFMAN CODING
19 First exmple
q Idea: use
q short code words for highly probable values
q longer codes to represent values with lower probabilities of occurrence
q Average code-word length ! that is limited by the zeroth-order
entropy of the source "' and "' + 1
q Flow:
1. Prepare table listing the symbols (grey levels) in the source image, sorted in decreasing
order of the probabilities of their occurrence
2. Combine the last two probabilities — reduce the list of probabilities by one
3. Rearrange, if necessary, the newly generated list
4. Repeat until the list has been reduced to two entries
5. Assign code digits 0 and 1 to the two entries in the final column of probabilities
6. Work backwardly, assigning additional bits of 0 and 1 to the last splits made
7. Repeat until the first column of probabilities is reached & all symbols have code words
assigned
19
9
5/15/24
HOFFMAN — ONE EXAMPLE
22 An eye for an eye
q Rangayyan’s eye example, coded with 3 bits (0 to 7)
16 x 16
distribution
as a loooooong string of values
22
HOFFMAN CODING 1ST STEP
23 Forward…
q "' is 2.65 (
23
10
5/15/24
HOFFMAN CODING 2ND STEP
24 Backward…
q Average code-word length is 2.69 (/*+,-., very close to the
optimal limit, given by "'
24
RUN-LENGTH CODING
25 Explore repetitions
q If we need to code the two rows:
q 11111111122222300
q 11112222222222211
q Acknowledge that you have many repetitions of symbols and
represent as
q (1, 8); (2, 5); (3, 1); (0, 2)
q (1, 4); (2, 10); (1, 2)
q Works well with highly correlated images, or when one has
large areas in the image with uniform values
q May encode each value with Huffman as well
25
11
5/15/24
ARITHMETIC CODING
26 Another coding
q Symbols treated as magnitudes
q Shannon — string of symbols as the sum of scaled probabilities
q Unlike Hoffman — each symbol does not have a unique code word with,
at least one bit of length
q Arithmetic coding
q symbols of the source string
given by individual prob., "#
and the cumulative prob., /#
q coding starts from a certain
source string, represented by
a code point 0$ and an
interval 1$
q new symbol is a scaling of
the current symbol, 1$%& = 1$ "# , and the new code point is given as
0$%& = 0$ + /#
26
ARITHMETIC EXAMPLE
29 Back to the eye
q How does string 4 6 5 gets codded?
q Notice the intervals, given from the table
q Initializing with '! = 0 and .! = 1
q '" = '! + .! 1# = 0.66
q ." = .! 4# = 0.13
q 4 = '" , '" + ." = [0.66, 0.79)
q 4, 6 = '" + ." 1$ , '" + ." 1$ + ." 4$ = [0.7783, 0.7887)
!
29
12
5/15/24
ARITHMETIC EXAMPLE
30 Back to the eye
q Compression — encode long strings of symbols
30
LEMPEL-ZIV(-WELCH) CODING
31 Yet another one…
q Universal coding scheme for discrete source
q Even when their probabilities are not known a priori
q May also be used to assess complexity level of a signal / image
q From variable length words to fixed length code words
q Can be seen as a search
q Through a fixed-size
q Variable-content dictionary
q For words that match current string
q (-Welch) is a variation, where new strings are added to the
dictionary whenever they are found from the text
31
13
5/15/24
LEMPEL-ZIV — AN EXAMPLE
33 Back to the eye
q Build a dictionary with symbols 0 to 7
q Add new symbol for a combination
that is has not been seen
q Ex: if we consider string {2, 2} as 8,
the new string {2, 2, 3} can be viewed
as 9, or 83, ie., “3” with prefix “8”
q Idea:
q Start scanning,
q Do not repeat a
“basic” symbol
q Add new symbols
to the dictionary
as they appear
33
CONTOUR CODING
34
q Assumption: contours within an image probably consists of pixels
which have same grey-values
q The complete contour may be represented as
q Starting point of contour
q Sequence of steps — eg., Freeman code
q 0 = right; 1 = up; 2 = left; 3 = down
q The contour’s grey value
q Consistent rule for finding contours is required:
q Left-most-looking rule is a possibility
q Check left pixel, relative to the direction of entry
q If same grey-value, add to contour and proceed
q If not, check pixel ahead, ... etc
34
14
5/15/24
THE EXAMPLE FOR CONTOUR CODING
35 The eye
q Contour starting in [1, 1]
q Grey level: 1
q Freeman code:
0000000003030303022221212233201122122212
q Contour coding:
q 4 + 4 + 3 + 40 ∗ 2 = 91?
q 4 per coordinate; 3 for grey level
q With [5, 8]
q Grey level: 2
q Freeman code:
0330221201
q With [9, 1]
q Grey level: 1
q Freeman code:
03303233121111
35
15