Image Analysis in Geosciences - ROCK … · stereology basics Image SXM: Analyze menu ... plot data...
Transcript of Image Analysis in Geosciences - ROCK … · stereology basics Image SXM: Analyze menu ... plot data...
monday tuesday wednesday thursday friday
volumes segmentation grain size shape & strain FFT & ACF
9:00session 1 1st day start at 10:00
introductionoverviewcourse organization
image modelpoint operations POPsegmentation by POP
grain size3D to 2Dsize distributions GSDgrain size mapping(Lazy grain size map)
raster to outline(Lazy digitize)digitizing artefacts(scasmo)
spatial frequencyFourier transformsFFTfrequency filtering
10:30 breakbreakbreakbreakbreak
11:00session 2
digital imagesImage SXM introlook-up tables(Lazy LUTs)scale - calibratere-size
LAB SESSIONmake stack: phase map - grain map - gb mapsegmentation &structural filtering(Lazy erode dilate)
2D to 3DKaleidagraph:prepare histogramsstripstarexamples
particle shape, axesparticle orientation(paror)bulk fabricKaleidgraph:plot results
autocorrelation function (ACF)(Lazy ACF)
12:30 lunch breaklunch breaklunch breaklunch breaklunch break
13:30session 3
pre-process: noise filter background corrections(Lazy lighting)segmentation by LUTcopy - image mathcontiguous phase stack
neighbourhood operations NOPaveraging filtersgradient filterssegmentation by NOP(Lazy grain boundaries)
fractal GSDsGSD mapping(Lazy D-map)
surface orientation(surfor)bulk fabric - strainindividual shapes of particles (ishapes)various shape factors
open session special topicsprojects
15:00 breakbreakbreakbreakbreak
15.30session 4
volume estimation(Lazy LUTs)stereology basics
Image SXM: Analyze menuKaleidagraph:plot data
LAB SESSIONgrain size analysis
LAB SESSION:surfor and paror analyses
discussionfinal wrap-upcourse evaluation
17:00 end of dayend of dayend of dayend of dayend of day
Image Analysis in Geosciences
where?University of Minnesota
Renée Heilbronner
when?April, 27 - May, 1, 2015
TWIN CITIES WORKSHOPThis short course is designed to familiarize the participants with methods of image processing and to provide sufficient background to be able carry out a number of different microstructural analyses.
Two basic types of image analysis are introduced: - direct analysis of images without segmentation, - analysis of segmented images (bitmaps), best fit objects or outlines.
Depending on the audience, additional special techniques may be introduced at any point in the course.
WEB INFOhttp://earth.unibas.ch/micro/
SCHEDULE
TEXT BOOKHeilbronner, R. and Barrett, S.D.: ‘Image Analysis in Earth Sciences’, Springer Verlag, Heidelberg, 2013.ISBN 978-3-642-10342-1
SOFTWAREImage SXM (Mac) and/or ImageJ / Fiji (Mac and PC)Spreadsheet ProgramPlot Software
DAY 1 - 'look at the data'• scale, calibrate, re-size, visualize• histograms, profiles, LUTs• morphological operations• from element maps to phase maps• volume estimates
DAY 2 - 'image analysis basics'• segmentation image → bitmap
POP, NOP, edge detectors• image analysis of segments, best fit ellipses• re-direct sampling• property mapping• texture mapping
DAY 3 - 'all about grain size'• 2D grain size / grain size distribution• 3D grain size / grain size distribution• fractal grain size distribution
DAY 4 - 'all about shape'• paror - orientation of particles• surfor - orientation of surface• ishapes - shapedescriptors
DAY 5 - 'spatial aspects'• FFT - spatial frequencies• ACF - neighbourhood relations• spatial distributions
scheduleMonday Tuesday Wednesday Thursday Friday
9 204 121
10 121 204 121 121 209
11 121 204 121 209
12 121 121 209
13 121
14 121 121 20914121
121121
121 209
15121
121121
121 20915121
121204
121 209
16121
121204
121 20916121
121204
121 209
17121 204
17
the software
Image SXM (Pascal)MacOSX - software used in workshop: http://www.liv.ac.uk/~sdb/ImageSXM/
Image SXM is a version of the public domain image analysis software NIH Image that has been extended to handle the loading, display and analysis of scanning microscope images. Image SXM supports SAM, SCM, SEM, SFM, SLM, SNOM, SPM and STM images
Fiji - imageJ (Java)can be used with Mac and PC: http://fiji.sc/wiki/index.php/Fiji
FABRIC and GRAINSIZEFortran programs: paror, surfor, ishapes, stripstarhttp://earth.unibas.ch/micro → Software Download
http://earth.unibas.ch/micro → Textbook: corrected figures
Additional softwareSpread sheet
Raster graphics
Kaleidagraphhttp://www.synergy.com/KaleidaGraph 4.5 for Windows and Macintosh
SciDAVis - Scientific Data Analysis and Visualizationhttp://scidavis.sourceforge.net/
Adobe Photoshophttp://www.adobe.com
gimp - GNU image manipulation programcan be used with Mac and PC: http://www.gimp.org/
day 1
seeing images
what is an image ?
René Magritte: La trahison des images (1928–1929)
now you see it ....
... but the computer does not
... now you don’t
... but the computer does
what the computer ‘sees’ ...
... is not what we see
image analysis
image analysis ←→ image processing
image → image
image → number
type 1 - direct image analysis
2550
no. o
f pix
els
grey value
grey
val
ue
traverse 5000 px
ACF
type 2 - analysis of segments
peri
met
er (
px)
d equivalent
π3.99
px
px
px
type 3 - analysis of best-fit ellipses
0.65
1.00
px
(°)
type 4 - analysis of outlines
0.83
0°
90°
180°
0°
90°
180°
particle ODF
surface ODF
digital image
the digital image
analog - digital discretization
X
Y
x
y
x
y
g
X
Y
G
pixel = picture element
bit or byte
1 bit image:! bitmap
8 bit (byte) image:! greyscale! monochrome
Abbreviations:
bit! bbyte! B, kB, MB, GB
Bits and bytes 28 = 2560 1
2 = 2 values1bit
or
1 1 1 0 1 0 0 1
2 = 256 values8byte
example (decimal = 233):
27 2
6 2
5 2
4 2
3 2
2 2
1 2
0
D 9
161 160 162 = 256 values
digits: 0123456789ABCDEFhexadecimal
R G B C M Y
400-500 nm
500-600 nm
600-700 nmwav
elen
gth
color systems
additivelight mixing
subtractivepigment mixing
inspecting the imagepresenting the data
element maps
quartz! SiO2
plagioclase! Na0.8Ca0.2Al1.2Si2.8O8
K-feldspar! KAlSi3O8
muscovite! K(Al)2AlSi3O10OH2
biotite! K(Fe,Mg)3AlSi3O10OH2
apatite! Ca10(PO4)6(OH)2
Al Ca Fe K Mg Na Si
qtz ++
pl + ++ ±
kfs + ++ ±
ms + - + ± -
bt ++ ++ ++ -
ap ++
Al
Ca
Fe
K
Mg
Na
Si
scale and calibrate25 px = 100 µmscale XY
calibrate ZFiji
SXM
compare maps
Mg < Fe
Fe
Mg
Mg - Fe
Mg / Fe
Image SXMProcess Image Math...
compare maps
K - Si
K mean 37%
Si mean 63%
Si - K real
Si - K
K inverted
Image SXMProcess Image Math...
differenceFijiProcess Image Calculator...Operation: Difference
Fe
Mg
K
Si
from element maps to phase maps
RGB = Al - K - Na RGB = Al - Fe - K
RGB = Al - K - Na grouped RGB = Al - Fe - K grouped
exerciseRGB phase maps
exercise
1. open color edx maps - make gray scale2. observe histograms - profiles3. scale - calibrate4. pre-process - median - mean shift (ImageJ)
5. combine to stack6. make RGB - play with contrast - invert etc.
7. open maps again8. make binary: 2 levels9. combine to stack - RGB - etc.
10. use Lazy LUT: three levels11. combine to stack - RGB - etc.
LUT & POP segmentation
LUT to POP - ThresholdG
Vvi
ew
GVmatrix
LUT to POP - Density Slice
Apply LUT (⌘L) - SXM onlyG
Vvi
ew
GVmatrix
LUT to POP - Density SliceG
Vvi
ew
GVmatrix
Apply LUT (⌘L) - SXM only
LUT → GVnew = f (GVold) → POP
Apply LUT
Point operation: GVnew = f (GVold)
GVnew = 1(=255) if (lower<GVold<upper)GVnew = 0 if GVold<lowerGVnew = 0 if GVold>upper
GVold GVnew
GV
new
GVold
GV
view
GVmatrix
POP
pre-processlook at the data
detail of mylonitic granite! SEM / BSE contrastimage size: ! 1424 x 1080 px! 1px = 0.24 µmresolution:! 100 grey values (of 256)! ~7 bit
white biotite
light grey K- feldspar
light grey muscovite black boundaries, etc.
micrograph of mylonitic granite (Truzzo) 1424 x 1080 pixel SEM / Back scatter electron contrast
grey plagioclase dark grey quartz
1 - biotite
2 - K- feldspar
3 - muscovite
4 - plagioclase
5 - quartz
6 -boundaries, holes, etc.
all phases
all phases
1 2 3 4 5 6
Profiles
1 - biotite
2 - K- feldspar
3 - muscovite
4 - plagioclase
5 - quartz
6 - boundaries, holes, etc.
pre-processnoise removal
pre-process: extract region of interest (ROI)
detail( 8x )
SEM scanning artifactas recorded
6 - boundaries, holes, etc.1 - biotite 2 - K- feldspar
3 - muscovite4 - plagioclase
5 - quartz
1 2 3 4 5 6
smoothing
1 - biotite 2 - K- feldspar
3 - muscovite4 - plagioclase
5 - quartz 6 - boundaries, holes, etc.
1 2 3 4 5 6
ranking filters: Median
1 - biotite 2 - K- feldspar
3 - muscovite4 - plagioclase
5 - quartz 6 - boundaries, holes, etc.
1 2 3 4 5 6
Mean shift (imageJ - http://rsb.info.nih.gov/ij/plugins/mean-shift.html)
1 - biotite 2 - K- feldspar
3 - muscovite4 - plagioclase
5 - quartz 6 - boundaries, holes, etc.
1 2 3 4 5 6
scale calibratere-size
scale and calibrate ≠ re-size
scaling:! x = scaling factor · X ! y = scaling factor · Y ! scaling factor defines true size of pixel
calibrating:! gv = calibration · GV ! calibration defines true value of GVX, Y, GV = integerx, y, gv = real, but still discrete values ! image size (X· Y· depth) is unchanged
why scale ?• create image with certain pixel size: e.g.1024· 1024 for ACF or FFT• create image with certain resolution: e.g.10 px = 1 µm• create series of images with identical true size: e.g. 10 · 6 mm2
why calibrate ?• create image with certain pixel size: e.g.1024· 1024 for ACF or FFT• create image with certain resolution: e.g.10 px = 1 µm• create series of images with identical true size: e.g. 10 · 6 mm2
why re-size ?
achieve given magnification: e.g 2 px / µmcheck scale ! (= 1.46 px/µm) => factor = 2 / 1.46 = 1.37click ⌘E! Horizontal Scale = 1.37 (Vertical Scale is the same)
achieve given matrix size: e.g. shortest dimension ≥ 512, 1024, ... (for FFT or ACF)select ROI! (= 412 px high) => factor = 512 / 412 = 1.25click ⌘E! Horizontal Scale = 1.25 (Vertical Scale is the same)
achieve complete histogram / noise reduction without changing size:click ⌘E! Horizontal Scale = 1.25 bicubicclick ⌘E! Horizontal Scale = 0.80 bicubic interpolation
original enhanced re-sizedenhanced re-sized
scale (X,Y)
select line tool
place line on scale
Analyze
calibrate (Z)
Analyze1. Reset2. Measure 2 sites3. Calibrate...
! scaled! calibrated
remove scaling calibration
Analyze
press <alt> key
Edit
re-size imageNN (2x)
bilin (2x)
bicub (2x)
original (1x)
( ⌘E )
( ⌘A )
NN
bilin
bicub
changing image size
image size = 712· 5042.06 px = 1 µm
image size = 356· 2521.03 px = 1 µm
changing image size affects scalingbut does not change real size
change of image size BILINEAR
0.64x bilin
original
change of image size BICUBICoriginal
0.64x bicubic
0.8x 0.8x bilin
progressive change of image sizeoriginal
size change by 'equal temperament'
M =! desired final magnifications = ! number of stepsm =! magnification at each step
chromatic scale: halftone 'magnification' √ 2 = 1.05946 (12 halftones/octave)12
Johann Sebastian Bach
'Das wohl-temperierte Klavier'
(wikipedia)
m = √ Ms
m = √ 0.5 = 2 times 0.707 2
m = √ 4 = 5 times 1.3195 5
0.5x bilin
0.7x 0.7x bilin
cascadedirect
original
progressive change of image size
Profiles
2 - K- feldspar3 - muscovite
4 - plagioclase 5 - quartz
1 - biotite
6 - holes etc.
original
Profiles
2 - K- feldspar3 - muscovite
4 - plagioclase 5 - quartz
1 - biotite
6 - holes etc.
x 1.25 bilinx 0.80 bilin
Profiles
2 - K- feldspar3 - muscovite
4 - plagioclase 5 - quartz
1 - biotite
6 - holes etc.
x 1.25 bilinx 0.80 bilinsmoothed
background corrections
Image SXM! menu item! action
Process! Subtract Background:!! 1D horizontal! line by line! 1D vertical! column by column! 2D rolling ball! subtract smooth topography
SPM! Compensations:! Line-by-line constant! Line-by-line linear! Line-by-line quadratic
Process! Image Math:! flatten ! Division! (divide by background image)
Macros! Lazy lighting! flatten! ! (subtract ideal background)
background corrections
original 1D horizontal 1D vertical
Rolling Ball FAST Rolling Ball
Radius = 200image size 325· 250
Process... Subtract Background
original Line-by-line constant Line-by-line linear
Line-by-line quadratic 1x hor 1x rotated
image size 325· 250
SPM... Compensation
camera LUT applied:cirpolCAL
circular polarization background divide real:cirpol / background
subtract real: cirpolCAL - backCAL
camera LUT applied:backCAL
Process... Image Math
backgroundoblique illumination
central light dome
model background
Lazy lighting
correct top-bottom [F]Correct linear brightness trend
Lazy lighting
select center [S] correct light [C]Correct radial brightness trend
Lazy lighting
grey level slicinglive segmentation
density slicing tool
Density Slicing
Density Slicing = Threshold in imageJ
Density Slicing/Threshold in imageJ
Density Slicing/Threshold in imageJ
0 and 255 can be selected(≠ Image SXM)
grad
ient
2 - K- feldspar
Density Slicing
3 - muscovite
Density Slicing
scanning artefact
4 - plagioclase
Density Slicing
5 - quartz
Density Slicing
boundaries, holes, etc.
Density Slicing
?!➡
1 - biotite
Density Slicing
1 - biotite
Density Slicing
add 1
1 - biotite
Density Slicing
separate phases
Lazy LUT
separate phases
Lazy LUT
separate phases
Lazy LUT
volume estimation
live segmentation
25 78 106 158 200
qtzplmskfsbt rest
gb
grey level
direct phase area estimate
plagioclase
pl
qtz gbkfs ms bt
stereology basics
+ ++ +
+ ++ +
+ ++ +
+ ++ +
point counting A
A!=! A / Atotal != area fraction
PP! =! P / Ptotal ! = point fraction
AA!=! PP
black : grey : white = 37.5 : 25 : 37.5 (%)
counting pixels A
A!=! A / Atotal ! = area fraction
##!=! # / #total ! = pixel fraction
AA!=! ##
black : grey : white = 33.03 : 27.12 : 39.84 (%)
determine estimate area fraction (%)
find volume %
x
y
α
Atot
Aα
z
y
Δz
Vtot
ΔV
α
VV
= Vphase α / Vtotal
find volume fraction from area fraction Aα of phase α in image (x-y plane)
! Volume of phase α:ΔVα = Aα(z) Δz ! (1)! ΔVα in slice Δz (→Cavallieri)Vα = Σ ΔV = ∫ dVα = ∫ Aα(z) dz! (2)! Vα = ΣΔV = area under curve Aα(z)∫ Aα(z) dz = Z·Āα! (3) ! area under curve = mean area Āα times ZVα = Z·Āα! (4) ! combine equation (2) and (3)Vtot = Z· Atot! (5)! total volume
! Volume fraction of phase α:Vα / Vtot = (Z·Āα) / Vtot! (6)! dividing by total volume(Z·Āα) / Vtot = Āα /(Vtot/ Z)! (7)! rewrite (6)Vα / Vtot = Āα / Atot! (8)! rewrite (6) ⇒ VV = AA
z
Atot
Aα(z)
Aα
Aα
dzz
y
Δz
Vtot
ΔV
α
y
α
Atot
Aα
xZ
Basic stereologic equation:
VV = AA = LL = PP! (dimensionless)
(for proof, see Underwood, 1970, Quantitative Stereology, Addison-Wesley)
determine volume %
Also:! S V = (4/π)· LA = 2PL! (mm-1)
! L V = 2PA! (mm -2)
! P V = 1/2· LVSV! (mm -3)
pixel fraction ## = AAAA = VV
volume % = area % = pixel %
7.25bt
20.75kfs
2.23ms
40.41pl
29.38qtz
100.0sum
area%= vol%
error estimation
- distribution of phase is random - location of phases independent of each other ! (= diluted system)- (regular) grid point spacing >> cross sectional
area of phase (systematic point count)
σ(PP) / PP = 1/√Pα
(Underwood, 1970)
! P = total number of points on grid! Pα = total number of points on phase α
error for point counting
error for area measurement by pixel#
(1) quick and dirty estimation:
- must not set Pα = # of pixel !!!- assume constant size of a, i.e., σ(a) = 0- replace Pα with number of cross sections N (one estimated value N for all phases)
! N = total number of cross sectional areas
relative error:σ(AA) / AA ≈ 1/√N
error for area measurement by pixel#
(2) for constant size of cross sectional areas:
- assume constant size of a: σ(a) = 0- replace Pα with number of cross sections Nα
! Nα! number of α-areas
relative error:σ(AA) / AA = 1/√Nα
error for area measurement by pixel#
relative error:σ(AA)/AA= 1/√Nα· √([σ(a)/ā]2+1)
(3) for variable size a:
- assume constant size of a: σ(a) > 0- replace Pα with number of cross sections Nα
! Nα! number of α-areas! a! size of α-areas! ā! average size of α-areas
count or estimate number of particlesN = 167N ≠ #px = 710· 500 = 355'000
example
167
for all phases N = 167error = 1 / √ ( N) = 1 / √ (167) = 7.8 %⇒ quartz content = 29.4 ± 2.3 %
σ(AA) / AA = 1/√Nerror from number of cross sectional areas
for individual phases (example quartz: N = 47)error = 1 / √ ( Nα) = 14.6 %⇒ quartz content = 29.4 ± 4.3 %
7.25bt
20.75kfs
2.23ms
40.41pl
29.38qtz
100sum
area%
error for area measurement (pixel#)
error from standard deviation of areas
σ(AA)/AA= 1/√Nα· √([σ(a) / ā]2 + 1)
for individual phases (example quartz: N = 47)error = 1/√Nα· √([σ(a) / ā]2 + 1) = 14.6 % · √(0.4342 + 1)error = 14.6 % · 1.41 = 20.6 %⇒ quartz content = 29.4 ± 6.1 %
error for area measurement (pixel#)7.25bt
20.75kfs
2.23ms
40.41pl
29.38qtz
100sum
area%
error estimates for phases
phase area
(%)
particles
N
rel. error
1/√N
1/√Ntot
±(%)
1/√Nphase
±(%)
1/√Nphase √([σ(a)/ā]2+1)
±(%)
bt 7.25 15 0.258 0.56 1.87 4.00
kfs 20.73 32 0.177 1.60 3.67 5.82
ms 2.23 7 0.378 0.17 0.84 1.21
pl 40.41 66 0.123 3.13 4.97 9.11
qtz 29.38 47 0.146 2.27 4.29 6.06
all 100.00 167 0.077 7.74 7.74 12.96
±(%) = ± phase percentage
exercisestereology
exercise
1. open Truzzo2. pre-process (noise) - background - re-size - crop3. save
4. Lazy LUT: separate phases (Z-space)5. measure area% (live)
6. make phase stack7. morphological filtering
8. estimate phase%9. determine errors