USF Libraries
USF Digital Collections

Three-dimensional digital image processing and reconstruction of granular particles

MISSING IMAGE

Material Information

Title:
Three-dimensional digital image processing and reconstruction of granular particles
Physical Description:
Book
Language:
English
Creator:
Rivas, Jorge A
Publisher:
University of South Florida
Place of Publication:
Tampa, Fla.
Publication Date:

Subjects

Subjects / Keywords:
Sands
Photomicroscopy
Edge detection
Grain morphology
Measurements
Dissertations, Academic -- Civil Engineering -- Masters -- USF   ( lcsh )
Genre:
government publication (state, provincial, terriorial, dependent)   ( marcgt )
bibliography   ( marcgt )
theses   ( marcgt )
non-fiction   ( marcgt )

Notes

Summary:
ABSTRACT: This thesis presents a method for digitization of the two-dimensional shape of granular particles by means of photo microscopy and image processing techniques implemented using a software package from Media Cybernetics, Inc: Image-Pro Plus 5.1 and the add-ins Scope-Pro 5.0, SharpStack 5.0 and 3D Constructor 5.0. With the use of these tools, it was possible to implement an efficient semi-automated routine that allows the digitization of large numbers of two-dimensional silhouettes of particles in minimum time, without endangering the quality and reliability of the shapes obtained. Different sample preparation techniques, illumination systems, deconvolution algorithms, mathematical functions, filtering techniques and programming commands are brought into play in order to transform the shape of the two-dimensional projection of particles (captured as a set of successive images acquired at different planes of focus) into a binary format (black and white).At the same time, measurements and statistical information such as grain size distribution can be analyzed from the shapes obtained for a particular granular soil. This information also includes but it is not limited to perimeter, area, diameter (minimum, maximum and mean), caliper (longest, smallest and mean), roundness, aspect ratio and fractal dimension. Results are presented for several sands collected from different places around the world. In addition, some alternatives for three-dimensional shape reconstruction such as X-ray nano tomography and serial sectioning are discussed.
Thesis:
Thesis (M.S.C.E.)--University of South Florida, 2005.
Bibliography:
Includes bibliographical references.
System Details:
System requirements: World Wide Web browser and PDF reader.
System Details:
Mode of access: World Wide Web.
Statement of Responsibility:
by Jorge A. Rivas.
General Note:
Title from PDF of title page.
General Note:
Document formatted into pages; contains 179 pages.

Record Information

Source Institution:
University of South Florida Library
Holding Location:
University of South Florida
Rights Management:
All applicable rights reserved by the source institution and holding location.
Resource Identifier:
aleph - 001709551
oclc - 69173420
usfldc doi - E14-SFE0001395
usfldc handle - e14.1395
System ID:
SFS0025715:00001


This item is only available as the following downloads:


Full Text
xml version 1.0 encoding UTF-8 standalone no
record xmlns http:www.loc.govMARC21slim xmlns:xsi http:www.w3.org2001XMLSchema-instance xsi:schemaLocation http:www.loc.govstandardsmarcxmlschemaMARC21slim.xsd
leader nam Ka
controlfield tag 001 001709551
003 fts
005 20060614112234.0
006 m||||e|||d||||||||
007 cr mnu|||uuuuu
008 060523s2005 flua sbm s000 0 eng d
datafield ind1 8 ind2 024
subfield code a E14-SFE0001395
035
(OCoLC)69173420
SFE0001395
040
FHM
c FHM
049
FHMM
090
TA145 (Online)
1 100
Rivas, Jorge A.
0 245
Three-dimensional digital image processing and reconstruction of granular particles
h [electronic resource] /
by Jorge A. Rivas.
260
[Tampa, Fla.] :
b University of South Florida,
2005.
502
Thesis (M.S.C.E.)--University of South Florida, 2005.
504
Includes bibliographical references.
516
Text (Electronic thesis) in PDF format.
538
System requirements: World Wide Web browser and PDF reader.
Mode of access: World Wide Web.
500
Title from PDF of title page.
Document formatted into pages; contains 179 pages.
520
ABSTRACT: This thesis presents a method for digitization of the two-dimensional shape of granular particles by means of photo microscopy and image processing techniques implemented using a software package from Media Cybernetics, Inc: Image-Pro Plus 5.1 and the add-ins Scope-Pro 5.0, SharpStack 5.0 and 3D Constructor 5.0. With the use of these tools, it was possible to implement an efficient semi-automated routine that allows the digitization of large numbers of two-dimensional silhouettes of particles in minimum time, without endangering the quality and reliability of the shapes obtained. Different sample preparation techniques, illumination systems, deconvolution algorithms, mathematical functions, filtering techniques and programming commands are brought into play in order to transform the shape of the two-dimensional projection of particles (captured as a set of successive images acquired at different planes of focus) into a binary format (black and white).At the same time, measurements and statistical information such as grain size distribution can be analyzed from the shapes obtained for a particular granular soil. This information also includes but it is not limited to perimeter, area, diameter (minimum, maximum and mean), caliper (longest, smallest and mean), roundness, aspect ratio and fractal dimension. Results are presented for several sands collected from different places around the world. In addition, some alternatives for three-dimensional shape reconstruction such as X-ray nano tomography and serial sectioning are discussed.
590
Adviser: Dr. Alaa Ashmawy.
653
Sands.
Photomicroscopy.
Edge detection.
Grain morphology.
Measurements.
690
Dissertations, Academic
z USF
x Civil Engineering
Masters.
773
t USF Electronic Theses and Dissertations.
4 856
u http://digital.lib.usf.edu/?e14.1395



PAGE 1

i Three-Dimensional Digital Image Processing And Reconstruction Of Granular Particles by Jorge A. Rivas A thesis submitted in partial fulfillment of the requirements for the degree of Department of Civil and Environmental Engineering College of Engineering University of South Florida Major Professor: Alaa Ashmawy, Ph.D. Manjriker Gunaratne, Ph.D. Venkat Bhethana botla, Ph.D. Sudeep Sarkar, Ph.D. Date of Approval: October 26, 2005 Keywords: sands, photomicroscop y, edge detection, grain morphology, measurements Copyright 2005, Jorge A. Rivas

PAGE 2

i ACKNOWLEDGMENT I want to thank my supervisor, Dr Alaa Ashmawy, for this great opportunity and support throughout the research I want to thank my colleagues and friends: Aidee Cira, Luis Fuentes, Nivedita Das, Oscar Gomez, Whitney Allen and Luis Herrera and for their support and collaboration. I al so want to acknowledge Robe rt Smith and Leo DiPierro from Allied High Tech, Inc.; Ben Rossie fr om the USF Center for Ocean Technology; Dave Oney from Photix Imaging, Inc.; and Media Cybernetic s Technical Support p ersonnel and the Image-Pro Internet Users Group, who made publicly available macro codes, tips and solutions for Media Cybernetic s products. I also want to thank all those entities and companies mentioned in this document and their cooperation.

PAGE 3

i TABLE OF CONTENT LIST OF TABLES.............................................................................................................iii LIST OF FIGURES...........................................................................................................iv ABSTRACT.....................................................................................................................viii CHAPTER ONE: INTRODUCTION.................................................................................1 1.1 Purpose................................................................................................................8 1.2 Organization of Thesis.........................................................................................9 CHAPTER TWO: EQUIPMENT, TOOLS AND SOFTWARE......................................11 2.1 Hardware............................................................................................................12 2.1.1 Illumination................................................................................................15 2.1.1.1 Koehler Illumination.......................................................................15 2.1.1.2 Ring Light Illumination System......................................................16 2.1.1.3 Double-Pipe Light Guide System...................................................17 2.1.1.4 Brightfield Incident Illumination System.......................................18 2.2 Software.............................................................................................................20 CHAPTER THREE: GENE RAL BASE MODEL FOR TWO-DIMENSIONAL DIGITAL IMAGING OF GRANULAR PARTICLES USING IMAGE-PRO PLUS VERSION 5.1........................................................................................................21 3.1 Introduction........................................................................................................21 3.2 Description of the Process for Two-Dimensional Characterization of Angular Particles Using Im age-Pro Plus Version 5.1........................................22 3.3 Sample Preparation............................................................................................24 3.4 Microscope Settings...........................................................................................25 3.4.1 Microscope Objectives...............................................................................25 3.4.2 Electromagnetic Spectrum, Op tical Filters and Digital Photo Microscopy.................................................................................................26 3.5 Exploratory Routine Implemented for 2D Characterization of Angular Particles Using Image-Pro Plus 5.1....................................................................32 3.5.1 Acquisition of Image Stacks......................................................................32 3.5.2 Imaging Processing for Edge Enhancement..............................................35 3.5.2.1 Selection of an Area of Interest from an Image Sequence.........................................................................................36 3.5.2.2 Process of Deconvolution Using SharpStack 5.0...........................37

PAGE 4

ii 3.5.2.3 Obtaining an Extended Depth of Field Test Strip for a Sand Particle................................................................................45 3.5.2.4 Application of Contrast Improvement Techniques for Better Particle Edge Detection.......................................................49 3.5.3 Creation of Binary Images of Particle Shapes...........................................51 CHAPTER FOUR: QUANTITATIVE IMAGE DIGITIZATION OF GRANULAR PARTICLES..............................................................................................54 CHAPTER FIVE: THREE-DIMENSI ONAL SHAPE RECONSTRUCTION OF GRANULAR PARTICLES: REVIEW OF SOME ALTERNATIVES...........................61 5.1 X-Ray Nano Tomography.................................................................................61 5.2 3-D Reconstruction from Images Acquired at Incremental Focal Planes.........64 5.3 Serial Sectioning................................................................................................65 5.3.1 Selection of a Medium for Serial Sectioning: Epoxy Systems..................67 5.3.2 Sample Preparation: Cold Casting.............................................................71 5.3.3 Equipment for Serial Sectioning................................................................73 CHAPTER SIX: CONCLUSI ONS AND RECOMMENDATIONS...............................75 6.1 Results and Conclusions....................................................................................75 6.2 Recommendations for Future Work..................................................................77 REFERENCES.................................................................................................................82 BIBLIOGRAPHY.............................................................................................................85 APPENDICES..................................................................................................................89 Appendix A. Source Code for the Script File GET2DSAHPE.SCR.....................90 Appendix B. Source Code for the Script File Mult2DShape4x...............................100 Appendix C. Source Code for the Script File Mult2DShape10x.............................120 Appendix D. Source Code for the Script File Mult2DShape20x............................140 Appendix E. Results of Sieve Analys is for Some Sand Samples Collected...........160 Appendix F. Comparison of Results of a Rhode Island Sand Particle Shape Obtained Using the Scripts Mult2DShape4x, Mult2DShape10x and Mult2DShape20x.....................................................................................................161 Appendix G. Grayscale Pictures of Sands Collected...............................................165

PAGE 5

iii LIST OF TABLES Table 1. ASTM Partic le Size Definition.............................................................................2 Table 2. Characteristics of Methods Availa ble In Media Cybernetics Sharpstack 5.0 for Image Deconvolution..........................................................................38 Table 3. Corrections for Optical Aberrati on of Different Types of Microscope Objectives.......................................................................................................43 Table 4. Settings and Combinations Generate d in an EDF Test Strip Sequence. In Total, 16 Frames Represent all Possible Combinations of Settings for Each of the Output Options (Best-Focus Image or Best-Focus Frame).........48 Table 5. Some Properties for the Epotek 301 Epoxy System...........................................69 Table 6. Percentages Retained by Weight for Different Size Ranges of Some Sand Samples Collected.........................................................................................160

PAGE 6

iv LIST OF FIGURES Figure 1. Illustration of Simulation of Shape of a Fraser River Particle: a) Original Particle Outline; b) Particle Generated Using the ORC Method and; c) Particle Genera tion Sequence Using the Modified ORC Method.....................................................................................................3 Figure 2. Motic SWZ-168TL Trinocular Microscope....................................................12 Figure 3. Illustration of Hardware: a) Motic AE31 Inverted Microscope, b) Evolution VF Monochromatic Digital Camera, c) Attachable Mechanical Stage, d) Prior Focus C ontrol System and e) Dell OptiPlex GX280 PC.......................................................................................................14 Figure 4. Koehler Illumination System on Motic AE31 Microscope.............................16 Figure 5. Ring Light Illu mination System: a) Illustration of System, and b) System Mounted on the AE-31 Microscope...................................................17 Figure 6. Double-Pipe Light Guide System....................................................................17 Figure 7. Schematic of the Bright field Incident Illumination System............................19 Figure 8. Characteristics of Motic Oj ective Lenses Used for the Motic AE-31 Inverted Microscope.......................................................................................25 Figure 9. The Electromagnetic Spectrum.......................................................................27 Figure 10. Spectral Sensitivity Characteristics for the Sony ICX205AL Chip................28 Figure 11. IR Transmission Spectra fo r Kodak Wratten 87 IR Pass Filter.......................30 Figure 12. Estimation of the Peak Wave length Captured by the Evolution VF Camera Using the Kodak #87 Wratten IR Pass Gel Filter..............................31 Figure 13. Estimation of the Peak Wave length Captured by the Evolution VF Camera Using the Schott BG40 IR/UV Cut Filter..........................................31 Figure 14. Illustration of the Acquisition Process of Image Stacks on Image-Pro Plus..................................................................................................................33

PAGE 7

v Figure 15. Tile Images for a Rhode Island Sand Particle Obtained at Different Focal Planes Using Scope Pro 5.0. Scale Not Shown.....................................34 Figure 16. SharpStack 5.0 Window..................................................................................39 Figure 17. Demonstration of Change in Numerical Aperture for Two Objective Lenses in an Inverted Microscope with Magnifications: a) 10x and, b) 20x...................................................................................................................40 Figure 18. Effect of Spherical Aberration on a Diatome Frustule According to Lens Shape: a) Minor Effect, b) Me dium Effect and c) Mayor Effect...........44 Figure 19. Tile Images of an Extended De pth of Field Test Strip Sequence for a Rhode Island Sand Particle. Scale Not Shown...............................................48 Figure 20. Example of Boundary Trace on a Simple EDF Test Strip (a) and an Improved EDF Test Strip (b). The Boundary Traced On the Improved Image Is More Accurate..................................................................................51 Figure 21. Binary Image of a Rhode Is land Sand Particle Created Using the Macro MakeBIN.............................................................................................52 Figure 22. Diagram of Operation of th e Macros Contained on the Script GET2DSHAPE.SCR.......................................................................................53 Figure 23. Pictures Extracted from U nprocessed Sequences of Boca Grande Beach Sand Particles (Cartagena, Colombia) Obtained Using the Macro Acquisition ...........................................................................................56 Figure 24. Pictures of Improved Frames from Extended Depth of Field Test Strips (Edfts) for Boca Grande Beach Sand Particles (Cartagena, Colombia) Using the Macro EnhanceEdges .....................................................................57 Figure 25. Pictures of Sorted Sand Partic les from Boca Grande Beach (Cartagena, Colombia) Obtained Using the Macro Sort_GSIs ..........................................58 Figure 26. Edited Pictures of Sand Particle s from Boca Grande Beach (Cartagena, Colombia) Using Macro Edit_GSIs ................................................................59 Figure 27. Binary Images of Shapes of Sand Particles from Boca Grande Beach (Cartagena, Colombia) Using Macro M akeBINI_C_M ..................................60 Figure 28. Description of the Measurements Obtained from Binary Shapes Using Media Cybernetics Image-Pro Plus...............................................................60

PAGE 8

vi Figure 29. Sample Images of Rhode Is land Sand Particles Obtained with a Skyscan 1072 Micro-CT.................................................................................62 Figure 30. Tile Images of Rhode Island Sa nd Particles Obtained with a Skyscan 1072 Micro-CT...............................................................................................63 Figure 31. Representation of Cross Sectio ns during Serial Sectioning. Images Are Acquired After Each Pass on the Polishing Machine.....................................65 Figure 32. Representation of A 3-D Reconstruction of a Glass Micro Sphere and a Sand Particle by Means of Serial Sectioning..................................................66 Figure 33. 3D Visualization of an Artific ial Sphere Using 3D Constructor 5.0...............67 Figure 34. Allied High Tech Multiprep System...............................................................74 Figure 35. Composite Image Obtained Using the Extended Depth of Field Function on Image-Pro Plus For an U.S. Silica #1 Dry Sand Particle: a) Only Visible Light Captured, and b) Only NIR Light Captured. Scale Not Shown.............................................................................................75 Figure 36. Tiled Images of a Cross-Sec tion of a Polished Sample Containing Rhode Island Sand Particles............................................................................79 Figure 37. Normalized Absorption Spectrum of Epolight 9151 In Chloroform...............80 Figure 38. Enhanced Image of a Rhode Is land Sand Particle Obtained Using the Script Mult2DShape4x..................................................................................161 Figure 39. Enhanced Image of a Rhode Is land Sand Particle Obtained Using the Script Mult2DShape10x................................................................................161 Figure 40. Enhanced Image of a Rhode Is land Sand Particle Obtained Using the Script Mult2DShape20x................................................................................162 Figure 41. Measurement of Areas of a R hode Island Sand Particle Using Scripts Mult2DShape4x, Mult2DShape10x and Mult2DShape20x.........................162 Figure 42. Comparison of Measurements Ax is (mayor), Axis (minor), Radius (max) and Radius (min) for a Rhode Island Sand Particle Using Scripts Mult2DShape4x, Mult2DShape10x and Mult2DShape20x.........................163 Figure 43. Comparison of Measurements Perimeter, Perimeter (convex) and Perimeter (ellipse) for a Rhode Island Sand Particle Using Scripts Mult2DShape4x, Mult2DShape10x and Mult2DShape20x.........................163

PAGE 9

vii Figure 44. Comparison of Measurements Fe rret (max), Ferret (min) and Ferret (mean) for a Rhode Island Sand Particle Using Scripts Mult2DShape4x, Mult2DShape10x and Mult2DShape20x.........................164 Figure 45. Comparison of Measurements Di ameter (max), Diameter (min) and Diameter (mean) for a Rhode Island Sand Particle Using Scripts Mult2DShape4x, Mult2DShape10x and Mult2DShape20x.........................164 Figure 46. Pictures of Sands from: a) US Silica Standard Melt and b) US Silica #1 Dry................................................................................................................165 Figure 47. Pictures of Sands from: a) O xnard and b) Belmont Pier, Long Beach, CA.................................................................................................................165 Figure 48. Pictures of Sands from: a) Rincon Beach, Puerto Rico and b) Rhode Island.............................................................................................................165 Figure 49. Pictures of Sands from: a) Redington Shores, FL and b) Belleair Beach, FL......................................................................................................166 Figure 50. Pictures of Sands from: a) Daytona Beach, FL and b) Indian Rocks Beach, FL......................................................................................................166 Figure 51. Pictures of Sands from: a) Madeira Beach, FL and b) Clearwater Beach, FL......................................................................................................166 Figure 52. Pictures of Sands from: a) Lo ire River, France and b) Fontainbleau, France............................................................................................................167 Figure 53. Pictures of Sands from: a) Hostun, France and b) Nice, France...................167 Figure 54. Pictures of Sands from: a) Arroyo Alamar, Mexico and b) Tecate River, Mexico...............................................................................................167 Figure 55. Pictures of Sands from: a) Toyoura, Japan and b) Malibu Beach, Panama..........................................................................................................168 Figure 56. Pictures of Sands from Boca Grande Beach, Cartagena, Colombia..............168

PAGE 10

viii THREE-DIMENSIONAL DIGITA L IMAGE PROCESSING AND RECONSTRUCTION OF GRANULAR PARTICLES Jorge A. Rivas ABSTRACT This thesis presents a method for digitiz ation of the two-di mensional shape of granular particles by means of photo micr oscopy and image processing techniques implemented using a software package from Media Cybernetics, In c: Image-Pro Plus 5.1 and the add-ins Scope-Pro 5.0, SharpStack 5.0 and 3D Constructor 5.0. With the use of these tools, it was possible to implement an efficient semi-automated routine that allows the digitization of large numb ers of two-dimensional silhoue ttes of particles in minimum time, without endangering the quality and reli ability of the shapes obtained. Different sample preparation techni ques, illumination systems, deconvolution algorithms, mathematical functions, filtering techni ques and programming commands are brought into play in order to transform the shape of the two-dimensional projection of particles (captured as a set of successive images acquired at different pl anes of focus) into a binary format (black and white). At the same time, measurements and statistical information such as grain size distribution can be analy zed from the shapes obtained for a particular granular soil. This information also include s but it is not limited to perimeter, area, diameter (minimum, maximum and mean), caliper (longest, smallest and mean),

PAGE 11

ix roundness, aspect ratio and fractal dimensi on. Results are presented for several sands collected from different places around the worl d. In addition, some a lternatives for threedimensional shape reconstruction such as X -ray nano tomography and serial sectioning are discussed.

PAGE 12

1 CHAPTER ONE: INTRODUCTION Conditions at which Earth has evolved thr ough ages, has made soils everywhere in the world have their own fingerprint. Soils have been formed and transformed through different environmental conditions in tim e and have their own characteristics. Sands are granular materials composed of small particles of rock and minerals (produced by mechanical disintegration), sh ells and fossils (biogenic particles), and chemical precipitates. Sands can be descri bed in terms of particle size, composition, morphology (angularity and shape), color and te xture. Grain size re sults from factors such as composition, durability, weathe ring conditions, phys ical sorting and transportation conditions. Mechanical and chem ical processes determine grain shape once it is released from the original mineral matrix (Margolis and Krinsley, 1974, Raham, 1995). From an engineering perspective, sand is everything that has grains, no matter the composition, ranging from a diameter of 74 m (particles retained on U.S. Standard Sieve No. 200) till 4.76 mm (passing U.S. Standard Sieve No.4).

PAGE 13

2 Table 1. ASTM Particle Size Definition Size and shape of particles are part of the history of the formation of a soil. Cho et al. (2005) explored the effects of particle shape on packi ng as well as small and largestrain properties of sandy so ils. Correlations between index properties and mechanical parameters that are justified by particle shape were also explored. The macro scale behavior of soils results from particle intera ctions which are affect ed by particle shape. Therefore, it is a significant soil index pr operty that has emerged as a parameter that needs to be properly characterized and docum ented (Santamarina et al, 2004). Digital image analysis facilitates the evaluation of mathematical descriptors of particle shape including Fourier analysis, fractal analysis and other hybrid techniques (e.g., Meloy 1977, Clark 1987, Hyslip and Vallejo 1997, Bowm an et al. 2001, Sukumaran and Ashmawy 2001). In the study of the infl uence of particle shape on liquefaction behavior using Discrete Element Modeling for granular part icles (Ashmawy et al 2003), the use of Overlapping Rigid Clusters (ORC) method wa s proposed. This technique simulates the two-dimensional shape of granular particles by overlapping disks of different diameters. The resulting outline resembles the origin al particle outline. Later on, Sallam and Ashmawy (2005) proposed a operator-independ ent modified ORC technique. The new modification ensures that the mass, center of gravity and mass moment of inertia of the simulated particle matches with the shape of the original grain.

PAGE 14

3 Figure 1. Illustration of Simulation of Shape of a Fraser River Particle: a) Original Particle Outline; b) Particle Generated Using the ORC Method and; c) Partic le Generation Sequence Using the Modified ORC Method [Source: Sallam and Ashmawy (2004)] The use of digital image processing techniques has been found to be a useful tool for shape recognition and digital imaging of objects in two and three dimensions. Maerz and Zhou (1999) remark the potential impact of using image analysis for characterizing aggregate size and shape in terms of quality, tim e and cost savings. Chandan et al (2004) used photo microscopy techniques to charac terize the geometry a nd the analysis of aggregate particles used in highway and geot echnical applications. In their work, texture was analyzed by multi-scale wavelet decom position representation on grayscale images. Their review emphasized the need for a met hod to capture particle texture. Angularity was described employing a gradient-based met hod, plus form analyses of particles are done using binary images and computing sh ape factors and spheri city indexes. As

PAGE 15

4 mentioned in their publication, several studies addressed the relations hip between particle shape and performance of asphalt mixes, concretes and unbound layers. In the geotechnical field, material cl assification and mechanical re sponse of soil particles are the main focus of similar studies. Advances in hardware technology permit an increase in speed and accuracy for such tasks. The implementation of advanced image processing techniques is imperative for image noise removal and a successful analysis of particle shapes. This research uses photo microscopy tec hniques and the software package ImagePro Plus 5.1 (including the add-ins Scope-Pro 5.0, SharpStack 5.0 and 3D Constructor 5.0) from Media Cybernetics, Inc. to digita lize the two-dimensional shapes obtained from silhouettes projected by grains of different types of sand colle cted from different regions of the world. It is of fundamental importance to detect and accurately define the edges that define the contour of particles. For this researc h, several types of illumination systems and optical filters were tested to get the best result possible in photo microscopy. The images obtained were improved with software tools av ailable on the Image-Pro software family. There are different methods for image enha ncement and edge detection available as built-in functions on the Image-Pro software fa mily. But the best re sults were obtained by combining and applying several algorith ms, functions, commands and arithmetic operations that can be called by the user as individual semi-automated routines. Thanks to the versatility of the Macro Programming Language ( Auto-Pro ) of ImagePro Plus, these routines offer certain degr ee of standardization for the process of

PAGE 16

5 acquisition and improvement of images, e dge recognition, particle shape imaging, counting and measurements of images. They ar e intended to save a significant amount of time and minimize user error, t hus providing a higher level of efficiency and facilitating the whole process to the user. The recollection of a large number of twodimensional grain shapes can be also used to estimate the grain size distribution for a specific type of granular soil (between 5,000 to 10,000 particles). Pirard et al (2004) reported that an adequate image analysis is capable of predicting the sieve size distributi on with a fraction of the quantity needed for a sieve analysis. This research shows a wa y on how to easily recollect measurements from digitalized shapes. They can later be used to estimate a grain size distribution and other statistical data fr om the sands analyzed. In the case of 3D reconstruction, alternatives such as X-Ray Nano Tomography Systems and 3D Reconstruction from monosc opic images acquired at incremental focal planes are examples of non destructive methods. X-ray Computed Tomography is a branch of X-ray microscopy in which a series of projection images are used to calculate a 3D reconstruction of an object. The equipment is expensive but it is a high-resolution techni que with the ability to resolve details as small as 0.4 um in size for visu alizing the 3D microstructure and geometry of materials. Garboczi (2002) described a mathematical pr ocedure using spherical harmonic functions that can completely characterize concrete a ggregate particles and ot her particles of the same nature form 3D particle images obtained via X-ray Tomography. These new systems usually come fully equipped and incl ude their own 3D reconstruction software.

PAGE 17

6 They are being implemented by several science fields because of its simplicity of use, reliability and none destructiveness of the samples analyzed. Shape-from-focus uses different focus leve ls to obtain a sequence of object images and relies on surface texture for the com putation of depth (Noguchi and Nayar, 1994: Niederoest et al., 2003). Algorithms and t echniques exist that perform both the calculation of a sharp image and the recovery of the three dimensi onal structure of the specimen. But it was not until recently that more robust, fast and user-friendly systems have been implemented due to advances in computing technology. Shape-from-focus has found great use in light micros copy visual inspection tasks, mainly to obtain accurate depth estimates on several materials. Serial Sectioning is a destructive met hod which relies on the use of high precision equipment to finely remove layers of mate rial from the sample. It does not only consume a considerable amount of time but also requi res special care in comparison with other alternatives. Serial sectioning techniques have been used several times (Bower et al., 1966; DeHoff et al., 1972; Mangan et al., 1997; Wolfsdorf et al., 1997; Li et al., 1998 and 1999). But the processes were tedious and provided awkward quality. Alkemper and Voorthees (2001) describe a technique for seri al sectioning analysis in which alignment and rotation errors as well as sample tilti ng are negligible. The t echnique was illustrated through the reconstruction of the microstruc ture of a cast sta ndard alloy specimen. Approximately 20 cross-sections per hour with spacings in the range of 1 and 20 m can be acquired. Chawla and Wunsch (2004) performed a serial sectioning process on

PAGE 18

7 aluminum composites reinforced with Silicon Ca rbide (SiC) particles for 3D visualization and Finite Element modeling. The main objec tive was to understand the microstructure morphology and the connection between materi al structure and performance. Modeling of the composite correlated very well with their experimental results. The serial sectioning process is being extende d to other materials, as in this case, granular particles in soils. The explorat ion of the morphological characteristics and numerical modeling now days can be performe d with a greater degr ee of accuracy thanks to advances in technology. There are several software packages avai lable for three-dimensional reconstruction and visualization of serial sections. Fiala and Harris ( 2002) developed techniques for practical and cost-effective serial sectio ning analysis and 3D reconstruction. Fiala continued refining the technique and created Reconstruct a Windows application for montaging, aligning, tracing, measuring, and re constructing objects fr om serial section images. This freeware software is available at http://synapses.bu.edu/. A common limitation found in some programs available is the need of a consta nt thickness or slice interval between cross sections for 3D recons truction. In serial sec tioning, it is not an easy task to remove material at equal interv als, so programs with this limitation can not be used. Each method mentioned before has its advantages and disadvantages and their applicability may have a greater level of success if applie d to certain type of materials.

PAGE 19

8 1.1 Purpose The main objective of this research is to establish a reliable method for acquisition, processing, measuring and storage of 2D images of particles of different types of sands collected. Other goal was to evaluate alternat ives for 3D reconstruction. The process for such task has to be practical, systematic and should be capable of a quantitative and qualitative reconstruction. The techniques es tablished and proposed for two dimensional characterizations are designed to offer good re sults with less operator dependency and systematically increasing efficiency. The shapes obtained with the application of this research will be used to: a) Characterize mathematically different types of sands using shape descriptors, b) Use those shapes for numerical modeling. The development of an operator-independent Modified Overlapping Rigid Clusters me thod, proposed by Sallam and Ashmawy in 2004 to simulate 2D shapes, is in progress and w ill be used for the numerical modeling and c) Shape analysis from sand particles can be used to check the influence of size/size distribution versus shape. Part icle size distribution from a sieve analysis and an image analysis could be compared and their correlation verified.

PAGE 20

9 1.2 Organization of Thesis This thesis is organized as follows: A brief description of the equipment, tools a nd software utilized for this research is summarized in Chapter Two. Chapter Three explains an in itial procedure developed to assist the operator in the following areas: 1) Sample preparation for photomicrography 2) Digital image acquisition of granular particles 3) Image processing 4) Edge detection and delineation of the boundary defined by the 2D shape projection of particle silhouettes 5) Creation of binary images (Black an d White) that represent that shape. Basic routines assembled for Image-Pr o Plus (IPP) are used to explain the whole process. These routines are intended for detailed inspection and evaluation purposes only. Basic th eoretical aspects about all the steps and equipment involved are al so included throughout the chapter. They help the user to assimilate and understand the whole process. Chapter Four explains a group of semi-autom ated macros that provide a fast way for the acquisition and processing of images, t hus simplifying the whol e operation of shape imaging and the obtaining of measurements and statistical data of the samples. Three-dimensional reconstruction methods are introduced to the reader and discussed in Chapter Five.

PAGE 21

10 Results, conclusions and recommendati ons are summarized in Chapter Six. The appendices of this work contain the programming codes for all the scripts assembled for Image-Pro Plus. Some images that show some results obtained under different conditions, some meas urement comparisons made a nd standard sieve analysis for some types of sands are also included.

PAGE 22

11 CHAPTER TWO: EQUIPMENT, TOOLS AND SOFTWARE This chapter describes the hardware and so ftware used for this research. The main components for image acquisition and processi ng are basically an inverted optical microscope equipped with a monochromatic di gital camera, optical filters, illumination systems and a motorized focus control. All these interfaced with a desktop computer. This powerful computer is Microsoft Windo ws compatible and has commercial imaging software installed that also controls the automated hardware. The purpose of the implementation of these tools is to set a semi-automated system that allows the digitization of particle shapes in a qualitat ive and quantitative manner. Specialized macro routines have been implemented to automate as much as possible all steps involved in the process and digital image processing has been used to facilitate pa rticle edge detection and identification. Finally, binary shapes re presenting the silhouette s of particles are created and several measurements can also automatically be perf ormed by the imaging software. If needed, more detailed information on a ny of the items described in this section may be found in their respective manufacturers documentation.

PAGE 23

12 2.1 Hardware The types of microscopes used are the SWZ-168TL Trinocular Microscope and the AE31 Inverted Microscope manufact ured by Motic Instruments, Inc. The SWZ-168TL (Figure 7) was used as an inspection and sample preparation microscope. It comes with zoom objectives ranging from 0.75x to 5x. Incident halogen and transmitted halogen are two types of illu mination available by default on this model. It is digital camera ready. Figure 2. Motic SWZ-168TL Trinocular Microscope The AE31 Inverted Microscope (Figure 3) was selected because it provides longer working distance objectives with higher numeri cal apertures than upright microscopes. It comes with the following magnifications: 4x, 10x, 20x, 40x and 60x. Also, there is more working space available for handling and placin g samples. It is also digital camera ready. A mechanical stage with low positioned coaxia l controls was attached and used for X and Y horizontal displacement of the samples. The focusing of the microscope was controlled via hardware manufactured by Prior Scientific, Inc. The Focus Control System is

PAGE 24

13 composed of a Motorized Focus Control (MFC), which offers step sizes as small as 0.002umin the Z-axis. A Digipot Focus Only Control for the MFC, which has buttons for fast up and down movements (for coarse focu sing) and fine focus adjustments by means of a tactile feel. These two pi eces are attached to a Prior ProScan II Advanced Controller, which is connected to a PC computer and is capable of controlling a motorized stage, motorized focus control, three filter wh eels and three shutters (See figure 3). With respect to optical filters used for the Motic AE31 Inverted Microscope, please go to section 3.4.2 for more detailed information. The Evolution VF Monochromatic di gital camera employed has a maximum resolution of 1.4 million pixels in a 12-bit digi tal output. It can captu re digital data at frame rates of up to 110 fps in region of in terest with binning. It comes with an IEEE 1394 FireWire digital interface. If necessar y, it can be converted to a color camera through an optional kit. The focus control system and the camera are connected to a Dell OptiPlex GX280 Desktop Computer. This PC has comes with an Intel Pentium IV processor running at 3.2 GHz, 2 GB of RAM DDR, 160 GB Hard Driv e, a DVD Burner, and a 19 Flat Screen Monitor. An ATI Radeon XT700 Pro Video Accelerated Card with 256MB of memory was added for better video performance.

PAGE 25

14 Figure 3. Illustration of Hardware: a) Motic AE31 Inverted Microscope, b) Evolution VF Monochromatic Digital Camera, c) Attachable Mech anical Stage, d) Prior Focus Control System and e) Dell OptiPlex GX280 PC

PAGE 26

15 2.1.1 Illumination Regarding to illumination, it has been found to be a key factor for successful imaging. Depending on the application, extensiv e trials have been made in order to achieve the best illumination technique possi ble. The purpose of good illumination is to provide the best contrast for easier edge detection. Depending on th e type of particles being analyzed some may work better than othe rs, but a baseline is provided for future reference. Results for the same type of pa rticles observed under the microscope could differ if the particles are illuminated by diffe rent systems. Light reflection and haze in very angular particles may di stort the light, thus making it difficult to detect a well defined shape. Quartz particles are the most challenging particles to digitize because of the problem explained. The illumination system s explained on this section were found to be very useful to minimize image artif acts and to get better quality images. 2.1.1.1 Koehler Illumination The Motic AE31 comes with a Koehler Illu mination System with a 6V-30W quartz halogen lamp (Figure 4). It requires proper se t up of the microscope for obtaining the best possible specimen image. It has an externa lly operated mechanism for control of all facets of illumination, and is adjusted with rack and pinion mounted on the illumination pillar. The Extra Long Working Distance (ELWD) condenser with an aperture diaphragm and a Numerical Aperture (N.A.) of 0.30 provi des a working distance of 7.2 cm and is suitable for 4X to 40X objectives. Koehler illumination provides very even specimen illumination from the back for both visual and photo microscopy. The way and type of

PAGE 27

16 light radiation that illuminates the sample(s) can be altered by using the filters. The following came with the system: 45mm Bl ue, Green interface (546nm) and Ground glass (used as a light diffuser). Figure 4. Koehler Illumination System on Motic AE31 Microscope 2.1.1.2 Ring Light Illumination System Fiber optic ring light provi des 360 of uniform, high inte nsity, on-axis illumination (Figure 5). It is effective in minimizing sha dows because light reflects off the object in a 360 arc. When used with a polarizer set, ring lights are also effective solutions for minimizing specular reflection and glare.

PAGE 28

17 Figure 5. Ring Light Illumination System: a) Illustration of System, and b) System Mounted on the AE-31 Microscope 2.1.1.3 Double-Pipe Light Guide System This system offers a high degree of adjustable, interference free and uniform illumination of focused white light (Figure 6). Standard stainless steel obedient sheathing provides light where it is needed. Figure 6. Double-Pipe Light Guide System

PAGE 29

18 2.1.1.4 Brightfield Incident Illumination System This type of illumination has been adapted to the Motic AE31 microscope due to the need of a homogenous source of illumination from be neath the sample(s). It uses one of the fiber optic pipe light guides de scribed above, which is inserted on a lamp adapter located on the back of the microscope (See figure 7). Light is directed to a chroma brightfield filter, which reflects light to sand particles or any other specimen through the microscope objective lens. Then it is returned by either specular or diffused reflectance. The light diffuser screen, placed on the lamp adapter, is used to alter light distribution. It can be removed from the optical pathway to project a more concentrated light beam. Sometimes, when the diffusion screen is utilized to sp read light from the light source, the overall intensity of light reaching the specimen is often not enough and could lead to a significant amount of image noise. This source of illumination has the advantage of providing a constant, even a nd homogeneous form of luminos ity. If the specimen is opaque and cannot transfer light, this is th e only choice of light that will provide good quality images.

PAGE 30

19 Figure 7. Schematic of the Brightfield Incident Illumination System [Based on Motic AE30/31 Brochure] Ring Light Illumination System and the D ouble-Pipe Light Guide System are easily connected to the TechniQuip FOI-150 Fiber Optic Illuminator It provides up to150 watts of uniform illumination of white light. The front light output also permits adding a holder for Schott glass filters and the on/off switch allows fine adjustment of light intensity when the illuminator is activated. The illumination alternatives suitable for 2D imaging are Ring Light, Koehler and Brightfield Incident Illuminati on. The ways these options illu minate the particle enhance the contrast between background and particle edge. It is recommended to try and compare results before starting a massi ve acquisition of images. Depending on the nature and type of sand being analyzed, one illumina tion may work better than others.

PAGE 31

20 2.2 Software The Operative System installed in th e computer is a Microsoft Windows XP Professional Edition. Image-Pro Plus is a power ful image analysis software package for materials imaging, quality assurance, and vari ous other scientific, medical, and industrial applications. It includes extensive enhancem ent and measurement tools and allows the user to write application-specifi c macros and special add-ins. Three add-in packages from Media Cybernet ics have been used in conjunction with Image-Pro Plus version 5.1: Scope-Pro 5.0 SharpStack 5.0 and 3D Constructor 5.0 Scope-Pro automates the use of a digital camer a and the movement of a microscope and/or stage. It can control complex micr oscopy equipment in a simple, repeatable manner for reproducible results with minimum intervention from the operator. It reduces the need to place ones eye to the ocular dur ing image acquisition and virtually eliminates the need to manually adjust microscope cont rols. The automated repetitive routines result in better quality control and increased efficiency. SharpStack 5.0 helps remove haze and improve resolution in twoand three-dime nsional image stacks using deconvolution and deblurring algorithms. 3D Constructor 5.0 helps the user to perform extensive 3D visualization, measurements and three-di mensional relationships within and among objects. All this software is fully compa tible with the hardware mentioned before.

PAGE 32

21 CHAPTER THREE: GENERAL BASE MODEL FOR TWO-DIMENSIONAL DIGITAL IMAGING OF GRANULAR PA RTICLES USING IMAGE-PRO PLUS VERSION 5.1 3.1 Introduction The material in this section is based upon tools, functions and routines found on Image-Pro Plus (IPP) plus add-ins Scope-P ro5.0, SharpStack 5.0 and 3D Constructor 5.0, from Media Cybernetics, Inc. and various micr oscope hardware devices available for this research. Although IPP does not carry out all the tools needed for image processing and 3D reconstruction, it does offer a comprehensive list of features that were helpful for this work. Convenient characteristics of IPP include the possibility to adapt its interface to specific needs plus the capability for the user to automate routine procedures, add variable definitions as well as flow contro l statements which can interact with the operator. Thanks to the Auto-Pro scripting facilities and some programming code publicly available and borrowed from the Solutions Zone at the Media Cybernetics website, several macros were implemented to facili tate edge recognition and to speed up the process of 2D image characterization of angular particles. They were stored as script files and can be called individually within IPP whenever needed. The script file explained in

PAGE 33

22 this chapter is named GET2DS HAPE.SCR. The source code fo r this file is located on Appendix A. 3.2 Description of the Process for TwoDimensional Characterization of Angular Particles Using Image-Pro Plus Version 5.1 As mentioned before, IPP Auto-Pro scripti ng facility allows the user to automate routine procedures, customize its in terface, and perform other programming manipulation. IPBasic is the language in which IPP macros are written and read. Commands on the IPBasic component of Auto-Pro are a subset of the BASIC language, and conform to Visual BasicTM syntax. When a macro is recorded, Auto-Pro functions transform a sequence of actions and write those instructions to a script file. A script file is a collection of macros. When needed, macros can be called from the selected script file, and at that time, the coded instructions are interpre ted and executed. This is of great help when a series of repetitive steps for image manipulation and analysis ha ve to be performed for each particle. In order to create more robust and powerful rou tines, some commands that add variable definitions, manipulate strings, branch under certain conditions or loop when required, have to be added and edited into the macro. A script file can be loaded on IPP by selecting from the Macro menu, the Macro command. When the Macro dialog box is presented, the button Change is used to select the script file from any folder on the system. The OK button will load the script into

PAGE 34

23 memory and the macro(s) within the script will be available at the end of the Macro menu. The script explained here has three macros denominated as: 1) Ac cquisition 2) EdgeDetec 3) MakeBIN The first macro, Acquisition guides the operator in a successful generation and storage of series of successive digital images of sand particles, acqui red at different focal planes. For each particle, the st ack of images obtained is save d as one sequence file. It is recommended that, immediately af ter the sample is placed on the microscope, this routine is executed for the number of particles that the operator intend s to acquire. Long time exposure of the glass slide holding the samples has the risk of dust particles suspended in the air to get attached to th e surface. These particles may create image noise and that could affect the quality of the images. The EdgeDetec macro is intended to improve e fficiency and minimize errors by automating most of the image processing fo r 2D characterization. The operator has the choice to set several parameters according to the settings and conditions. This macro comprises a chain of functions and algor ithms that can deblur and deconvolve a sequence, process the sequence for edge enhanc ement, and generate several alternatives for evaluation. In that way, the operator can see which optimized image(s) are best suited for the creation of a binary file that re presents that specific particle shape.

PAGE 35

24 MakeBIN is the macro that converts the ar ea defined by the trace of the boundary detected, into a binary image (Black and White). 3.3 Sample Preparation The user has to place few particles of the same type of sand on a very clean microscope glass slide. Ideally, most of the particles should not be in touch with each other. After carefully placi ng the slide on the microscope X-Y mechanical stage, the operator may observe the particles through th e eye pieces of the microscope and use micro tweezers to carefully isolate particles touching each other on the surface of the slide. Note that glass slides, microscope an d camera lenses should be cleaned using compressed gas duster, an optical cleaning sp ray and optical lens wipes formulated for optical instruments. Samples can be observed through the eye pieces of the microscope. But the Video/digital capture command (located on the Acquire menu), has a Preview screen that lets the user monitor the video as the mechan ical stage is manually adjusted to place a sand particle into full view.

PAGE 36

25 3.4 Microscope Settings 3.4.1 Microscope Objectives The objectives used for this research are denominated as Plan Achromats Achromatic Objectives are the least expensive and most commonly used. They are corrected for axial ch romatic aberration in blue (a bout 486nm) and red (about 656nm) wavelengths, which are brought in to a single common focal point At the same time, they are corrected for spherical aberration in th e color green (546 nm). Better images are obtained when the light passes through a green filter (or in terference filter) and using black and white photo microsc opy. In addition, Plan Achromat objective lenses provide corrections for field curvatures and give low distortion. But in general, they sacrifice a considerable amount of free working distan ce. Issues about spherical aberration are discussed on section 3.5.2.2. Figure 8. Characteristics of Motic Ojective Lenses Used for the Motic AE-31 Inverted Microscope [Source: Motic AE30/31 Brochure]

PAGE 37

26 The revolving side facing nosepiece on the Motic AE31 can hold up to five objective lenses. It is ball bearing mounted and provides effortless objective changes. For sand particles tested so far, with mean diameters between 75 m and 2.0 mm, only the 4X, 10X and 20X objectives are commonly used. Microscope magnification object ives should be selected ac cording to particle size. Each time a particle is select ed individually for recognition, it has to be shown entirely on the screen and should fit nicely on the avai lable capture area of the camera. The maximum area possible on the Evolution VF camera is 1392x1040 pixels, which is an adequate resolution for this application. In order to increase the particle size that can be captured by the camera, a C-Mount Adapter 0.65X was placed between the microscope and the digital camera. Sizes of objects seen through this adapter are decreased by 35%. This is greatly useful in case of large sand particles, which normally may not f it in the camera screen area, even with a low power (4X) objective. 3.4.2 Electromagnetic Spectrum, Optica l Filters and Digital Photo Microscopy Sources of natural and artificial light emit wavelengths that cover the visible light spectrum. Sometimes they go beyond and cover the ultraviolet (UV) and infrared (IR) regions as well. Note from figure 9, that visible light ranges from around 400 nanometers (violet) to 700nm (red). Near Infrared (NIR) light consists of light just beyond visible red light (wavelengths 750 to 2500nm).

PAGE 38

27 Some objects reflect infrared radiation (they look bright on IR photography) and some absorb it (they look dark). For example, water absorbs infrared radiation and human flesh and foliage reflect it. Figure 9. The Electromagnetic Spectrum [Source: http://acept.la.asu.edu/ PiN/rdg/color/color.shtml] Filters are constructed in a wide variety of shapes and physical dimensions. They are employed to reduce, limit, reflect, refract, diffract or absorb wavelengths bands of the electromagnetic spectrum at which they are exposed. In Black and White (B&W) photomicrography, f ilters are used to control contrast in the final image captured on a Charge Coupl ed Device (CCD) digital camera system. Filtration techniques for B&W are significantly different from those employed in color. CCDs are light-sensitive devices used on digital photographic and video cameras, scanners and other optical de vices. A CCD chip is a soli d-state electronic component made from a silicon wafer which has been micro-manufactured and segmented into an array of individual light-sensitive cells calle d "photosites". The num ber of photosites in the horizontal and vertical direction gives the resolution of the camera.

PAGE 39

28 Photosite cells sense inco ming light and are capable of producing various amounts of electronic charge in response to the amount of light they receive. The CCD photosites accomplish their task of sensing incoming light through the photoelectric effect, which is a characterization of the action of certain materials to releas e an electron when hit with a photon of light. In a B&W digital camera, the hardware converts the information from analog to digital, and records the image electronical ly by producing a file of encoded digital information in which bits represen t tonal values on the gray scale. The Evolution VF camera has a Sony CCD sensor chip model ICX205AL, which can see from about 280nm (estimated) to 1000nm according to the Relative Response versus Wave Length (nm) graph shown in figure 10. Figure 10. Spectral Sensitivity Charact eristics for the Sony ICX205AL Chip [Source: Sony Technical Paper Diagonal 8mm (type ) Progressive Scan CCD Image Sensor with Square Pixel for B/W Cameras]

PAGE 40

29 There are a series of filters called opaque filters that allow only infrared light to pass through them. The 87 series Wratten filters from Kodak are one of the most popular on the market. These filters are excellent for sc ientific work and in pictorial photography. They give the most infrared look and stop all other light from reaching the CCD on the camera. The term Wratten is derived from and English inventor and manufacturer of filters in the 1870s, Frederick C. Luther Wratte n. Kodak bought the Wratten Company in the 1920s. Photographers and filter manufacturers now use the Wratten ratings as a very accurate way of specifying the spectral char acteristics of filters, regardless of the manufacturer. Filters obtained and tested in this resear ch were the Kodak #87 Wratten IR Pass Gel filter and the Schott BG40 1mm Glass IR/UV cut filter. The BG40 glass filter allows only visible light to reach the CCD Additionally, a gelatin polarized filter can be used in combination of the BG40. When a polarized fi lter is used in front of the camera, it reduces reflected glare off of the surface of the particles. In color cameras, Wratten 87 filters deliver a grayscale because the 87's 50% cutoff at around 800nm blocks both visible light and most of the color-g enerating shortwave NIR below 770 nm.

PAGE 41

30 Figure 11. IR Transmission Spectra for Kodak Wratten 87 IR Pass Filter [Sources: http://www.cocam.co.uk/CoCamWS/Infrared/INFRARED.HTM and Schott BG40 IR/UV Cut Filter Data Sheet] SharpStack 5.0, an image-stack deblurring and deconvolution software add-in for IPP is used for image improvement. It requir es the user to input a value for the peak wavelength emission illuminating the sample The peak wavelengths that reach the Evolution VF CCD chip using the Kodak Wratten 87 filter and the Schott BG40 were estimated by super imposing the spectral sensitivity graph for the Sony ICX205AL chipset (figure 10) and the transmission spect ra for both filters (figure 11). The peak wavelength that reaches the CCD chip using th e Kodak Wratten 87 filter is estimated at 775 nm (figure 12). The peak wavelength that reaches the CCD chip using the Schott BG40 filter is estimated at 510 nm (figure 13).

PAGE 42

31 Figure 12. Estimation of the Peak Wavelength Capt ured by the Evolution VF Camera Using the Kodak #87 Wratten IR Pass Gel Filter Figure 13. Estimation of the Peak Wavelength Capt ured by the Evolution VF Camera Using the Schott BG40 IR/UV Cut Filter

PAGE 43

32 3.5 Exploratory Routine Implemented for 2D Characterization of Angular Particles Using Image-Pro Plus 5.1 The script created is named GET2DSHAPE. SCR. The source code is available on Appendix A. Information on how to load a script file is mentioned in section 3.2 This script has three macros: Acquisition EdgeDetec and MakeBIN In this section, a brief description of the chain of steps c ontained in each macro is explained. Step by step, basic theoretical background for functions and commands from IPP is also included. The intention is to illustra te to the reader the method proposed for two-dimensional imaging of granular particles. 3.5.1 Acquisition of Image Stacks The Acquisition macro is a simple routine which opens and sets the Digital Capture Dialog and the Scope Pro add-in. The operator is aske d to locate sand particles by repositioning the mechanical X-Y stage so they appear on the Live Preview screen (Figure 14). Also, the operator must make proper adjustments such as focusing and setting the proper illumination. By clicking on the Auto-Set button, the software will reset the driver to the factory results and then an auto exposure time will be calculated considering actual illumination c onditions. By default, the live preview and capture areas are set to full frame, which are 1392x1040 pi xels. The auto-exposure time is set to be calculated on every frame. These settings have been stored as a text file named Camsettings.vpf in the default folder C:\IpWin5\Documents and Settings Then, Scope-

PAGE 44

33 Pro is called and the user is prompted to choose a setting from recorded calibrations. Calibrations are available for 4x, 10x and 20x magnifications under the names 4x_0.65.scp, 10x_0.65.scp and 20x_0.65.scp respectively. The *.SCP files contain Scope-Pro settings in text format a nd are saved by default in the folder C:\IpWin5\CamCalibration The operator must load the settings according to the objective lens used. Figure 14. Illustration of the Acquisition Process of Image Stacks on Image-Pro Plus The operator has to adjust the Top and Bottom limits using the Prior ProScan II controller before acquiring a set of images at different focal planes The top limit is the upper plane of the particle whic h can be seen from the bottom. The lower limit is the very

PAGE 45

34 bottom plane of the particle in contact with th e glass slide. The default number of frames for each sequence was set to be 25. This means that Scope-Pro will divide that distance (on the Z axis) between the limits in 25 cons tant intervals. Human error and operator dependency is inherent when th e user is trying to determine which plane is exactly top or bottom. That is why it is recommended to go a little bit beyond focus for both top and bottom limits of the particle(s). Although this does not save time, it is more accurate since the Extended Depth of Field (EDF) process applies algorithms to obtain a composite image showing all parts in focus (refer to section 3.5.2.3 for more information about the EDF process). Figure 15. Tile Images for a Rhode Island Sand Par ticle Obtained at Different Focal Planes Using Scope Pro 5.0. Scale Not Shown

PAGE 46

35 The *.TIF and *.SEQ are the two formats in which an image set can be saved after a series of images have been obtained. The .TIF file extension, Tag Image File format is a flexible and very popular format for arch iving high quality images. The standard TIFF is the most universal and most widely s upported format across all platforms including Windows, Mac and UNIX. TIFF supports most color spaces (RGB, CMYK, YCbCr, etc), multiple images, thumbnails, and image direct ories or tags with information about the image. TIFF can support data up to 48 bits. Image-Pro supports single-frame or multi-frame TIFF image documents (or workspaces) with the .SEQ or .TIF file extension. Image-Pro supports all known varieties of the TIFF file fo rmat, including most multiple-image varieties. Products from Media Cybernetics may write one or more proprietary TIFF tags along with the images(s). However, some other software p ackages may not recognize TIFF files or may not read all the information within images. Files with the extension *.SEQ are handled by Image Pro and some functions require image sequences to use this exclusiv e format. It is recommended to use this format during the image processing and to save the final binary images with the TIFF or BMP extension. 3.5.2 Imaging Processing for Edge Enhancement The EdgeDetec macro prompts the user to open a sequence file. The file extension used on a sequence of images could be *. TIF or *. SEQ format. This macro will be divided and explained accord ing to the following steps:

PAGE 47

36 1) Selection of an area of interest from an image sequences 2) Process of deconvolution using SharpStack 5.0 3) Obtaining an extended depth of fiel d test strip for a sand particle 4) Application of contrast improvement te chniques for better particle edge detection 3.5.2.1 Selection of an Area of Interest from an Image Sequence IPP includes an Area-Of-Interest (AOI) tool which is used to isolate designated areas from the rest the picture or to define a portion of an image. An AOI can be defined in any shape (available tool buttons can be used to define a rectangular, elliptical or freeform shape). When and AOI is active in an image, many commands on IPP will affect only the pixels constrained by the AOI. Some other commands, for example Save and Color Segmentation will always operate upon the entire image. It is recommended to reduce the entire ar ea of the sequence to a smaller region of interest where the particle can be isolate d. The macro will activa te a rectangular AOI where the user can adjust its size to confine the particle. It is necessary that the user leaves enough space in the top left corner of the rectangular AOI. That space is reserved for a text box that will be displayed after the Extended Depth of Field (EDF) function is applied to the sequence. After defining the re ctangle, that area will be extracted and will be the default workspace for future processing.

PAGE 48

37 3.5.2.2 Process of Deconvolution Using SharpStack 5.0 Media Cybernetics SharpSt ack version 5.0 is the first image processing package applied to the image-stack. SharpStack empl oys routines involving haze removal and restoration techniques used to sharpen and clear image sets by applying deblurring and deconvolution algorithms. Deconvolution algorithms are mathematical procedures, specifically high pass filtering, used for a systematically removal of noise and out-of-focus haze and blur for three dimensional data obtained from a set of image planes. It is very important to have consistent illumination and low noise conditi ons. External variations can dominate the results and hide or distort the recons truction and errors may get amplified. Given a specific application and depending on the image set selected for improvement, SharpStack offers one d econvolution technique based upon blind deconvolution concept ( Inverse Filter ), and two deblurring techniques( No Neighbor Nearest Neighbor ). SharpStack must be applied to monochrome images and image sets. Table 2 guides the user to determine which alternative is most appropriate and shows some characteristics for each method:

PAGE 49

38 Table 2. Characteristics of Methods Available In Media Cybernetics Sharpstack 5.0 for Image Deconvolution [Source: SharpStack Version 5.0 User Guide] The easiest type of algorithm to use would be the Nearest Neighbor algorithm, which can handle a minimum of three slices. This algorithm uses images above and below the image plane of interest to estimate the amount of blurring in the central frame. It has the advantage of being very fast a nd yielding good results but it is sensitive to illumination variations. It can be used with all magnifications. The Inverse Filter will yield more accurate results, but requires many more slices and more computational time (Aga rd, 1989). This algorithm uses a Point Spread Function (PSF) to determine the amount of bl ur in the image volume. Then it deconvolves the entire PSF to deblur the cente r object. Several trial images enhanced with this technique presented edges that we re easier and faster to trace. Although the Inverse Filter method requires more computational time and memory as it performs Fourier Transforms in all three dimensions, it is the default option for this macro. On the

PAGE 50

39 other hand, there is always the flexibility to change the options according the type of application and judgment of the operator. Th is algorithm works with 10x magnifications and beyond. Figure 16 shows an example of the differe nt options and settings available for SharpStack v 5.0 Each option is described below. Figure 16. SharpStack 5.0 Window Type : Drop-down with three options availabl e: No Neighbor, Nearest Neighbor and Inverse Filter (default option). NA : Type the Numerical Aperture for the objective lens used to acquire the image. This number indicates the numerical aperture of the lens used in capturing the images.

PAGE 51

40 Numerical Aperture is an index of the abil ity of an objective le ns to resolve fine detail at a fixed object distance. It is defined as a measure of the light gathering capacity of the lens system and determines its reso lving power and depth of field. It can be mathematically expressed as the sine of the refractive index of the medium between objective and specimen (value that ranges from 1.00 for air to 1.51 for specialized immersion oils) times one-half the angular aperture (Equation 1). As the numerical aperture is varied, the size and shape of the illumination cone entering the objective front lens is altered, as shown in figure 17. =30 10x ion Magnificat 0.25 (15) sin 1.0 NA 30 Air) (for 1 RI ) 2 1 sin( RI = NA Objective Frontlens a) Frontlens =47.40 20x ion Magnificat 0.40 23.6 sin 1.0 NA 40 47 Air) (for 1 RI ) 2 1 sin( RI = NA Objective b) =30 10x ion Magnificat 0.25 (15) sin 1.0 NA 30 Air) (for 1 RI ) 2 1 sin( RI = NA Objective Frontlens a) Frontlens =47.40 20x ion Magnificat 0.40 23.6 sin 1.0 NA 40 47 Air) (for 1 RI ) 2 1 sin( RI = NA Objective b) Figure 17. Demonstration of Change in Numeri cal Aperture for Two Objective Lenses in an Inverted Microscope with Magnifications: a) 10x and, b) 20x (Equation 1)

PAGE 52

41 Refractive Index : Indicates the refractive index of the immersion media used to couple the objective lens to the specimen. Five choices are available: Air (1.0), Water (1.33), Glycerin (1.47), Oil ( 1.515) and Custom. When any of these options is selected, the adjacent refractive index value will be au tomatically updated. Air is the default option since dry microscope objectives were used. X Spacing (horizontal) and Y Spacing (vertical): These values are automatically displayed and represent dist ances in pixels per microns They were obtained from information stored in the image sequence. It is noted that the image has been previously calibrated according to the obj ective lens used, and all spat ial calibrations were done in micrometers. Z spacing : This value is automatically displa yed and obtained from the directory information of the image sequence. When ac quiring different Z planes of a particle, Scope-Pro calculates this Z distance measured in microns between images. Process in Montage : The check in this box allows SharpStack to break the image volume into smaller sub regions to be d econvolved. Then it is reassembled into the complete volume. This option may speed up the algorithm and processing time. Inverse Filter requires up to five times the amount of memory used for the image set because virtual volumes are created during the processi ng. This is helpful to overcome limitations in Microsoft Windows which does not allow the use of large contiguous blocks of RAM memory. But some images may produce discernible discrepancies between those

PAGE 53

42 smaller sub regions. The user must pay atte ntion and inspect deconvolved image sets for any defects that may distort the repr esentation of any particle shape. Overlap : If Process in Montage is applied, the resulting bl ocks must be reassembled into the original image volume. The potential of appearance of image artifacts is reduced when the blocks are allowed to be positioned by assigning an overlap value, from 1 to 100 pixels. This option may be ignore d if the image is small enough and Process in Montage is not necessary. Bright field and Phase Objects : None of these options are selected. The user may try and compare these options and see if ther e is any improvement on image quality for certain types of sand particles. Convert results to floating point : Converts the resulting image into the floating point format. This option creates a better quality image. Spherical Aberration : Spherical aberration causes the specimen image to appear hazy or blurred and slightly out of focus. Its effects are evident when the center of the image is more in focus than the edges, and the intensity of the edges falls relative to that of the center. The button Calculate SA calculates and displays results for the Spherical Aberration constant. When the checkbox Use accelerated spherical aberration calculation is activated, the calculation speed increases but some accuracy is sacrificed. For several images of particles tested, th is option does not show discernible effects. Spherical aberration occurs in a lens with hyperbolic curvature on its face(s), because light rays passing on the periphery are greater refracted. The lens focuses to different points, depending on th e angle with the central axis, instead of focusing all rays

PAGE 54

43 to a specific point. Therefore, peripheral rays are brought to a fo cus closer to the lens than those passing closer to the ax is. Illustrations a, b and c on figure 18 are an exaggerated view of hypothetical light rays passing through a biconvex lens. Refraction of the peripheral rays is greatest followed by those in the middle, and then shows little effect on the rays in the center. Note how spheri cal aberration varies with lens shape. Table 3 shows the corrections for optical ab errations for different type of objectives. Table 3. Corrections for Optical Aberration of Different Types of Microscope Objectives [Source: http://www.microscopyu.com/articles/optics/objectiveintro.html] Deconvolve : This button applies the Inverse Filter algorithm to the whole image stack. Save Settings : Saves the current settings for use w ith similar images in the future. These settings are saved with as a file with extension *.DCS. Open Settings : Click this button to open deconvolution parameter settings.

PAGE 55

44 Transverse Spherical Aberration Transverse Spherical Aberration Longitudinal Spherical Aberration Longitudinal Spherical Aberration a) b) c) Transverse Spherical Aberration Transverse Spherical Aberration Longitudinal Spherical Aberration Longitudinal Spherical Aberration Transverse Spherical Aberration Transverse Spherical Aberration Longitudinal Spherical Aberration Longitudinal Spherical Aberration a) b) c) Figure 18. Effect of Spherical Aberration on a Di atome Frustule According to Lens Shape: a) Minor Effect, b) Medium Effect and c) Mayor Effect [Source: http://micro.magnet.fsu.edu/primer/java/aberrations/spherical/]

PAGE 56

45 3.5.2.3 Obtaining an Extended Depth of Field Test Strip for a Sand Particle One limitation of the microscope hardware available is that the viewer can not observe an actual shape of the particle at high resolutions. Parts above and below the focus plane fall outside the depth of field of the objective lens and do not look sharp. To overcome this limitation, the use of an extende d depth of field or projection must be employed to show the overall shape of particles. In this particular case of shape characteri zation of angular partic les, the actual twodimensional shape obtained is really a projec tion of three-dimensional particles displayed in a two-dimensional format. The Extended Depth of Field (EDF) method re quires several images of an object at different focal planes. This is done by adjusti ng the height on the focal axis at which each image is captured. Later on, those images are combined and merged into a single, infocus, composite image that shows in a well de fined manner, all zones of the particle that would normally lie outside a single plane of focus. The EDF tool on IPP provides speed and a high level of accuracy that facilitates the entire process of image characterization. Immediately after the imag e sequence has been deconvoluted, the EdgeDetec macro calls the EDF feature and generates a Test St rip. Due to the nature of shapes, mineralogy and topography of sands, it is necessary to test various combinations of the parameters on the EDF algorithms to see which results ar e best suited for edge recognition on specific particles.

PAGE 57

46 Brief descriptions, borrowed from the I PP 5.0 Reference Manual, for different EDF settings which were tested and implemente d in this chapter are presented next. 1) Order Options: Stack Order, Top Down : The first image at the to p of the list will be the first image in the attack and the bottom image the last. Stack Order, Bottom Up : The image at the top of the list will be the last in the stack, and the image at the bottom for the list will be the first image in the stack. The order of the images may affect which pixel is selected for some of the focus analysis operations. 2) Output Options: Composite Best-Focus Image : This output option ge nerates a composite image using the best pixels analyzed fr om a series of images. This is the default option. Return Best-Focus Frame : this option creates a new work space containing a copy of the selected fram e with the most in focus material. This option is not suitable for objects such as sand particles. 3) Focus Analysis Options: Normalize Illumination : This option corrects uneven illumination or light intensity emitted by the source as the Z planes changes. Maximum Local Contrast : Areas with high/maximum contrast are placed in focus. Through out the se ries of images, pixels around a

PAGE 58

47 current location are analyzed and the one with largest variance or local contrast is selected. Maximum Through-Depth Contrast : The mean values of the pixels are calculated. Pixels from planes with the largest variance are selected. This option is intended for transparent objects. Maximum Intensity : It is applicable for objects that are more intense than the background. Pixels from different planes with highest intensities are selected. Minimum Intensity : It is used for regions that are darker than the surroundings are placed in focus. Pixels from planes with lowest intensities are selected. A Test Strip automatically generates a se ries of images representing different settings, output options and various focus analysis for the (EDF) function. The total number of combinations shown in a Test St rip sequence is of 16 images. Table 4 shows the categories combined on a Test Strip. Figur e 19 shows individual frames of a Test Strip for a Rhode Island sand particle. As me ntioned before, the EDF function generates a label on the upper left corner fo r each frame of the sequence. Note that not all images on the EDF test strip result in a nice composite image.

PAGE 59

48 Table 4. Settings and Combinations Generated in an EDF Test Strip Sequence. In Total, 16 Frames Represent all Possible Combinations of Settings for Each of the Output Options (BestFocus Image or Best-Focus Frame) Figure 19. Tile Images of an Extended Depth of Field Test Strip Sequence for a Rhode Island Sand Particle. Scale Not Shown

PAGE 60

49 3.5.2.4 Application of Contrast Improveme nt Techniques for Better Particle Edge Detection It was intended at the beginning of this re search to implement the best illumination possible for sand particles to differentiate the grains from the background. By doing this, edge detection would have been achieved w ith a minimum amount of digital processing. Standard contrast techniques are good for ove rall contrast enhancement, but showed no great effect for revealing a deta iled contour of sand particles. After several trials, the need for a more complex processing and enhanci ng technique became evident. Immediately after the EDF function is app lied, a copy of the sequence is created. This duplicate will be subjected to further processing and enhancement. The macro Local Best Fit Contrast Enhancement is publicly available from the Solutions Zone website of Media Cybernetics, Inc. It has been successfully implemented in the script after being adapted to the structure of the routine. This macro applies a combination of morphological (Erosion and Dilation) and enhancement (Gauss) filters to various intensity ranges within the image. According to the description provided by Media Cybernetics: Local Best Fit Contrast Enhancement uses a combination of the Erosion, Dilation, and Gaussian filters found in Image-Pro, and applies them to the various intensity ranges found within the image to find local contrast. The macro also provides a means of controlling the degree of local contrast that the filter will apply to the image. The macro operates in the following fashion: In the first step an iteration value is selected. This value dete rmines the size of the local area to which the

PAGE 61

50 filter will be applied. Based on this informa tion, the second step is performed. Within each local area, the minimum and maximum intensity values are determined using Erosion, Dilation and Gaussian fi lters. A Best Fit contrast st retch is performed relative to the local maxima and minima subtracti ng the minima and scaling by the difference between the minima and maxima. A new imag e is generated, showing local contrast effects. The resulting image is optionally aver aged with the original to provide partial enhancement. The Erode filter dilates bright objects, and enlarges dark ones. The Dilation filter dilates bright objects and erodes dark ones. The Gauss filter is used to soften the image by eliminating high-frequency information. It ha s an effect of blurring sharp edges. To Average an image with its original is the arithmetic operation of replacing each pixel with the mean value obtained from the two images. In order to accentuate the contour of the particle, a Variance Edge Filter is then applied. This filter helps emphasize edges and textures by substituting the pixels with the calculation of the statistical variance of their neighbor hood about the mean intensity within a local region. Then it is av eraged again with the sequence. Once image improvement has finished, the operator can evaluate on which image the tracing of particle edge is satisfactor y. A simple EDF Test Strip and an improved EDF Test Strip, each hold 16 frames where to choose from. When a frame is tested and elected, the macro MakeBIN is used to convert the image from grayscal e to binary (black and white).

PAGE 62

51 Figure 20 shows the frame 1/16 on both simp le and improved EDF Test Strip. In this case, the improved frame shows a better trace of particle edge. Figure 20. Example of Boundary Trace on a Simple EDF Test Strip (a) and an Improved EDF Test Strip (b). The Boundary Traced On the Improved Image Is More Accurate 3.5.3 Creation of Binary Images of Particle Shapes The macro MakeBIN is the next step for converting a gray scale image of a sand particle into a binary image that defi nes a sharp contour of its 2D projection. Once the user identifies on what frame a nice contour can be traced, the macro converts the active EDF Test Stri p from a floating point format to an 8 bit gray scale. The 8 bits gray scale, which can show 256 shades of gray, is a fully compatible format and requires less memory per image. Besides, not all software packages support images on a floating point format. Then, the macro prompt s the user to input a frame number to extract from the sequence. After that, the Magic Wand option on the irregular AOI tool

PAGE 63

52 appears, and the operator traces again an outline on the boundary. Now, the macro announces the creation of a binary imag e. When the operator clicks on the Continue button, the macro uses the Fill command to fill the active AOI with a solid white color. Then, the Threshold/Segmentation tool is automatically called and all the areas of the image with a different shade other than white (0) will be converted to black (255). See figure 21 for illustration. This process is used for separating the particle shape from the background. Now, the operator must save the binary image on a specified folder. Any of the following formats is recommended for a binary image: TIFF (TIF, TIFF) and Windows Bitmap (BMP). Figure 21. Binary Image of a Rhode Island Sa nd Particle Created Using the Macro MakeBIN Figure 22 summarizes the whole operation of the macrons contained on the script GET2DSHAPE.SCR

PAGE 64

53 Figure 22. Diagram of Operation of the Macros Contained on the Script GET2DSHAPE.SCR

PAGE 65

54 CHAPTER FOUR: QUANTITATIVE IM AGE DIGITIZATION OF GRANULAR PARTICLES One of the goals of the entire project is th e creation of a database of image shapes for different types of sands. And for that, it is necessary to process large number of particles. Now that the procedure presented on chapter 3 has shown effective results for edge detection and shape digitization, it is n ecessary to adjust those techniques to a new level of automation for a faster image processing. This chapter explains new scripts im plemented for 4x, 10x and 20 magnifications. Their source codes are on appendices B, C and D under the names Mult2DShape4x, Mult2DShape10x and Mult2DShape20x respectively. The level of automation in these scripts is planned to dramatically increase th e number of particles processed in less time, without sacrificing quality. The macros contai ned on the scripts require less intervention from the operator because they prompt the user to input certain parameters and apply the same parameters to all the images within a fo lder. At every stage of the script, the macros ask the user to select folders where to stor e and open images, specify parameters such as the number of frame to extract from an EDF test strip and the intensity range from an image prior converting to binary. The key to obtain good quality images and reproducible results is to take all the images under the sa me conditions (type, intensity and position of the illumination system). One of the macros a llows the editing of shapes on each image. Here, the user fills with b ackground color all those defectiv e particle shapes before

PAGE 66

55 converting to binary. Once the procedures creat e binary images, importa nt statistical data can also be obtained from those shapes. The main differences between the scripts ar e some of the parameters used according to each magnification but the structure remain s the same. All the scripts use the Nearest Neighbor algorithm for the deconvolution process. Logically, with a higher magnification, more resolution can be obtaine d, but the number of pa rticles captured per image is reduced. The magnification settings are set to be used with the 0.65x C-mount adapter attached to the camera. A comparis on of measurements for a sand particle was made using the three magnifications. Results are presented on section 4.1 and they show that the difference in measurements is not significant. This means that the 4x magnification offers satisfying images plus the advantage of acquiring more particle shapes per image. A brief explanation of the macros contained in the scripts, as well as some sample images are presented next: Acquisition This macro opens the Digital Capture Dialog and the Scope Pro window. The settings for 4x, 10x and 20x magnifi cations are set to acquire 15 frames per sequence. The operator spreads se veral particles on a clean glass slide and then places the sample on the microscope X-Y mechanical st age. The process of acquisition of image sequences should be done in a zigzag manne r until the desired area on the glass slide is explored. Figure 23 shows examples of images acquired using this macro.

PAGE 67

56 Figure 23. Pictures Extracted from Unprocessed Se quences of Boca Grande Beach Sand Particles (Cartagena, Colombia) Obtained Using the Macro Acquisition Only NIR Radiation Was Captured Under a 4x Magnification and the 0.65x C-Mount Adapter Attached to the Camera. EnhanceEdges This macro opens all the raw sequ ences from a specified folder and enhances the images for better edge detec tion. The deconvolution process applied to the images varies according to the objective lens used. The 4x magnification has to use the Nearest Neighbor algorithm wh ereas the 10x and 20x magnifications are set to use the Inverse Filter Algorithm. The enhancement pro cess is based on the routines explained in chapter 3, but the process is simplified by applying the same settings to all the image sequences within a folder. This macro: 1) Deconvolves the image sequences 2) Creates Extended Depth of Field test strips, 3) Then applies the Local Best Fit Contrast Enhancement routine (it has been set for 3 iterations) followed by the variance filter plus the respective averaging (refer to th e scheme for macro EdgeDetec on

PAGE 68

57 figure 21). The final outputs are Im proved EDF test strips. Figure 24 shows examples of images enhanced using this macro. Figure 24. Pictures of Improved Frames from Exte nded Depth of Field Test Strips (Edfts) for Boca Grande Beach Sand Particles (Cartagena, Colombia) Using the Macro EnhancEdges Frame Information: Maximum Local Contrast, Normaliz ed Illumination, Sequence Arranged From Top to Bottom Sort_GSIs This macro is designed to detect shapes and sort the particles found on an image. The macro requests the user to ope n a random EDFts and select which frame to extract (it will extract the same frame number on all EDFts within the folder), then opens the threshold window and the user sets the inte nsity range that define the shape of Gray Scale Images (GSIs) of the particles. The histogram values range from 0 to 255 on the 8 bit grayscale. Once the user selects an appropriate value, it will be applied to all the extracted frames. The macro will detect several shapes and including background noise, but it will filter those shapes that do not match certain area and/or minimum caliper specified on the macro (refer to figure 29 for more information on measurements that can be obtained with IPP). The best way to mini mize defective shapes is to set properly a

PAGE 69

58 suitable type of illumination and keep dust out of the lenses, camera and glass slides used. Figure 25 shows examples of pa rticles sorted using this macro. Figure 25. Pictures of Sorted Sand Particles from Boca Grande Beach (Cartagena, Colombia) Obtained Using the Macro Sort_GSIs Even Though Shapes Were Filtered by Area and Minimum Caliper, Some Background Noise Was Recognized as Shapes. Edit_GSIs. This macro allows the user to edit sorted GSIs of particles on each image. The operator evaluates each image in a folder. Undesired shapes can be removed by via detecting those forms as AOIs and filling them with white color. Before converting to binary, even if the editing proces s is not perfect, the filtering process will get rid of those shapes. Figure 26 shows exam ples of edited images prior binarization using this macro.

PAGE 70

59 Figure 26. Edited Pictures of Sand Particles from Boca Grande Beach (Cartagena, Colombia) Using Macro Edit_GSIs Undesired Shapes Are Marked as Aois and Filled White by the Operator. Although Some Defective Shapes Are Still Present, They Will Not Pass the Filter Settings for Area and Minimum Caliper Prior Becoming Binary Images MakeBINI_C_M This name stands for Make Binary Images plus Count and Measure. This macro converts to binary all those shapes recognized and edited on previous macros, and then it saves the bina ry images in a specified folder. Figure 27 shows that only useful shapes are shown on the final images. After converting to binary, several measurements can be obtained from those shapes. IPP has an interesting Count and Measure tool that can give useful measuremen ts for all those shapes recognized in a text format, which can later be opened in a spreadsheet. This macro will also include a file called SORTED_BINDATA.txt in the fold er containing the following measurements: perimeter, area, roundness, radius (max imum, minimum and average), diameter (maximum, minimum and average), axis (m ajor and minor), aspect ratio, caliper (maximum, minimum and mean), fractal dimens ion, perimeter of the equivalent ellipse and perimeter of the convex outline of th e object. Figure 28 shows diagrams and a brief

PAGE 71

60 explanation of the measurements that are in cluded in this text file. Appendix F shows a comparison of measurements for a Rhode Isla nd particle shape obt ained under different magnifications. Figure 27. Binary Images of Shapes of Sand Pa rticles from Boca Grande Beach (Cartagena, Colombia) Using Macro M akeBINI_C_M Figure 28. Description of the Measurements Obtained from Binary Shapes Using Media Cybernetics Image-Pro Plus

PAGE 72

61 CHAPTER FIVE: THREE-DIMENSIONAL SHAPE RECONSTRUCTION OF GRANULAR PARTICLES: REVIEW OF SOME ALTERNATIVES Shape reconstruction in three dimensions for sm all particles is not an easy task. It is a tedious and very time consuming process. Extensive research has been done in the fields of biology, medicine, pa leontology and material sciences. This work has gathered information about three methods availa ble: X-Ray NanoTomography Systems, 3D reconstruction from images acquired at increm ental focal planes and Serial Sectioning. 5.1 X-Ray Nano Tomography This exciting technology provides fast and ea sy collection of tomographic data sets for 3D reconstructions. Now days, with the use of nano technology, machines have the possibility of obtaining higher resolutions th an on previous models. It has become a powerful tool for examining par ticles in three-dimensions. Thanks to Micro Photonics, Inc., we were able to obtain several images of a Rhode Island sand sample. Unfortunately, at th e time the sample was sent, only X-Ray microtomographs were available on the market. Figures 29 and 30 show images taken with the Skyscan 1072 micro-CT. The resoluti on is poor (+/-5 m at low contrast) and the fact that particles are in touch with each other makes it difficult to obtain an accurate 3D reconstruction. The latest model is the Skyscan Nano2011 High-Resolution Nano-CT.

PAGE 73

62 The smallest detail availabl e on this model has a resolution of 400nm at low contrast. Both equipments do not require any special specimen preparation. Figure 29. Sample Images of R hode Island Sand Particles Obtain ed with a Skyscan 1072 MicroCT

PAGE 74

63 Figure 30. Tile Images of Rhode Island Sand Par ticles Obtained with a Skyscan 1072 Micro-CT. Space Interval between These Sample Images Is 35um

PAGE 75

64 5.2 3-D Reconstruction from Images Acquired at Incremental Focal Planes This is another nondestructive method in wh ich an image of an object is acquired and stored every time the distance between the object and the objective is constantly changed (at known intervals). Then a s hape from focus (Nayard, 1989) can be obtained. There are other progr ams for different operative system platforms and with different reconstruction schemes, algorithms a nd levels of performance that are used for both the calculation of a sharp composite in focus image of the particle and its three dimensional shape from image sets at different planes of focus. These methods are widely used in with satisfactory levels of success in fluorescent microscopy and objects acquired in bright field environments. For our study, we had no success in obtain ing satisfactory 3D reconstructions by using 3D Constructor on Image-Pro Plus. The excess of glare, hazi ness and blur from sand particles such as quartz, makes it impossi ble for the algorithms to detect depth for some regions on the surface of the particle. Als o, it is necessary to acquire images from at least three views to get a deta iled 3D composition of the part icle. 3D Constructor, can not handle a volume reconstructions from thr ee views (top, bottom and one side) but only from two (top and bottom). This can be done by acquiring a set of images from one side, then flipping the particle 180 and then taki ng another set of images After the process of acquisition is finished, a macro can arrange bo th sets of images and use 3D Constructor for visualizing the volume. It is unpractical to reconstruct particles one by one using this method. It not only would require a high level of precision to flip and locate the particle in the right position, but also the process would be extremely slow.

PAGE 76

65 5.3 Serial Sectioning This is a destructive process, which means that particles will be disintegrated for the purpose of their 3D characterization. In this method, a series of thin slices of known thickness are removed successively from the particles, which are inlaid in a hard medium. The removal process of thin slices is done w ith a very fine and precise polishing machine. At each interval of the removal process, a 2D image of the cross-se ction is acquired and stored (See figure 31). Figure 31. Representation of Cross Sections duri ng Serial Sectioning. Images Are Acquired After Each Pass on the Polishing Machine

PAGE 77

66 By using those 2D images to obtain X a nd Y coordinates, and by knowing the depth at which each image was obtained, 3D recons truction can be perfor med via software (See figure 32). Figure 32. Representation of A 3-D Reconstruction of a Glass Micro Sphere and a Sand Particle by Means of Serial Sectioning 3D Constructor can handle this volume rec onstruction only if the sectioning interval is kept constant. Figure 33 shows a 3D reconstr uction of a low resoluti on artificial sphere created for illustration purposes. Several othe r software packages compatible with MS Windows XP have been evaluated. 3D-DOCTOR from Able Software Corp., is an advanced 3D modeling, image processing and measurement software for Magnetic Resonance Imaging (MRI), Computed Tomography (CT), Positron Emission Tomography (PET), microscopy, scientific, and industrial imaging appl ications. It uses vector-based technologies to cr eate 3D models from volumetric images. It is capable of

PAGE 78

67 handling uneven slice thicknesse s and variable spaci ng between slices. Then it can create new images with even slice thickness and spacing between slices using an optimal interpolation algorithm. This is of great advantage for accurate 3D rendering and quantitative analysis. It can export the polygonal mesh models to STereoLithographies (STL), AutoCAD (DXF), Initial 2D/3D Graphics Exchange Specification (IGES), 3D Studio (3DS), Wavefront (OBJ), raw triangles, Virtual Reality Modeling Language (VRML), Graph Coordinates (XYZ) and other formats fo r simulation and 3D measurements for quantitative analysis. Figure 33. 3D Visualization of an Artif icial Sphere Using 3D Constructor 5.0 5.3.1 Selection of a Medium for Serial Sectioning: Epoxy Systems A serial sectioning proce dure is an alternative ut ilized to achieve a threedimensional digital reconstruction of sand partic les. One of the objectives of this research

PAGE 79

68 is to find a material where sand particles can be completely inlaid for future serial sectioning. The success of 3D reconstruction in this method relies in the quality of specimen preparation. A strategy for the procedur e is presented to be used as a baseline. Undoubtedly, new tools, equipment, materials and ideas that could improve, benefit or even substitute the method may come al ong the way and they undoubtedly should be implemented. The procedure and material used to cr eate the specimens should not disturb the particles. In a series of re petitive procedures, this materi al must be capable of holding firmly the particles as an abrasive surface removes extremely thin layers successively, until the particles are completely sectioned. The wearing surface of the specimen must be kept homogenous and remain flat and even fo r every step of the sectioning. This means that gaps, voids and uneven surfaces should be avoided. Also, high contrast between the surrounding material and sand particles is required for accurate and precise edge detection. Epoxy resins are indeed a versatile and tenaci ous material that could be used for this application. In recent years, innovation and advances in its formulation and the multiple array of chemical and physical properties, o ffer a wide variety of applications. Diverse formulations of epoxy resins are customized to meet unique requirements according to the purpose of its specific application. Jang, Frost a nd Park (1999) developed a comprehensive procedure for preserving sand specimens with epoxy resin. Specimen coupons were latterly prepared for surface analysis using a variety of grinding and polishing procedures.

PAGE 80

69 In this case, some of the general characteristics found in epoxy systems are suitable for this application: 1) They come as an individual component or in a two-component presentation: Part AResi n and Part BHardener 2) They are homogenous materials, n on toxic and non-reactive with sands 3) Most systems present good handling characteristics and some can be cured at room temperature and have minimal shrinkage 4) They can be easily poured into a mold and will adopt and sustain a molded shape when cured 5) Some systems have low viscosity, pres ent resistance to air entrainment, offer excellent edge retention and can fill small holes and voids 6) Offer good bonding and adhesion 7) Give the hardest cured mounts and polishing properties 8) If the system is clear, they have the ability to be dyed in different colors. This is useful to enhance c ontrast and facilitate edge detection Several brands and types of epoxy have b een evaluated. Most of them have the properties mentioned above, but the epoxy system that ranks better in the overall is EPOTEK 301 from Epoxy Technology, Inc., Billerica, MA. Table 5 shows some typical properties of this epoxy system. Table 5. Some Properties for the Epotek 301 Epoxy System

PAGE 81

70 There are several ways to dye epoxy. For this particular use, dark and light tones are needed for light and dark part icles respectively. The goal is to differentiate the particles from the medium in which they are inlaid. These products are compatible with epoxy: photocopier/laser printer toner (very black and fine), lamp black powder, aniline, micro fine cement, cement color additives and special pigments. All these products, when added in small quantities, result in minimal loss in strength or hardness of the epoxy and they do not alter the properties or ch emical composition of the epoxy. Also, their average particle size is only a few microns. The process for dying epoxy for this research has been achieved by using an Epotek #11 Color Concentrates (black and white). These pigments have the smallest particle size from all the options mentioned and are very opaque. They consis t of color pigments ground and crushed into a liquid epoxy carrier. For any type of epoxy system, it is ve ry important to read and follow the instructions and use the proper mixing ratios specified by the manufacturer. Documentation made available by Epoxy Tec hnologies, Inc. provides good information on how to handle epoxy systems. In case of epoxy components that have been stored at low temp eratures (this can considerably extend the shelf life of epoxy), th ey must be brought to room temperature prior to use. The containers should not be opened until they have reached ambient temperature. If this step is not done, mois ture will condense on the surface of the materials, and it will cause deterioration of the epoxy. If the epoxy shows signs of

PAGE 82

71 crystallization, the closed containers with the epoxy components can be heated individually at 40C-55C, until crystals are dissolved. The covers are kept on but loosely fitting so air can escape from the container. 5.3.2 Sample Preparation: Cold Casting Cold cast means that no extreme heat is used to cure the epoxy. It is a simple casting method since no special equipment is needed for sample preparation. Special care must be taken if too little product is used, because any imprecise weigh of the resin and/or hardener will make vary the mixing ratios, t hus affecting the charac teristics of the cured epoxy. The minimum amount of epoxy mixture used was 2.5 grams. This amount will be enough to prepare more than one sample. The following list summarizes steps proposed by the Epoxy Technologies, Inc. for sample preparation: 1) Make sure sands are dry and clean. It may be necessary to wash sand particles with 100% pure water. Then dry sand in an oven at 100C for 24 hours. It is recommended to store the sand in closed containers in order to keep them in a dry and clean environment 2) Before mixing the epoxy resin and ha rdener together, mix the materials on each of the containers 3) Lower viscosities can be obtained in the epoxy resin if it is heated at temperatures between 50C and 60C. This step is optional but greatly recommended if the mold can handle the temperature without inconvenience

PAGE 83

72 4) Prior to use, gently stir the resi n. Do not mix vigorously. This could entrap air into the resin 5) Add the Epotek #11 Colored Concentrate to the epoxy resin only. Pigments should be mixed 1%-5% by weight of the entire formulation. Then mix both the dyed resin and the hardener materials for 1-2 minutes in a clockwise fashion and 1-2 min in counter-clockwise fashion. All mixings should be done ge ntly in order to avoid bubbles in mixture 6) Apply a thin layer of re lease agent to the surface s of the mold. Release agent is a low viscosity chemical th at does not allow adhesion of the epoxy to the mold 7) Pour a small amount of dyed epoxy in molds 8) Add few sand particles to the epoxy medium. Make sure most of the particles are not in touc h each other. Note that pigment and some sand particles will settle at the bottom and sides of the mold 9) Place the samples on a flat surface and allow curing in a dry and clean environment. Remember that Epotek 301 can also be cured in one hour at a temperature of 65 C. Generally speaking, epoxy systems can reach higher adhesive strength by curing at high temperatures. Bubbles can also be removed or minimized if some heat is applied 10) In case bubbles affect the quality of the samples and no heat is applied, vacuum may help this effect. V acuum Degassing can be accomplished

PAGE 84

73 by placing the sample in a vacuum chamber with a volume at least 5 times larger than the sample. Use a pump and apply a vacuum of 29 inches of Hg quickly. The key for good degassing is to hold the vacuum for a short period of time and not to apply too much vacuum. Otherwise, the rolling boil effect will appear, adding bubbles to the epoxy. Vacuum and vibration will remove bubbles even faster. The conditions for optimal sample prep aration depend on many variables. The process can be optimized only through a trial and error process and experience. 5.3.3 Equipment for Serial Sectioning Serial sectioning is a complicated proce dure that requires a very high level of precision. During this research, information ha s been gathered about equipment suitable for this task. Polishing machines such as Buehler PowerPro 5000, Logitech PM5 Precision Lapping/Polishing Machine and Allied High Tech Multiprep System are used for serial sectioning in diverse applications. The most outstanding polishing machine from the ones mentioned above is the Multiprep System from Allied High Tech Products, Inc (See figure 34). This semiautomatic system is ideal for parallel polishi ng, preparation of thin sections and sample preparation for microscopic evaluation (opt ical, Scanning Electron Microscopy (SEM), Transmission Electron Microsc opy (TEM), Atomic Force Micr oscopy (AFM), etc.). This machine comes with a digital micrometer that allows the user to monitor the amount of

PAGE 85

74 material that has been removed from the specimen in real time. This is useful because the operator has more control on the thicknesses and spacing of the layers to be removed. The specimen can be turning on its axis and oscillate across the rotating platen simultaneously, if necessary. These characteri stics provide uniform abrasive pattern and equal wearing of surfaces. The sp indle is calibrated perpendicu lar to the abrasive and the specimen is calibrated parallel to the abrasi ve. If required, samples can be polished at specific angles. According to the manufacturer, with this fi ne polishing equipment, material can be removed at 1 m increments. One advantage is that it does not re quire any hand held polishing jigs, allowing only the sample to be in contact with the abrasive surface. The control panel manages all functions such as platen speed (5-350 RPM clockwise or counterclockwise), timer, oscillation and rota tion settings. Its cam-locking system allows the exact repositioning of several types of fixtures and holders available. An automatic dosing system can be used to apply ab rasive suspensions and/or lubricants. Figure 34. Allied High Tech Multiprep System

PAGE 86

75 CHAPTER SIX: CONCLUSIO NS AND RECOMMENDATIONS 6.1 Results and Conclusions The light reflected and the glare emitted under illuminati on for some sand particles, like quartz grains, were found to be the most challenging issues for shape digitization. The use of an infrared pass filter for acquiring images proved to be an effective alternative for better edge detection and fa ster processing. Figure 35 shows a U.S Silica #1 Dry sand particle seen through different f ilters. Note how some image artifacts are omitted when seen through an IR pass filter. Figure 35. Composite Image Obtained Using the Extended Depth of Field Function on Image-Pro Plus For an U.S. Silica #1 Dry Sand Particle: a) Only Visible Light Captured, and b) Only NIR Light Captured. Scale Not Shown

PAGE 87

76 For some of the sands collected where th ere was enough material, a sieve analysis was performed. Results for the percentages by weight retained on sieves are presented on Appendix E. If the density of the particles is assumed equal, these percentage values can be used to obtain the same percentage of size ranges for shape digitization (2D and 3D). By using shapes based on a realistic gr ain size distribution, th e numerical modeling process will be more reliable. In addition to grain size distribution, it would be interesting to examine how shape behavior varies for different size ranges on sands composed of different minerals and from different origins. The grain size distribution obtainable from images requires the digitization of a large number of randomly selected particles. It has observed that smaller sand particles tend to get adhered to the surf ace of the glass slide, possibly due to electrostatic forces. Larger particles tend to fall of the surface during manipulatio n of the specimen and have fewer possibilities to be include d in the acquisition process. This problem can be solved by putting a retaining barrier on the edges of the glass slide before placing sand particles on it. This barrier will prevent sand pa rticles from falling of the surface. The routines implemented on Image-Pro Plus proved to be effective and reliable for image processing in two dimensions. The pro cess of massive acquisition has started with some sands collected from around the world. Appendix G shows grayscale pictures of these sands. The main application of this work is related to the characterization and digitization of angular particles. The procedures implemen ted can be used to obtain such shapes in two dimensions. Similar techniques for edge enhancement and detecti on of cross sections

PAGE 88

77 of sample submitted to serial sectioning can be used for three-dimensional reconstructions. Shapes obtained from the application of this work can be used for numerical modeling of angular particles using the Discrete Element Method. The creation and publication of a shape database for different types of granular soils will allow several researchers to use those shapes for modeling and testing of soils. This modeling process will be the first steps towards the process of revealing aspects like the influence of particle shape on the liquefac tion behavior of soils. Even though particle shape is not enough to predict completely the mechanical response of an assemb ly of soil particles (note that porosity, roughness and multiple part icle densities are other parameters that influence soil behavior), it could become a promising process that will encourage geotechnical engineers to model gran ular soils particle by particle. 6.2 Recommendations for Future Work Manual relocation of the X-Y stage is time consuming and limits the accuracy, and reproducibility of the stage movements. The use of an automated stage would make the process of acquisition faster fo r digitization of shapes of sa nd particles. In case of 2D, Image-Pro can control the zigzag process and more shapes can be digitized for each type of sand collected in less time. It is recommended to get a compatible automated stage for the microscope that can be c ontrolled with the hardware and software available. An imaginary mesh can divide the glass slide wh ere particles are hold, in to zones of certain

PAGE 89

78 area, according to the field of view of the objective lens. A macro could be implemented to maneuver the movement of the stage in su ch a way that the particle shapes can be acquired automatically for each zone. In case of 3D reconstruction, the recomme nded procedure to utilize is serial sectioning. This alternative is more afford able than using a nano tomograph and more compatible with the equipment available. An automatic stage could also be used to acquire images of small zones on the surface of the epoxy specimen at specific and reproducible coordinates. These small images can be later stitched via software to create a larger picture, thus, increm enting the number of particles th at can be reconstructed after each layer removal process. Figure 36 is the cross secti on of a sample containing R hode Island sand particles. The medium is acrylic that comes in a light amber color. The samples has a diameter of 4 mm (this size can not be seen entirely w ith the microscope) and was arranged from individual images acquired with Image-Pr o at a 4x magnification and using a 0.65x Cmount adapter for the camera. By using Microsoft PowerPoint, a combined image was created. The stitching process could have been done using Image-Pro but it was not able to handle 6 images at maximum resolution (1.4 Mega pixels per image). It is noted how smooth and even looks the composite imag e by using the Bright field Incident Illumination System, even though the surface of the specimen is not completely parallel to the objective lens (notice the sh adow on the specimen). Definitely

PAGE 90

79 Figure 36. Tiled Images of a Cross-Section of a Polished Sample Containing Rhode Island Sand Particles. The Material Where Particles Were Inla id is Light Amber Color Acrylic. The Diameter of The Sample is Approximately 4 mm and W as Polished Using the Multiprep System. Sample Was Courtesy of Allied High Tech Products, Inc. The optimum shape and size of the epoxy specimen will be defined by trial and error. At the lowest magnification (4x Ob jective Lens + 0.65 C-Mount adapter for the camera), the maximum diameter of the sample that can be stitched using 4 images on Image-Pro is about 3 mm. A suitable mold for this size could be a cc or 1cc disposable syringe. This mold would give a cylindrical sample. The polishing machine can also be used to make four flat cuts in the walls of the cylinder, which can be used for image alignment.

PAGE 91

80 Optimum results for a fine polishing process can be achieved using a 0.5 m Cerium Oxide Lapping film and to keep the wearing surface of the specimen parallel to the abrasive surface. The key factor to obtain accurate binary shapes in less time is to achieve good contrast between particles and their background. Black and white pigments might work better if they ar e seen under visible light. NI R opaque dyes or pigments may give better contrast. It is recommended to try dyes such as Epolight 9151 (See figure 37) from Epolin, Inc. This dye is compatible w ith epoxy and suitable for injection molding. Figure 37. Normalized Absorption Spectrum of Epolight 9151 In Chloroform. [Source: Epolin Technical Data Sheet for Epolight 9151 Anthraquinone Dye] At the same time, image alignment has to be done precisely before any attempt for 3D reconstruction. Solid glass micro spheres can be used as reference objects that can also be inlaid in epoxy. The center of each circular cross section in a micro sphere remains the same during the serial sectioning process. Five hundred grams of glass micro spheres with a mean diameter of 203 m, obtained from of Potters Industries, Inc., will be

PAGE 92

81 used for testing. Another alternative is to ma rk a shape on the material with an indenter. Chawla and Wunsch (2004) used a Vickers mi cro-hardness indenter to create fiducial marks. If the indenter can mark a well defi ned pyramidal volume on the sample, then the measurements of cross sections at different st ages of the serial se ctioning process can be related to thicknesses of the material removed. The creation of an exploratory routin e for acquisition, tiling and alignment, enhancement, conversion to binary and 3D reconstruction is recommended. After a methodology and procedure is achieved and refi ned, that basic routine can be adapted for a massive quantification of 3D structures of sand particles. The edge detection and image enhancement routines implemented for two-di mensional digitization of shapes can also be applied to the cross section images used for 3D reconstruction from serial sectioning.

PAGE 93

82 REFERENCES Alkemper, J. and Voorhees, P. W., 2001, Q uantitative Serial Sectioning Analysis, Journal of Microscopy, Vol. 201, Pt. 3, pp. 388-394. Allied High Tech Products, Inc., 2003, Catal ogue of Products for Precision Surface and Sample Preparation. Ashmawy, A.K., Sukumaran, B., and Vinh Hoa ng, V., 2003, Evaluating the Influence of Particle Shape on Liquefaction Behavior Using Discrete Element Modeling, Proceedings of the Thirteenth Intern ational Offshore and Polar Engineering Conference (ISOPE 2003), Honolulu, Hawaii. Bower, T.F., Brody, H. D., and Flemings, M. C., 1966, Measurements of Solute Redistribution in Dendritic Soli dification, Trans. AIME, 236, 624-634. Bowman, E. T., Soga, K., abd Drummond, W ., 2001, Particle Shape Characterization Using Fourier Descriptor Analys is, Gotechnique, 51(6), 545-554. Buehler Ltd., 2004, Consumable Buyers Guide. Buehler Ltd., 2004, Equipment Buyers Guide. Chandan, C., Sivakumar, K., Fletcher, T., and Masad, E., 2004, Geometry Analysis of Aggregate Particles Using Imaging Techni ques, Journal of Computing in Civil Engineering, American Society of Civil Engineers, Vol. 18, No. 1, pp. 7582.Epoxy Technology, Inc., 1998, EPO-TEK 3 01-2FL Data Sheet, Billerica, MA. Chawla, N.,Ganesh, V.V., and Wunsc h, B., 2004, Three-dimensional (3D) Microstructure Visualization and Finite Element Modeling of the Mechanical Behavior of SiC Particle Reinforced AluminumComposites, Scripta Materialia. Vol. 51, no. 2, pp. 161-165. Cho, G., Dodds, J., and Santamarina, C ., 2005, Particle Shape Effects on Packing Density, Stiffness and Strength -Natural and Crushed Sands- , Internal Report Georgia Institute of Technology.

PAGE 94

83 Clark, N. N., 1987, A New Scheme for Partic le Shape Characterization Based on Fractal Harmonics and Fractal Dimensions, Powder Technology, 51, 243-249. DeHoff R. T., 1983, Quantitative Serial Secti oning Analysis: Previe, J. Microsc., 131259-263. DeHoff R. T., Aigeltinger, E. H., and Crai g, K. R., 1972, Experimental Determination of of the topological properties of Three-di mensional Microstructures, J. Microsc., 95, 69-91. Fiala, J. and Harris, K., 2002, PC-Based Alignment and Reconstruction of Serial Sections, Microscopy and An alysis USA Edition 52, p. 5-7. Garboczi, E.J., 2002, Three-dimensional Mathema tical Analysis of Particle Shape Using X-ray Tomography and Spherical Harmonics: Application to Aggregates Used in Concrete, Cement and Concrete Research, Vol. 32, No. 10, 1621-1638. Hyslip, J. P., and Vallejo, L. E., 1997, F ractal Analysis of the Roughness and Size Distribution of Granul ar Materials, Engi neering Geology, 48, 231-244. Jang, D-J., Frost, J.D., and park, J.-Y., 1999, Preparation of Epoxy Impregnated Sand coupons for Image Analysis, Geotechnica l Testing Journal, GTJODJ, Vol. 22, No. 2, pp. 147-158. Li, M., Ghosh, S., Rouns, T. N., Weiland, H ., Richmond, O., and Hunt, w., 1998, Serial Sectioning Method in the Construction of 3-D Microstructures for ParticleReinforced MMCs, Mater. Sci. Eng., A265, 153-173. Mangan, M.A., Lauren, P. D. and Shiflet, G.J., 1997, Three-dimensional Reconstruction of Widmanstatten plates in Fe12.3Mn-0.8C, J. Microsc., 188, 36-41. Margolis, S. V., and Krinsley, D. H., 1994, Processes of Formation and Environmental Occurrence of Microfeatures on Detrital Quartz grains. American Journal of Science, 274, 449-464. Nayar, S. K., Nakagawa, Y., 1994, Shape fr om Focus, IEEE Transactions on Pattern Analysis and Machine Intelligence, Vol. 16, No. 8, pp. 824-831. Meloy, T. P., 1977, Fast Fourier Transforms Applied to Shape Analysis of Particle Silhouettes to Obtain Morphological Data, Power Technology, 17, 27-35. Niederost, M., Niederost, J., Scucka, J., 2003, Automatic 3D Reconstruction and Visualization of Mircroscopic Object s From a Monoscopic Multifocus Image Sequence, International Archives of Photogrammetry, Remote Sensing and Spatial Information Sciences, Vol. XXXIV-5/W10.

PAGE 95

84 Noguchi, M., Nayar, S. K., 1994. Microscopic Shape from Focus Using Active Illumination, Proceedings of International Conference on Pattern Recognition (ICPR 94). Pirard, E. and Vergara, N., 2004, Direct Estim ation of Sieve Size Distributions From 2D Image Analysis of Sand Particles, Proc. PARTEC 2004. Rahaman, M. N., 1995, Ceramic Processing an d Sintering, Dekker Inc., NY, 770 pages. Rufner, R., Pajoohesh-Ganji, A., Popratilo ff, A., 2004, The Basics of Using 3D Constructor 5.0, Department of An atomy and Cell Biology, The George Washington University Medical Center, Washington, D.C. Application Note for Media Cybernetics, Inc. Sallam, A. M., 2004, Studies on Modeling Angul ar Soil Particles Using the Discrete Element Method, Doctor of Philosophy Di ssertation, Department of Civil and Environmental Engineering, Univ ersity of South Florida. Sallam, A. M., and Ashmawy, A.K, 2005. The Modified Overlapping Rigid Clusters Method for Modeling angular particles usi ng DEM, Proceedings of the Eleventh International conference on computer Me thods and Advances in Geomechanics, Torino, Italy, Vol. 1, pp. 167-174. Santamarina, J.C. and Cho, G.C., 2004, Soil Behavior: The Role of Particle Shape. Proceedings of the Skempton Memorial Conference on Advances in Geotechnical Engineering, held at the Royal Geogr aphical Society, London, United Kingdom, on March 29-31. SCHOTT North America, Inc., 1997, BG 40 I onically Colored Glass Filter Technical Sheet. Sukumaran, B., and Ashmawy, A. K., 2001, Q uantitative Characterization of the Geometry of Discrete Particle s, Gotechnique, 51(7), 171-179. Wolfsdorf, T.L., Bender, W. H. and V oorhees, P.W., 1997, The Morphology of High Volume Fraction Solid-Liquid Mixtures: An Application of Microstructural Tomography, Acta Mater., 45/6, 2279-2295.

PAGE 96

85 BIBLIOGRAPHY Blott, S., Al-Dousari, A., Pye, K., and Saye, S., 2004, Three-Dimensional Characterization of Sand Grain Shape and Surface Texture Using a Nitrogen Gas Adsorption Technique, Journal of Sedi mentary Research, Vol. 74; No. 1, pp. 156-159. Crawford-Hines, S. and McCracken, T., 2002, A System for 3D Surface Models from 2D Sectional Imagery, Internati onal Conference on Mathematics and Engineering Techniques in Medi cine and Biological Sciences. Delmarsh, A. and Estes, R., 2000, Select ing Epoxies for Optical and Fiber Optic Applications. Technical Paper BG-56 for Epoxy Technology, Inc. Epoxy Technology, Inc., 2001, EPO-TEK 301 Data Sheet, Billerica, MA. Epoxy Technology, Inc., 2001, EPO-TEK 301-2 Data Sheet, Billerica, MA. Epoxy Technology, Inc., 2002, EPO-TEK 302-3M Data Sheet, Billerica, MA. Epoxy Technology, Inc., 2003, Tech Tip #1: The Major Characteristics of Adhesives, Billerica, MA. Epoxy Technology, Inc., 2003, Tech Tip #2: How to Work with Electr ically Conductive Adhesives, Billerica, MA. Epoxy Technology, Inc., 2003, Tech Tip #3: Handling Instructions for Epoxy Adhesives, Billerica, MA. Epoxy Technology, Inc., 2003, Tech Tip #3: Handling Instructions for Epoxy Adhesives, Billerica, MA. Epoxy Technology, Inc., 2003, Tech Tip 1: Pr oper Mixing & Handling of Epoxies, Billerica, MA. Epoxy Technology, Inc., 2003, Tech Tip 3: Vi scosity and the Thixotropic Index, Billerica, MA.

PAGE 97

86 Epoxy Technology, Inc., 2003, Tech Tip 4: Re moving Bubbles from Epoxy, Billerica, MA. Epoxy Technology, Inc., 2003, Tech Tip 5: Using an Epotek Product after the Shelf Life has Expired, Billerica, MA. Epoxy Technology, Inc., 2004, Tech Tip 2: Handling Procedures for Premixed & Frozen Materials, Billerica, MA. Estes, R. H., 1986, Adhesives for Milita ry Hybrids, Hybrid circuit Technology. Hinsch, J., 2003, Koehler Illumination. Wh ite Paper for Media Cybernetics, Inc. January, 2003. King, M., Scottty, N., Klein, R., Meyer, E., 2002, Particle Detection, Number Estimation, and Feature Measurement in Gene Transfer Studies: Optical Fractionator Stereology Integrated With Digital Image Processing and Analysis, Methods 28, pp. 293-299. Kremer, J.R., Mastronarde, D.N., and McIn tosh, J.R., 1996, Computer Visualization of ThreeDimensional Image Data Using IMOD, Journal of Structural Biology. P.116, 71-76. Kulesza, F., 1969, What Next for Epoxi es?, Design Report printed on May 12th for Design News. Lanzagorta, M., Kral, M., Swan II, J., Sp anos, G., Rosenberg, R., Kuo, E., 1998, ThreeDimensional Visualization of Micros tructures, Vis, Vol. 00, No., p. 487. Maerz, N. H., and Zhou, W., 1999, Flat and Elongated: Advances in Using Digital Image Analysis, Center for Aggregates (ICAR), Seventh Annual SymposiumProceedings, Austin Texas, April 19-21, pp. B1-4-1 to B1-4-12. Marinescu, R., 2001, Comparison of Image Generation and Processing Techniques for 3D Reconstruction of the Human Skull Masters Degree Thesis. College of Engineering and Technology. Ohio University. Matsumoto, Brian, 2003, Extended Depth of Field. University of California-Santa Barbara, California. White Pape r for Media Cybernetics, Inc. Matsumoto, Brian, 2004, Spherical Aberration, University of California-Santa Barbara, California. White Paper for Media Cybernetics, Inc.

PAGE 98

87 McAndrew, A. and Venables, A., 2005. A "secondary" look at digital image processing, Proceedings of the 36th SI GCSE Technical Symposiumon Computer Science Education, p. 337-341. McNally, J.G., Karpova, T., Cooper, J., a nd Conchello, J.A., 1999, Three-Dimensional Imaging by Deconvolution Micr oscopy. Methods 19, 373-385. Media Cybernetics, Inc. 2004, SharpStack/Sha rpStack Plus Version 5.0 User Guide for Windows. 2004. Media Cybernetics, Inc., 2002, Spa tial Calibration, Product Note. Media Cybernetics, Inc., 2003, D Construc tor Version 5.0 User Guide for Windows. Media Cybernetics, Inc., 2003, C reating Spatial Measurements in 3D Constructor 5.0, Product Note. Media Cybernetics, Inc., 2003, Creating Volume Measurements in 3D Constructor 5.0, Product Note. Media Cybernetics, Inc., 2003, SharpStack V. 5.0, Image-Pro Plus Product Note. 2003. Media Cybernetics, Inc., 2004, Automated Microscope Configuration Top to Bottom..., Image-Pro Plus 5.0 Product Note. Media Cybernetics, Inc., 2004, Image-Pro Plus Version 5.0 Auto-Pro Reference for Windows. Media Cybernetics, Inc., 2004, Image-Pro Plus Version 5.0 Reference Guide for Windows. Media Cybernetics, Inc., 2004, Image-Pro Plus Version 5.0 Start-Up Guide for Windows. Media Cybernetics, Inc., 2004, Managing Image Sets, Image-Pro Plus v. 5.0 Product Note. Media Cybernetics, Inc., 2004, Scope-Pro Version 5.0 User Guide for Windows. Media Cybernetics, Inc., 2004, Stitchi ng and Tiling Images, Application.

PAGE 99

88 Muller, R., 2002, Quantitative Image Proces sing of 3D Biological Structures. Proceedings of IEEE International Symposiumon Biomedical Imaging, pages 388-391. Pirard, E. and Vergara, N., 2004. Multivariate Discrimination of Sands using Elongation and Wear Indices. Proc. PARTEC 2004. Potters Industries, Inc., 1996, Spheriglass So lid Glass Spheres Mate rial Safety Data Sheet. Prior Scientific Inc., 2001, ProS can II Operating Instructions. Ryan, Kevin., 2002, Minimizing Image Artifacts in Microarray Imaging, White Paper for Media Cybernetics, Inc. Tomutsa, L. and Radmilovic, V., 2003. Focus ed ion beam assisted three-dimensional rock imaging at submicron scale, Technical Report LBNL-52648, Lawrence Berkeley National Laboratory. Valverde, F., Guil, N., Muoz J., Nishikawa R., and Doi, K., 2001, An Evaluation Criterion for Edge Detection Techniques in Noisy Images, IEEE International Conference on Image Processing, Greece. Wang, L. B., Frost, J. D., and Shashidhar, N., 2001, Microstructure Study of WesTrack Mixes from X-Ray Tomography Images, Transportation Research Record 1767. P. 85-94.

PAGE 100

89 APPENDICES

PAGE 101

90 Appendix A. Source Code for the Script File GET2DSAHPE.SCR Option Explicit 'THIS SCRIPT WORKS ONLY WITH NE AR INFRARED (NIR) WAVELENGHTS ONLY. MAKE SURE YOUR CAMERA HAS THE PROPER WRATTEN FILTER IN PLACE. 'First Macro: Generate an image sequence of sand particles Sub Acquisition() ret = IpMacroStop ("Place the sample on th e microscope stage. Locate a sand particle using the Preview screen.",0) ret = IpTemplateMode(0) ret = IpAcqShow(ACQ_SNAP,1) ret = IpAcqShow(ACQ_LIVE, 1) IpArray(0) = 0 'left IpArray(1) = 0 'top IpArray(2) = 1391 'right IpArray(3) = 1039 'bottom ret = IpAcqControl(88, 1, IpArra y(0)) ACQCMD_AUTOEXPOSURE ret = IpTemplateMode(0) ret = IpScopeShow(1) ret = IpMacroStop ("Select a setting according to curre nt objective magnification. Set Top and Bottom limits and click on Acqui re. Save all files as SEQUENCES.",1) End Sub 'Second Macro: Open Image Sequence, deconv olves, obtains EDF TestStrips, applies Local Best Fit Contrast Enhancement routine, filters with Variance Filter Sub EdgeDetec() ret = IpTemplateMode(1) Dim ori%, decon%, edfd%, cedfd% 'Open file and select Rectangular AOI ret = IpmacroStop ("Select a sequence of images.",0) ret = IpWsLoad("C:\Documents and Settings\All Users\Documents","seq") ret = IpmacroStop ("Adjust the following rectangular AOI(Area of Interest) to cover the entire particle.",0) ipRect.Left = 490 ipRect.top = 236 ipRect.Right = 1154 ipRect.bottom = 894 ret = IpAoiCreateBox(ipRect)

PAGE 102

91 Appendix A (continued) ret = IpWsDuplicate() ret = IpDocCloseEx(0) ori = IpAppSelectDoc(1) 'Deconvolution using SharpStack ret = IpmacroStop ("Select the Spatial Calibration.",0) ret = IpSCalShowEx(SCA L_DLG_SELECT, SCAL_SHOW) 'Dim docInfo As IPDOCINFO, scaleVal As Single Dim gmagnum As Integer Begin Dialog UserDialog 380,112,"Sel ect Magnification(4x,10x or 20x)" Text 40,21,90,14,"Magnification",.Text1 TextBox 140,14,90,21,.magnum OKButton 80,84,90,21 End Dialog Dim dlg1 As UserDialog Apply to dialog dlg1.magnum = Str(gmagnum) Get user values Dialog dlg1 Get back from dialog gmagnum = Val(dlg1.magnum) Select Case gmagnum Case 4 ret = IpDcnvShow(1) ret = IpLensApply("4x_065", APPLYTO_IMAGE) ret = IpSCalSetLong(SCAL_C URRENT_CAL, SCAL_APPLY, 0) ret = IpDCnvSet(DCNV_TYPE, DCTYPE_NEAREST) ret = IpDCnvSetSng(DCNV_NA, 0.100000) ret = IpDCnvSetSng(DCNV_RI, 1.000000) ret = IpDCnvSetSng(DCNV_WL, 775.000000) ret = IpDCnvSetSng(DCNV_XSPACING, 1.739130) ret = IpDCnvSetSng(DCNV_YSPACING, 1.739130) ret = IpDCnvSet(DCNV_BRIGHTFIELD, 0) ret = IpDCnvSet(DCNV_PHASEOBJECTS, 0) ret = IpDCnvSet(DCNV_NEIGHBORSPACING, 1) ret = IpDCnvSet(DCNV_HAZEREMOVAL, 10) ret = IpDCnvSet(DCNV_USEACTIVEPORTION, 0)

PAGE 103

92 Appendix A (continued) ret = IpDCnvSet(DCNV_CONVERTTOFLOAT, 1) ret = IpDCnvSet(DCNV_SPHERICALABERRATION, -9) ret = IpMacroStop ("Input appropriate parameters to SharpStack, Deconvolve image, then Continue.",0) ret = IpDCnvShow(0) Case 10 ret = IpDcnvShow(1) ret = IpLensApply("10x_065", APPLYTO_IMAGE) ret = IpSCalSetLong(SCAL_C URRENT_CAL, SCAL_APPLY, 0) ret = IpDCnvSet(DCNV_TYPE, DCTYPE_INVERSE) ret = IpDCnvSetSng(DCNV_NA, 0.250000) ret = IpDCnvSetSng(DCNV_RI, 1.000000) ret = IpDCnvSetSng(DCNV_WL, 775.000000) ret = IpDCnvSetSng(DCNV_XSPACING, 0.714286) ret = IpDCnvSetSng(DCNV_YSPACING, 0.714286) ret = IpDCnvSet(DCNV_BRIGHTFIELD, 0) ret = IpDCnvSet(DCNV_PHASEOBJECTS, 0) ret = IpDCnvSet(DCNV_NEIGHBORSPACING, 1) ret = IpDCnvSet(DCNV_HAZEREMOVAL, 10) ret = IpDCnvSet(DCNV_USEACTIVEPORTION, 0) ret = IpDCnvSet(DCNV_CONVERTTOFLOAT, 1) ret = IpDCnvSet(DCNV_SPHERICALABERRATION, -9) ret = IpMacroStop ("Input appropriate parameters to SharpStack, Deconvolve image, then Continue.",0) ret = IpDCnvShow(0) Case 20 ret = IpDcnvShow(1) ret = IpLensApply("20x_065", APPLYTO_IMAGE) ret = IpSCalSetLong(SCAL_C URRENT_CAL, SCAL_APPLY, 0) ret = IpDCnvSet(DCNV_TYPE, DCTYPE_INVERSE) ret = IpDCnvSetSng(DCNV_NA, 0.400000) ret = IpDCnvSetSng(DCNV_RI, 1.000000) ret = IpDCnvSetSng(DCNV_WL, 775.000000) ret = IpDCnvSetSng(DCNV_XSPACING, 0.350877) ret = IpDCnvSetSng(DCNV_YSPACING, 0.350877) ret = IpDCnvSet(DCNV_BRIGHTFIELD, 0) ret = IpDCnvSet(DCNV_PHASEOBJECTS, 0) ret = IpDCnvSet(DCNV_NEIGHBORSPACING, 1) ret = IpDCnvSet(DCNV_HAZEREMOVAL, 10) ret = IpDCnvSet(DCNV_USEACTIVEPORTION, 0) ret = IpDCnvSet(DCNV_CONVERTTOFLOAT, 1)

PAGE 104

93 Appendix A (continued) ret = IpDCnvSet(DCNV_SPHER ICALABERRATION, -14.6862) ret = IpMacroStop ("Input appropriate parameters to SharpStack, Deconvolve image, then Continue.",0) ret = IpDCnvShow(0) Case Else End Select 'Filtering 'EDF(Extended Depth of Field TestStrips ret = IpTemplateMode(0) Dim nNorm%, nCriteria%, nOrder% Dim sNorm(0 To 1) As String, valNorm(0 To 1) As Integer Dim sCriteria(0 To 3) As String, valCriteria(0 To 3) As Integer Dim sOrder(0 To 1) As String, valOrder(0 To 1) As Integer Dim nSeries%, nEDF%, nFrames% Dim textStr As String 'Set source to the current document? ret = IpEDFRemove(DOCSEL_ALL) ret = IpEDFNew(1) 'Set values and strings fo r the various parameters valNorm(0) = 0 sNorm(0) = "Not Normalized" valNorm(1) = 1 sNorm(1) = "Normalized" valCriteria(0) = EDF_MAX_LOCALCONTRAST sCriteria(0) = "Local Contrast" valCriteria(1) = EDF_MAX_DEPTHCONTRAST sCriteria(1) = "Depth Contrast" valCriteria(2) = EDF_MAX_INTENSITY sCriteria(2) = "Maxmimum" valCriteria(3) = EDF_MIN_INTENSITY sCriteria(3) = "Minimum" valOrder(0) = EDF_TOPDOWN sOrder(0) = "Top Down" valOrder(1) = EDF_BOTTOMUP sOrder(1) = "Bottom Up"

PAGE 105

94 Appendix A (continued) 'Initialize value for series nSeries = -1 Loop through the various criteria Various criteria For nCriteria = 0 To 3 Various orders For nOrder = 0 To 1 Normalize or not For nNorm = 0 To 1 Set parameters and create the EDF ret = IpEDFSet(EDF_NORMALIZE, valNorm(nNorm), 0) ret = IpEDFSet(EDF_CRITERIA valCriteria(nCriteria), 0) ret = IpEDFSet(EDF_ORDER, valOrder(nOrder), 0) ret = IpEDFCreate(EDF_COMPOSITE) ret = IpDocGet(GETACTDOC, 0, nEDF) Write description onto images textStr = sCriteria(nCriteria) + Chr$(10) textStr = textStr + sNorm(nNorm) + Chr$(10) textStr = textStr + sOrder(nOrder) ret = IpAnCreateObj(GO_OBJ_TEXT) ret = IpAnMove(0, 20, 20) ret = IpAnText(textStr) ret = IpAnSet(GO_ATTR_ZOOM, 0) ret = IpAnSet(GO_ATTR_RECTSTYLE, GO_RECTSTYLE_NOBORDER_FILL) ret = IpAnSet(GO_ATTR_TEXTAUTOSIZE, 1) ret = IpAnSet(GO_ATTR_FONTBOLD, 700) ret = IpAnSet(GO_ATTR_BRUSHCOLOR, 12632256) ret = IpAnSet(GO_ATTR_TEXTCOLOR, 0) ret = IpAnBurn() Add to the series If nSeries < 0 Then Set series to this image nSeries = nEDF Else Or append EDF to the accumulated series

PAGE 106

95 Appendix A (continued) ret = IpAppSelectDoc(nEDF) ret = IpWsCopyFrames(0,1) ret = IpAppSelectDoc(nSeries) ret = IpWsPasteFrames(-1) Set to the last frame of the series ret = IpSeqGet(SEQ_NUMFRAMES, nFrames) ret = IpSeqSet(SEQ_ACTIVEFRAME, nFrames-1) Clean up the EDF ret = IpAppSelectDoc(nEDF) ret = IpDocClose() End If Next nNorm Next nOrder Next nCriteria 'Delete original sequence ret = IpDocCloseEx(ori) 'Image enhancement 'User set variables are kept as globals so that they can be preserved between calls to this routine Dim gnumIter As Integer 'Local Best Fit Contrast Enhancement 'Sub MinMaxscale() Dim source%, dest%, minima%, ma xima%, diff%, floor%, scaled% Dim docInfo As IPDOCINFO, scaleVal As Single Begin Dialog UserDialog 320,112,"Lo cal contrast enhancement" Text 40,21,90,14,"Iterations",.Text1 TextBox 140,14,90,21,.numIter OKButton 80,84,90,21 End Dialog Dim dlg2 As UserDialog If gnumIter=0 Then Set up initial values gnumIter = 5

PAGE 107

96 Appendix A (continued) End If Apply to dialog dlg2.numIter = Str(gnumIter) Get user values Dialog dlg2 Get back from dialog gnumIter = Val(dlg2.numIter) Check image class and scaling ret = IpDocGet(GETDOCINFO, DOCSEL_ACTIVE, docInfo) Select Case docInfo.Class Case IMC_GRAY, IMC_RGB scaleVal = 255.0 Case IMC_GRAY12, IMC_RGB36 scaleVal = 4095.0 Case IMC_GRAY16, IMC_RGB48 scaleVal = 65535.0 Case Else Not supported! Beep ret = IpMacroStop("Image type not supported!", vbOK) Exit Sub End Select 'Create working images ret = IpDocGet(GETACTDOC, DOCSEL_ACTIVE, source) dest = IpWsDuplicate() minima = IpWsDuplicate() maxima = IpWsDuplicate() 'Smoothed minima ret = IpAppSelectDoc(minima) ret = IpFltErode(MORP HO_7x7OCTAGON, gnumIter) ret = IpFltGauss(7, 10, gnumIter*2) 'Smoothed maxima ret = IpAppSelectDoc(maxima) ret = IpFltDilate(MORPHO_7x7OCTAGON, gnumIter) ret = IpFltGauss(7, 10, gnumIter*2)

PAGE 108

97 Appendix A (continued) 'Difference (local contrast scale) diff = IpOpImageArithmetics(minima, 0.0, OPA_SUB, 1) ret = IpAppSelectDoc(dest) ret = IpOpImageArithmetics(minima, 0.0, OPA_SUB, 0) ret = IpOpImageArithmetics(di ff, scaleVal, OPA_DIV, 0) 'Clean up ret = IpAppSelectDoc(minima) ret = IpDocClose() ret = IpAppSelectDoc(maxima) ret = IpDocClose() ret = IpAppSelectDoc(diff) ret = IpDocClose() 'Average with image after enhancement ret = IpOpImageArithmetics(source, 0.0, OPA_AVG, 0) 'Application of Variance Filter ret = IpTemplateMode(0) ret = IpWsDuplicate() ret = IpFltVariance(7, 7) ret = IpDocCloseEx(1) 'Average with EDF TestStrip sequence ret = IpTemplateMode(0) ret = IpAppSelectDoc(18) ret = IpDocClose() ret = IpAppSelectDoc(19) ret = IpOpImageArithmetics(2, 0.0, OPA_AVG, 0) ret = IpOpShow(0) 'Convert image to grayscale 8 ret = IpTemplateMode(0) ret = IpAoiShow(FRAME_NONE) ret = IpWsConvertImage(IMC_GRAY, CONV_SCALE, 0, 0, 0, 0) ret = IpHstEqualize(EQ_BESTFIT) 'ret = IpAppSelectDoc(19) 'ret = IpDocClose() 'Choose grayscale value where edge is defined ret = IpMacroStop ("Select best frame fr om any of the EDF Test Strips. Select MakeBIN macro when the AOI is defined.",0)

PAGE 109

98 Appendix A (continued) ret = IpTemplateMode(1) ret = IpAoiCreateIrregular(Pts(0), 7) End Sub 'Third Macro: Extracts best frame from EDF TestStrips, defines particle contour, makes a binary image. Sub MakeBIN() ret = IpMacroStop ("A Grayscale 8 sequen ce will be created from selected Image sequence. Try an Irregular AOI around the particle.",0) 'Convert image to grayscale 8 ret = IpTemplateMode(0) ret = IpAoiShow(FRAME_NONE) ret = IpWsConvertImage(IMC_GRAY, CONV_SCALE, 0, 0, 0, 0) ret = IpHstEqualize(EQ_BESTFIT) 'Extract frame of interest ret = IpTemplateMode(1) Dim gnFrame As Long Set up initial values gnFrame = 16 Begin Dialog UserDialog 320,112,"Se lect frame to extract." Text 40,21,90,14,"Frame number",.Frame TextBox 140,14,90,21,.nFrame OKButton 80,84,90,21 End Dialog Dim dlg3 As UserDialog Apply to dialog dlg3.nFrame = Str(gnFrame) Get user values Dialog dlg3 Get back from dialog gnFrame = Val(dlg3.nFrame) 1 ret = IpSeqExtractFrames(gnFrame, 1) ret = IpAoiCreateIrregular(Pts(0), 7) ret = IpMacroStop ("A binary image will be created.",0)

PAGE 110

99 Appendix A (continued) 'Fill particle shape with white color ret = IpWsFill(0, 2, 0) ret = IpTemplateMode(0) 'Make binary image ret = IpAoiShow(FRAME_RESET) ret = IpAoiShow(FRAME_NONE) ret = IpSegShow(1) ret = IpSegSetAttr(SETCURSEL, 0) ret = IpSegSetAttr(CHANNEL, 0) ret = IpSegPreview(ALL_C_B) ret = IpSegSetRange(0, 0, 255) ret = IpSegPreview(ALL_C_B) ret = IpSegSetRange(0, 255, 255) ret = IpSegPreview(ALL_C_B) ret = IpSegCreateMask(5, 0, 1) ret = IpSegShow(0) ret = IpWsSaveAs("","BMP") End Sub

PAGE 111

100 Appendix B. Source Code for the Script File Mult2DShape4x Option Explicit Global directory starting string, fo r saving where we last processed Dim gDirStart As String This Macro: Helps the operator to generate sets of images at different focal planes Sub Acquisition() ret = IpMacroStop ("Place the sample on the microscope stage. Locate a group of sand particles using the Preview screen and start acquiring image sets.",0) ret = IpTemplateMode(0) ret = IpAcqShow(ACQ_SNAP,1) ret = IpAcqShow(ACQ_LIVE, 1) IpArray(0) = 0 'left IpArray(1) = 0 'top IpArray(2) = 1391 'right IpArray(3) = 1039 'bottom ret = IpAcqControl(88, 1, IpArra y(0)) ACQCMD_AUTOEXPOSURE ret = IpTemplateMode(0) ret = IpScopeShow(1) ret = IpMacroStop ("Select a setting according to curre nt objective magnification. Set Top and Bottom limits and click on Acquire Save all files as SEQUENCES. Click on Continue now.",0) End Sub This Macro: Automatically opens imag e sequences one by one. Then it deconvolves each sequence, creates an EDF Test Stri p, applies a Local Best Fit Contrast Enhancement routine, Applies a Varian ce Filter and then saves edge enhanced images Sub EnhanceEdges() Scan through and process all files in a directory Dim IName As String*255 Dim fName As String Dim workStr As String Dim savefol As String Dim docID As Integer Dim X As Integer X = 0

PAGE 112

101 Appendix B (continued) 'Operator selects a folder where to store enhanced images savefol = GetFilePath("EDFts", "", "C:\", "Select a file where to store enhanced images", 2) Creating starting point If gDirStart = "" Then gDirStart = "C:\" End If Get a file name in the desired directory workStr = GetFilePath("", "SEQ", gDirStar t, "Specify a folder where to find image sequences", 0) Check if user did not cancel If workStr = "" Then Exit Sub End If Close all open images prior to processing ret = IpAppCloseAll() Extract the directory name from the full file name gDirStart = Left(workS tr, InStrRev(workStr, "\")) 'debugclearClear the Output For work purposes ret = IpOutputClear() Select Calibration for 4X Objective Lens ret = IpSCalSelect("4x_065") ret = IpTemplateMode(0) fName = Dir(gDirStart + "*.SEQ", 32) While fName <> "" X = X + 1 Print out the file name and its attributes Debug.Print GetAttr(gDi rStart + fName); "; fName Load the image sequence docID = IpSeqOpen(gDirStart + fName, "SEQ",0,15) ret = IpSMShowNav(SM_HIDE)

PAGE 113

102 Appendix B (continued) ret = IpTemplateMode(0) ret = IpWsConvertImage(IMC_GRAY, CONV_SCALE, 0, 0, 0, 0) ret = IpDocCloseEx(0) Start routine If docID >= 0 Then ret = IpTemplateMode(0) Deconvolution using SharpStack for 4X Objective Lens parameters ret = IpDcnvShow(0) ret = IpLensApply("4x_065", APPLYTO_IMAGE) ret = IpSCalSetLong(SCAL_C URRENT_CAL, SCAL_APPLY, 0) ret = IpDCnvSet(DCNV_TYPE, DCTYPE_NEAREST) ret = IpDCnvSetSng(DCNV_NA, 0.100000) ret = IpDCnvSetSng(DCNV_RI, 1.000000) ret = IpDCnvSetSng(DCNV_WL, 775.000000) ret = IpDCnvSetSng(DCNV_XSPACING, 1.739130) ret = IpDCnvSetSng(DCNV_YSPACING, 1.739130) ret = IpDCnvSet(DCNV_BRIGHTFIELD, 0) ret = IpDCnvSet(DCNV_PHASEOBJECTS, 0) ret = IpDCnvSet(DCNV_NEIGHBORSPACING, 1) ret = IpDCnvSet(DCNV_HAZEREMOVAL, 10) ret = IpDCnvSet(DCNV_USEACTIVEPORTION, 0) ret = IpDCnvSet(DCNV_CONVERTTOFLOAT, 0) ret = IpDCnvDeconvolve ret = IpDCnvShow(0) Filtering EDF(Extended Depth of Field Test Strip) ret = IpTemplateMode(0) Dim nNorm%, nCriteria%, nOrder% Dim sNorm(0 To 1) As String, valNorm(0 To 1) As Integer Dim sCriteria(0 To 3) As Stri ng, valCriteria(0 To 3) As Integer Dim sOrder(0 To 1) As Stri ng, valOrder(0 To 1) As Integer Dim nSeries%, nEDF%, nFrames% Dim textStr As String Set source to the current document? ret = IpEDFRemove(DOCSEL_ALL) ret = IpEDFNew(1)

PAGE 114

103 Appendix B (continued) Set values and strings for the various parameters valNorm(0) = 0 sNorm(0) = "Not Normalized" valNorm(1) = 1 sNorm(1) = "Normalized" valCriteria(0) = EDF_MAX_LOCALCONTRAST sCriteria(0) = "Local Contrast" valCriteria(1) = EDF_MAX_DEPTHCONTRAST sCriteria(1) = "Depth Contrast" valCriteria(2) = EDF_MAX_INTENSITY sCriteria(2) = "Maxmimum" valCriteria(3) = EDF_MIN_INTENSITY sCriteria(3) = "Minimum" valOrder(0) = EDF_TOPDOWN sOrder(0) = "Top Down" valOrder(1) = EDF_BOTTOMUP sOrder(1) = "Bottom Up" Initialize value for series nSeries = -1 Loop through the various criteria Various criteria For nCriteria = 0 To 3 Various orders For nOrder = 0 To 1 Normalize or not For nNorm = 0 To 1 Set parameters and create the EDF ret = IpEDFSet(EDF_NORMALIZE, valNorm(nNorm), 0) ret = IpEDFSet(EDF_CRITERIA valCriteria(nCriteria), 0) ret = IpEDFSet(EDF_ORDER, valOrder(nOrder), 0) ret = IpEDFCreate(EDF_COMPOSITE) ret = IpDocGet(GETACTDOC, 0, nEDF) Write description onto images textStr = sCriteria(nCriteria) + Chr$(10) textStr = textStr + sNorm(nNorm) + Chr$(10) textStr = textStr + sOrder(nOrder)

PAGE 115

104 Appendix B (continued) ret = IpAnCreateObj(GO_OBJ_TEXT) ret = IpAnMove(0, 20, 20) ret = IpAnText(textStr) ret = IpAnSet(GO_ATTR_ZOOM, 0) ret = IpAnSet(GO_ATTR_RECTSTYLE, GO_RECTSTYLE_NOBORDER_FILL) ret = IpAnSet(GO_ATTR_TEXTAUTOSIZE, 1) ret = IpAnSet(GO_ATTR_FONTBOLD, 700) ret = IpAnSet(GO_ATTR_BRUSHCOLOR, 12632256) ret = IpAnSet(GO_ATTR_TEXTCOLOR, 0) ret = IpAnBurn() Add to the series If nSeries < 0 Then Set series to this image nSeries = nEDF Else Or append EDF to the accumulated series ret = IpAppSelectDoc(nEDF) ret = IpWsCopyFrames(0,1) ret = IpAppSelectDoc(nSeries) ret = IpWsPasteFrames(-1) Set to the last frame of the series ret = IpSeqGet(SEQ_NUMFRAMES, nFrames) ret = IpSeqSet(SEQ_ACTIVEFRAME, nFrames-1) Clean up the EDF ret = IpAppSelectDoc(nEDF) ret = IpDocClose() End If Next nNorm Next nOrder Next nCriteria Delete previous sequences ret = IpDocCloseEx(1) ret = IpDocCloseEx(2) Further Image enhancement

PAGE 116

105 Appendix B (continued) Local Best Fit Contrast Enhancement Dim source%, dest%, minima%, maxima%, diff%, floor%, scaled% Dim docInfo As IPDOCINFO, scaleVal As Single Check image class and scaling ret = IpDocGet(GETDOCINFO, DOCSEL_ACTIVE, docInfo) Select Case docInfo.Class Case IMC_GRAY, IMC_RGB scaleVal = 255.0 Case IMC_GRAY12, IMC_RGB36 scaleVal = 4095.0 Case IMC_GRAY16, IMC_RGB48 scaleVal = 65535.0 Case Else Not supported! Beep ret = IpMacroStop("Image type not supported!", vbOK) Exit Sub End Select Create working images ret = IpDocGet(GETACTDOC, DOCSEL_ACTIVE, source) dest = IpWsDuplicate() minima = IpWsDuplicate() maxima = IpWsDuplicate() Smoothed minima ret = IpAppSelectDoc(minima) ret = IpFltErode(MORPHO_7x7OCTAGON, 3) ret = IpFltGauss(7, 10, 3*2) Smoothed maxima ret = IpAppSelectDoc(maxima) ret = IpFltDilate(MORPHO_7x7OCTAGON, 3) ret = IpFltGauss(7, 10, 3*2) Difference (local contrast scale) diff = IpOpImageArithmetics(minima, 0.0, OPA_SUB, 1) ret = IpAppSelectDoc(dest) ret = IpOpImageArithmetics(minima, 0.0, OPA_SUB, 0) ret = IpOpImageArithmetics( diff, scaleVal, OPA_DIV, 0)

PAGE 117

106 Appendix B (continued) Clean up ret = IpAppSelectDoc(minima) ret = IpDocClose() ret = IpAppSelectDoc(maxima) ret = IpDocClose() ret = IpAppSelectDoc(diff) ret = IpDocClose() Average with image after enhancement ret = IpOpImageArithmetics(source, 0.0, OPA_AVG, 0) Application of Variance Filter ret = IpTemplateMode(0) ret = IpWsDuplicate() ret = IpFltVariance(7, 7) ret = IpDocCloseEx(1) Average with EDF TestStrip sequence ret = IpTemplateMode(0) ret = IpAppSelectDoc(18) ret = IpDocClose() ret = IpAppSelectDoc(19) ret = IpOpImageArithmetics(2, 0.0, OPA_AVG, 0) ret = IpOpShow(0) Convert image to grayscale 8 ret = IpTemplateMode(0) ret = IpAoiShow(FRAME_NONE) ret = IpWsConvertImage(IMC_GRAY, CONV_SCALE, 0, 0, 0, 0) ret = IpHstEqualize(EQ_BESTFIT) User selects folder where to save image DO NOT SAVE IN THE SAME FOLDER WHERE ORIGINAL FILES ARE STORED!!!!! ret= IpStAutoName(savefol + "###.SEQ", X, IName) ret= IpWsSaveAs(IName, "SEQ") ret = IpAppCloseAll() Else Debug.Print "Error load ing "; gDirStart + fName End If

PAGE 118

107 Appendix B (continued) Get the next file name fName = Dir() Wend ret = IpMacroStop("All images in fold er have been processed.", MS_MODAL) End Sub This Macro: Opens EDF Test Strips from a folder in succesive order, Uses the Count/Measure tool to filter by area and min caliper. Sub Sort_GSIs() ret = IpMacroStop ("This m acro starts a new session.", 0) Dim IName As String*255 Dim fName As String Dim workStr As String Dim savefol2 As String Dim docID As Integer Dim X As Integer Initialize X X = 0 Select a folder where to store the outputs savefol2 = GetFilePath("SortedGSIs", "", "C :\", "Select a folder where to store sorted Gray Scale Images", 2) Creating starting point If gDirStart = "" Then gDirStart = "C:\" End If Get a file name from a folder workStr = GetFilePath("", "SEQ", gDirStar t, "Specify a folder where to find EDF Test Strips", 0) Check if the user did not cancel If workStr = "" Then Exit Sub

PAGE 119

108 Appendix B (continued) End If Close all open images prior processing ret = IpAppCloseAll() Extract the folder name from the full file name gDirStart = Left(workS tr, InStrRev(workStr, "\")) Clear the output for work purposes debugclear ret = IpOutputClear() Select Calibration for 4x Objective Lens ret = IpSCalSelect("4x_065") ret = IpTemplateMode(1) fName = Dir(gDirStart + "*.SEQ", 32) ret = IpMacroStop ("Explore any Test Strip from the group. Se lect the best frame where particles outlines are well defined.",0) Opening an EDF Test Strip for observation ret = IpWsLoad(gDirStart, "SEQ") Determine Frame number to extract for all the Test Strips within the folder Dim gnFrame As Long Set up initial values gnFrame = 2 Begin Dialog UserDialog 320,112,"Sel ect frame number to extract." Text 40,21,90,14,"Frame number",.Frame TextBox 140,14,90,21,.nFrame OKButton 80,84,90,21 End Dialog Dim dlg3 As UserDialog Apply to dialog dlg3.nFrame = Str(gnFrame) Get user values Dialog dlg3

PAGE 120

109 Appendix B (continued) Get back from dialog gnFrame = Val(dlg3.nFrame) 1 ret = IpSeqExtractFrames(gnFrame, 1) Determine Intensity range manually Dim gnInte As Long 'ret = IpBlbShow(1) ret = IpSegShow(1) ret = IpSegSetAttr(SETCURSEL, 0) ret = IpSegSetAttr(CHANNEL, 0) ret = IpSegPreview(CURRENT_C_T) Set up initial values gnInte = 123 Begin Dialog UserDialog 320,112,"Manua l Selection of Intensity Range." Text 40,21,90,14,"Select a va lue for intensity",.Inte TextBox 140,14,90,21,.nInte OKButton 80,84,90,21 End Dialog Dim dlg4 As UserDialog Apply to dialog dlg4.nInte = Str(gnInte) Get user values Dialog dlg4 Get back from dialog gnInte = Val(dlg4.nInte) ret = IpTemplateMode(0) ret = IpAppCloseAll() While fName <> "" X = X + 1 Print out the file name and its attributes Debug.Print GetAttr(gDirStart + fName); "; fName Load the image sequence

PAGE 121

110 Appendix B (continued) docID = IpSeqOpen(gDirStart + fName, "SEQ",0,16) Start routine If docID >= 0 Then Extract frame of interest ret = IpSeqExtractFrames(gnFrame, 1) Measuring and sorting ret = IpTemplateMode(0) Select Calibration for 4x Objective Lens ret = IpSCalSelect("4x_065") ret = IpBlbSetAttr(BLOB_MEASUREOBJECTS, 1) Apply Filter Ranges ret = IpBlbSetAttr(BLOB_FILTEROBJECTS, 1) Do accumulate count ret = IpBlbSetAttr(BLOB_ADDCOUNT, 0) Reset for no measurements ret = IpBlbEnableMeas(BLBM_ALL, 0) Measure Min Feret ret = IpBlbEnableMeas(BLBM_MINCALIP, 1) Measure Area ret = IpBlbEnableMeas(BLBM_AREA, 1) Count range for partilcles (obtaine d from the manual intensity selection) ret = IpBlbSetAttr(BLOB_AUTORANGE, 0) ret = IpSegSetRange(-1, 0, gnInte) Apply smoothing ret = IpBlbSetAttr(BLOB_SMOOTHING,2) Apply 8-connected objects ret = IpBlbSetAttr(BLOB_8CONNECT,1) Fill holes ret = IpBlbSetAttr(BLOB_FILLHOLES,0) ret = IpBlbSetAttr(BLOB_MINAREA,1) ret = IpBlbSetAttr(BLOB_CLEANBORDER,1) ret = IpSortAttr(SORT_LABELS, 0) Measure Min Feret ret = IpBlbEnableMeas(BLBM_MINCALIP, 1) Measure Area ret = IpBlbEnableMeas(BLBM_AREA, 1) Filter that excludes particles outside the range 75
PAGE 122

111 Appendix B (continued) ret = IpBlbSetFilter Range (BLBM_AREA, 1500, 1000000) Count ret = IpBlbCount() Sort by Area ret = IpSortAttr(SORT_AUTO, 1) ret = IpSortAttr(SORT_LABELS, 0) ret = IpSortAttr(SORT_COLOR, 0) ret = IpSortAttr(SORT_INDEX, 255) ret = IpSortAttr(SORT_MEAS, 10) ret = IpSortAttr(SORT_ROTATE, 1) ret = IpSortObjects() 'User selected folder where to save image 'DO NOT SAVE IN THE SAME FOLDER WHERE ORIGINAL FILES ARE STORED!!!!! ret= IpStAutoName(savefol2 + "###.BMP", X, IName) ret= IpWsSaveAs(IName, "BMP") ret = IpAppCloseAll() Else Debug.Print "Error load ing "; gDirStart + fName End If Get the next file name fName = Dir() Wend ret = IpMacroStop("All images in directory processed.", MS_MODAL) End Sub This Macro: Opens sorted GSI's and lets the operator get rid of spots and defected shapes Sub EditGSIs() ret = IpMacroStop ("This macro will help you edit GSIs before starting the process of measuring and counting.", 0) Dim IName As String*255 Dim fName As String Dim workStr As String

PAGE 123

112 Appendix B (continued) Dim savefol2 As String Dim docID As Integer Dim F As Integer Dim B As Integer Initialize X Dim X As Integer Dim gnFrame1 As Long Select a folder where to store the outputs savefol2 = GetFilePath("EdGSIs", "", "C:\", "Select a folder where to store edited images", 2) Set up initial values gnFrame1 = 000 Begin Dialog UserDialog 520,112,"What is th e number of the last image saved?" Text 40,21,90,14,"Image number",.Frame1 TextBox 140,14,90,21,.nFrame1 OKButton 80,84,90,21 End Dialog Dim dlg31 As UserDialog Apply to dialog dlg31.nFrame1 = Str(gnFrame1) Get user values Dialog dlg31 Get back from dialog gnFrame1 = Val(dlg31.nFrame1) X = gnFrame1 Creating starting point If gDirStart = "" Then gDirStart = "C:\" End If Get a file name from a folder workStr = GetFilePath("", "BMP", gDirStar t, "Specify a folder where to find the sorted GSIs", 0)

PAGE 124

113 Appendix B (continued) Check if the user did not cancel If workStr = "" Then Exit Sub End If Close all open images prior processing ret = IpAppCloseAll() Extract the folder name from the full file name gDirStart = Left(workS tr, InStrRev(workStr, "\")) Clear the output for work purposes debugclear ret = IpOutputClear() Select Calibration for 4x Objective Lens ret = IpSCalSelect("4x_065") ret = IpTemplateMode(0) fName = Dir(gDirStart + "*.BMP", 32) Opening an EDF Test Strip for observation ret = IpWsLoad(gDirStart, "SEQ") While fName <> "" ret = IpTemplateMode (1) ret = IpWsLoad(gDirStart + fName, "BMP") ret = IpMacroStop ("If this image pres ents undesirable areas that can be filled, select them as AOIs.", 0) 'ret = IpAoiCreateIrregular(Pts(0), 7) ret = IpMacroStop ("Click conti nue to go to the next step", 0) B = IpMacroStop ("Do you want to fill AOIs with white?",MS_MODAL + MS_YESNO + MS_QUEST) If B = 1 Then ret = IpWsFill(0,2,0) ret = IpAoiShow(FRAME_RESET) ret = IpAoiShow(FRAME_NONE) ret = IpAoiMultAppend(0)

PAGE 125

114 Appendix B (continued) ret = IpAoiMultShow(0) Else End If F = IpMacroStop ("Click on YES to save and open next image.", MS_MODAL + MS_YESNO) ret = IpTemplateMode(0) If F = 1 Then X = X + 1 'User selected folder where to save image 'DO NOT SAVE IN THE SAME FOLDER WHERE ORIGINAL FILES ARE STORED!!!!! ret = IpTemplateMode (1) ret = IpStAutoName(savefol 2 + "###.BMP", X, IName) ret = IpWsSaveAs(IName, "BMP") ret = IpAppCloseAll() Else Exit Sub End If ret = IpTemplateMode (0) Get the next file name fName = Dir() Wend ret = IpMacroStop("All images in directory processed.", MS_MODAL) End Sub This Macro: Opens one by one all edited GS I's in a folder, counts and measures all particle shapes found in each image, save s all data calculated as a text file (DATA.TXT) within folder Sub MakeBINI_C_M() Scan through and process all files in a folder

PAGE 126

115 Appendix B (continued) ret = IpMacroStop ("This macro will open all binary images within a folder and will count, measure and sort all particles found. Im portant: Make sure al l BINIs have been audited before applying this macro.", 0) Dim IName As String*255 Dim fName As String Dim workStr As String Dim docID As Integer Dim savefol2 As String Dim X As Integer X = 0 Creating starting point If gDirStart = "" Then gDirStart = "C:\" End If Select a folder where to store the outputs savefol2 = GetFilePath("SORTED_BIN", "", "C:\", "Select a folder where to store binary images with edited particles", 2) Get a file name from a folder workStr = GetFilePath("", "BMP", gDirStar t, "Specify a folder where to find the edited GSIs", 0) Check that user did not cancel If workStr = "" Then Exit Sub End If Close all open images prior to processing ret = IpAppCloseAll() Extract the directory name from the full file name gDirStart = Left(workS tr, InStrRev(workStr, "\")) Clear the output for work purposes debugclear ret = IpOutputClear() 'Select Calibration For 4x Objective Lens ret = IpSCalSelect("4x_065")

PAGE 127

116 Appendix B (continued) ret = IpTemplateMode(0) fName = Dir(gDirStart + "*.BMP", 32) While fName <> "" X = X + 1 Print out the file name and its attributes Debug.Print GetAttr(gDirStart + fName); "; fName Load the image sequence docID = IpWsLoad(gDirStart + fName, "BMP") Start routine If docID >= 0 Then ret = IpTemplateMode(0) Selecting Spatial Calibration ret = IpSCalSelect("4x_065") ret = IpSCalShowEx(SCA L_DLG_SELECT, SCAL_HIDE) Start Count/Size Process 'ret = IpBlbShow(1) ret = IpBlbSetAttr(BLOB_AUTORANGE, 1) ret = IpBlbSetAttr(BLOB_BRIGHTOBJ, 0) ret = IpBlbSetAttr(BLOB_ADDCOUNT, 0) ret = IpBlbSetAttr(BLOB_MEASUREOBJECTS, 1) ret = IpBlbSetAttr(BLOB_FILTEROBJECTS, 1) ret = IpBlbSetAttr(BLOB_8CONNECT,1) ret = IpBlbSetAttr(BLOB_MINAREA,0) ret = IpBlbSetAttr(BLOB_CLEANBORDER,1) ret = IpBlbSetAttr(BLOB_FILLHOLES, 1) ret = IpBlbSetAttr(BLOB_LABELMODE, 1) Reset for no measurements ret = IpBlbEnableMeas(BLBM_ALL, 0) Feret(min): Smallest caliper(feret) length ret = IpBlbEnableMeas(BLBM_MINCALIP, 1) Area of particle ret = IpBlbEnableMeas(BLBM_AREA, 1) Filter that excludes particles outside the range 75
PAGE 128

117 Appendix B (continued) ret = IpBlbSetFilterRange( BLBM_MINCALIP, 50, 3000) ret = IpBlbSetFilter Range (BLBM_AREA, 1500, 1000000) ret = IpBlbUpdate(0) ret = IpBlbCount() 'Create a Mask ret = IpBlbCreateMask() ret = IpBlbSetAttr(BLOB_AUTORANGE, 1) ret = IpBlbSetAttr(BLOB_BRIGHTOBJ, 1) ***MEASUREMENTS** Reset for no measurements ret = IpBlbEnableMeas(BLBM_ALL, 0) Perimeter: Length of particle's outline. ret = IpBlbEnableMeas(BLBM_PERIMETER, 1) Area of particle ret = IpBlbEnableMeas(BLBM_AREA, 1) Roundness: Perieter^2/ (4*pi*Area). ret = IpBlbEnableMeas(BLBM_ROUNDNESS, 1) Perimeter(ellipse): Perimeter of the equivalent ellipse ret = IpBlbEnableMeas(BLBM_PELLIPSE, 1) Perimeter(convex): Perimeter of the convex outline of the particle ret = IpBlbEnableMeas(BLBM_PCONVEX, 1) Fractal dimension of the particle's outline ret = IpBlbEnableMeas(BLBM_FRACTDIM, 1) Axis(major): Length of major axis of ellipse with same moments of order 1 and 2 as particle ret = IpBlbEnableMeas(BLBM_MAJORAX, 1) Axis(minor): Length of major axis of ellipse with same moments of order 1 and 2 as particle ret = IpBlbEnableMeas(BLBM_MINORAX, 1) Aspect: Ratio between major axis and minor axis of ellipse equivalent to particle ret = IpBlbEnableMeas(BLBM_ASPECT, 1) Diameter(max): Length of longest line joining two points of object's outline and passing through the centroid ret = IpBlbEnableMeas(BLBM_MAXFERRET, 1) Diameter(min): Length of shortest lin e joining two points of object's outline and passing through the centroid ret = IpBlbEnableMeas(BLBM_MINFERRET, 1)

PAGE 129

118 Appendix B (continued) Diameter (mean): Average length of diam eters measured at 2 degress intervals and passing through particle's centroid ret = IpBlbEnableMea s(BLBM_MEANFERRET, 1) Feret(max): Longest caliper(feret) length ret = IpBlbEnableMeas(BLBM_MAXCALIP, 1) Feret(min): Smallest caliper(feret) length ret = IpBlbEnableMeas(BLBM_MINCALIP, 1) Feret(mean): Average caliper(fert) length ret = IpBlbEnableMeas(BLBM_MEANCALIP, 1) Radius(max): Maximumdistance betw een particle's centroid and outline ret = IpBlbEnableMeas(BLBM_MAXRADIUS, 1) Radius (min): Minimumdistance be tween particle's centroid and outline ret = IpBlbEnableMeas(BLBM_MINRADIUS, 1) Radius Ratio: Ratio between Max. Radius and Min. Radius ret = IpBlbEnableMeas(BLBM_RADIUSRATIO, 1) Filter that excludes particles outside the range 50
PAGE 130

119 Appendix B (continued) 'User selected folder where to save image 'DO NOT SAVE IN THE SAME FOLDER WHERE ORIGINAL FILES ARE STORED!!!!! ret= IpStAutoName(savefol2 + "###.BMP", X, IName) ret= IpWsSaveAs(IName, "BMP") ret = IpAppCloseAll() Else Debug.Print "Error load ing "; gDirStart + fName End If Get the next file name fName = Dir() Wend ret = IpMacroStop("All images in fold er have been processed.", MS_MODAL) End Sub

PAGE 131

120 Appendix C. Source Code for the Script File Mult2DShape10x Option Explicit Global directory starting string, fo r saving where we last processed Dim gDirStart As String This Macro: Helps the operator to generate sets of images at different focal planes Sub Acquisition() ret = IpMacroStop ("Place the sample on the microscope stage. Locate a group of sand particles using the Preview screen and start acquiring image sets.",0) ret = IpTemplateMode(0) ret = IpAcqShow(ACQ_SNAP,1) ret = IpAcqShow(ACQ_LIVE, 1) IpArray(0) = 0 'left IpArray(1) = 0 'top IpArray(2) = 1391 'right IpArray(3) = 1039 'bottom ret = IpAcqControl(88, 1, IpArra y(0)) ACQCMD_AUTOEXPOSURE ret = IpTemplateMode(0) ret = IpScopeShow(1) ret = IpMacroStop ("Select a setting according to curre nt objective magnification. Set Top and Bottom limits and click on Acqui re. Save all files as SEQUENCES.",0) End Sub This Macro: Automatically opens imag e sequences one by one. Then it deconvolves each sequence, creates an EDF Test Stri p, applies a Local Best Fit Contrast Enhancement routine, Applies a Varian ce Filter and then saves edge enhanced images Sub EnhanceEdges() Scan through and process all files in a directory Dim IName As String*255 Dim fName As String Dim workStr As String Dim savefol As String Dim docID As Integer Dim X As Integer X = 0

PAGE 132

121 Appendix C (continued) 'Operator selects a folder where to store enhanced images savefol = GetFilePath("EDFts", "", "C:\", "Select a file where to store enhanced images", 2) Creating starting point If gDirStart = "" Then gDirStart = "C:\" End If Get a file name in the desired directory workStr = GetFilePath("", "SEQ", gDirStar t, "Specify a folder where to find image sequences", 0) Check if user did not cancel If workStr = "" Then Exit Sub End If Close all open images prior to processing ret = IpAppCloseAll() Extract the directory name from the full file name gDirStart = Left(workS tr, InStrRev(workStr, "\")) Clear the output for work purposes debugclear ret = IpOutputClear() Select Calibration for 10x Objective Lens ret = IpSCalSelect("10x_065") ret = IpTemplateMode(0) fName = Dir(gDirStart + "*.SEQ", 32) While fName <> "" X = X + 1 Print out the file name and its attributes Debug.Print GetAttr(gDi rStart + fName); "; fName Load the image sequence docID = IpSeqOpen(gDirStart + fName, "SEQ",0,15)

PAGE 133

122 Appendix C (continued) ret = IpSMShowNav(SM_HIDE) ret = IpTemplateMode(0) ret = IpWsConvertImage(IMC_GRAY, CONV_SCALE, 0, 0, 0, 0) ret = IpDocCloseEx(0) Start routine If docID >= 0 Then ret = IpTemplateMode(0) Deconvolution using SharpStack for 10X Objective Lens parameters ret = IpDcnvShow(0) ret = IpLensApply("10x_065", APPLYTO_IMAGE) ret = IpSCalSetLong(SCAL_C URRENT_CAL, SCAL_APPLY, 0) ret = IpDCnvSet(DCNV_TYPE, DCTYPE_INVERSE) ret = IpDCnvSetSng(DCNV_NA, 0.250000) ret = IpDCnvSetSng(DCNV_RI, 1.000000) ret = IpDCnvSetSng(DCNV_WL, 775.000000) ret = IpDCnvSetSng(DCNV_XSPACING, 0.714286) ret = IpDCnvSetSng(DCNV_YSPACING, 0.714286) ret = IpDCnvSetSng(DCNV_ZSPACING, 1.5000000) ret = IpDCnvSet(DCNV_BRIGHTFIELD, 0) ret = IpDCnvSet(DCNV_PHASEOBJECTS, 0) ret = IpDCnvSet(DCNV_NEIGHBORSPACING, 1) ret = IpDCnvSet(DCNV_HAZEREMOVAL, 10) ret = IpDCnvSet(DCNV_USEACTIVEPORTION, 0) ret = IpDCnvSet(DCNV_CONVERTTOFLOAT, 0) ret = IpDCnvSet(DCNV_SPHERICALABERRATION, -9) ret = IpDCnvDeconvolve ret = IpDCnvShow(0) Filtering EDF(Extended Depth of Field Test Strip) ret = IpTemplateMode(0) Dim nNorm%, nCriteria%, nOrder% Dim sNorm(0 To 1) As String, valNorm(0 To 1) As Integer Dim sCriteria(0 To 3) As Stri ng, valCriteria(0 To 3) As Integer Dim sOrder(0 To 1) As Stri ng, valOrder(0 To 1) As Integer Dim nSeries%, nEDF%, nFrames% Dim textStr As String Set source to the current document? ret = IpEDFRemove(DOCSEL_ALL)

PAGE 134

123 Appendix C (continued) ret = IpEDFNew(1) Set values and strings for the various parameters valNorm(0) = 0 sNorm(0) = "Not Normalized" valNorm(1) = 1 sNorm(1) = "Normalized" valCriteria(0) = EDF_MAX_LOCALCONTRAST sCriteria(0) = "Local Contrast" valCriteria(1) = EDF_MAX_DEPTHCONTRAST sCriteria(1) = "Depth Contrast" valCriteria(2) = EDF_MAX_INTENSITY sCriteria(2) = "Maxmimum" valCriteria(3) = EDF_MIN_INTENSITY sCriteria(3) = "Minimum" valOrder(0) = EDF_TOPDOWN sOrder(0) = "Top Down" valOrder(1) = EDF_BOTTOMUP sOrder(1) = "Bottom Up" Initialize value for series nSeries = -1 Loop through the various criteria Various criteria For nCriteria = 0 To 3 Various orders For nOrder = 0 To 1 Normalize or not For nNorm = 0 To 1 Set parameters and create the EDF ret = IpEDFSet(EDF_NORMALIZE, valNorm(nNorm), 0) ret = IpEDFSet(EDF_CRITERIA valCriteria(nCriteria), 0) ret = IpEDFSet(EDF_ORDER, valOrder(nOrder), 0) ret = IpEDFCreate(EDF_COMPOSITE) ret = IpDocGet(GETACTDOC, 0, nEDF) Write description onto images textStr = sCriteria(nCriteria) + Chr$(10)

PAGE 135

124 Appendix C (continued) textStr = textStr + sNorm(nNorm) + Chr$(10) textStr = textStr + sOrder(nOrder) ret = IpAnCreateObj(GO_OBJ_TEXT) ret = IpAnMove(0, 20, 20) ret = IpAnText(textStr) ret = IpAnSet(GO_ATTR_ZOOM, 0) ret = IpAnSet(GO_ATTR_RECTSTYLE, GO_RECTSTYLE_NOBORDER_FILL) ret = IpAnSet(GO_ATTR_TEXTAUTOSIZE, 1) ret = IpAnSet(GO_ATTR_FONTBOLD, 700) ret = IpAnSet(GO_ATTR_BRUSHCOLOR, 12632256) ret = IpAnSet(GO_ATTR_TEXTCOLOR, 0) ret = IpAnBurn() Add to the series If nSeries < 0 Then Set series to this image nSeries = nEDF Else Or append EDF to the accumulated series ret = IpAppSelectDoc(nEDF) ret = IpWsCopyFrames(0,1) ret = IpAppSelectDoc(nSeries) ret = IpWsPasteFrames(-1) Set to the last frame of the series ret = IpSeqGet(SEQ_NUMFRAMES, nFrames) ret = IpSeqSet(SEQ_ACTIVEFRAME, nFrames-1) Clean up the EDF ret = IpAppSelectDoc(nEDF) ret = IpDocClose() End If Next nNorm Next nOrder Next nCriteria Delete previous sequences ret = IpDocCloseEx(1)

PAGE 136

125 Appendix C (continued) ret = IpDocCloseEx(2) Further Image enhancement Local Best Fit Contrast Enhancement Dim source%, dest%, minima%, maxima%, diff%, floor%, scaled% Dim docInfo As IPDOCINFO, scaleVal As Single Check image class and scaling ret = IpDocGet(GETDOCINFO, DOCSEL_ACTIVE, docInfo) Select Case docInfo.Class Case IMC_GRAY, IMC_RGB scaleVal = 255.0 Case IMC_GRAY12, IMC_RGB36 scaleVal = 4095.0 Case IMC_GRAY16, IMC_RGB48 scaleVal = 65535.0 Case Else Not supported! Beep ret = IpMacroStop("Image type not supported!", vbOK) Exit Sub End Select Create working images ret = IpDocGet(GETACTDOC, DOCSEL_ACTIVE, source) dest = IpWsDuplicate() minima = IpWsDuplicate() maxima = IpWsDuplicate() Smoothed minima ret = IpAppSelectDoc(minima) ret = IpFltErode(MORPHO_7x7OCTAGON, 3) ret = IpFltGauss(7, 10, 3*2) Smoothed maxima ret = IpAppSelectDoc(maxima) ret = IpFltDilate(MORPHO_7x7OCTAGON, 3) ret = IpFltGauss(7, 10, 3*2) Difference (local contrast scale) diff = IpOpImageArithmetics(minima, 0.0, OPA_SUB, 1)

PAGE 137

126 Appendix C (continued) ret = IpAppSelectDoc(dest) ret = IpOpImageArithmetics(minima, 0.0, OPA_SUB, 0) ret = IpOpImageArithmetics( diff, scaleVal, OPA_DIV, 0) Clean up ret = IpAppSelectDoc(minima) ret = IpDocClose() ret = IpAppSelectDoc(maxima) ret = IpDocClose() ret = IpAppSelectDoc(diff) ret = IpDocClose() Average with image after enhancement ret = IpOpImageArithmetics(source, 0.0, OPA_AVG, 0) Application of Variance Filter ret = IpTemplateMode(0) ret = IpWsDuplicate() ret = IpFltVariance(7, 7) ret = IpDocCloseEx(1) Average with EDF TestStrip sequence ret = IpTemplateMode(0) ret = IpAppSelectDoc(18) ret = IpDocClose() ret = IpAppSelectDoc(19) ret = IpOpImageArithmetics(2, 0.0, OPA_AVG, 0) ret = IpOpShow(0) Convert image to grayscale 8 ret = IpTemplateMode(0) ret = IpAoiShow(FRAME_NONE) ret = IpWsConvertImage(IMC_GRAY, CONV_SCALE, 0, 0, 0, 0) ret = IpHstEqualize(EQ_BESTFIT) User selects folder where to save image DO NOT SAVE IN THE SAME FOLDER WHERE ORIGINAL FILES ARE STORED!!!!! ret= IpStAutoName(savefol + "###.SEQ", X, IName) ret= IpWsSaveAs(IName, "SEQ") ret = IpAppCloseAll()

PAGE 138

127 Appendix C (continued) Else Debug.Print "Error lo ading "; gDirStart + fName End If Get the next file name fName = Dir() Wend ret = IpMacroStop("All images in fold er have been processed.", MS_MODAL) End Sub This Macro: Opens EDF Test Strips from a folder in succesive order, Uses the Count/Measure tool to filter by area and min caliper. Sub Sort_GSIs() ret = IpMacroStop ("This m acro starts a new session.", 0) Dim IName As String*255 Dim fName As String Dim workStr As String Dim savefol2 As String Dim docID As Integer Dim X As Integer Initialize X X = 0 Select a folder where to store the outputs savefol2 = GetFilePath("SortedGSIs", "", "C :\", "Select a folder where to store sorted Gray Scale Images", 2) Creating starting point If gDirStart = "" Then gDirStart = "C:\" End If Get a file name from a folder workStr = GetFilePath("", "SEQ", gDirStar t, "Specify a folder where to find EDF Test Strips", 0)

PAGE 139

128 Appendix C (continued) Check if the user did not cancel If workStr = "" Then Exit Sub End If Close all open images prior processing ret = IpAppCloseAll() Extract the folder name from the full file name gDirStart = Left(workS tr, InStrRev(workStr, "\")) Clear the output for work purposes debugclear ret = IpOutputClear() Select Calibration for 10x Objective Lens ret = IpSCalSelect("10x_065") ret = IpTemplateMode(1) fName = Dir(gDirStart + "*.SEQ", 32) ret = IpMacroStop ("Explore any Test Strip from the group. Se lect the best frame where particles outlines are well defined.",0) 'ret = IpTemplateMode(1) Opening an EDF Test Strip for observation ret = IpWsLoad(gDirStart, "SEQ") Determine Frame number to extract for all the Test Strips within the folder Dim gnFrame As Long Set up initial values gnFrame = 2 Begin Dialog UserDialog 320,112,"Sel ect frame number to extract." Text 40,21,90,14,"Frame number",.Frame TextBox 140,14,90,21,.nFrame OKButton 80,84,90,21 End Dialog Dim dlg3 As UserDialog Apply to dialog dlg3.nFrame = Str(gnFrame)

PAGE 140

129 Appendix C (continued) Get user values Dialog dlg3 Get back from dialog gnFrame = Val(dlg3.nFrame) 1 ret = IpSeqExtractFrames(gnFrame, 1) Determine Intensity range manually Dim gnInte As Long 'ret = IpBlbShow(1) ret = IpSegShow(1) ret = IpSegSetAttr(SETCURSEL, 0) ret = IpSegSetAttr(CHANNEL, 0) ret = IpSegPreview(CURRENT_C_T) Set up initial values gnInte = 123 Begin Dialog UserDialog 320,112,"Manua l Selection of Intensity Range." Text 40,21,90,14,"Select a va lue for intensity",.Inte TextBox 140,14,90,21,.nInte OKButton 80,84,90,21 End Dialog Dim dlg4 As UserDialog Apply to dialog dlg4.nInte = Str(gnInte) Get user values Dialog dlg4 Get back from dialog gnInte = Val(dlg4.nInte) ret = IpTemplateMode(0) ret = IpAppCloseAll() While fName <> "" X = X + 1 Print out the file name and its attributes Debug.Print GetAttr(gDirStart + fName); "; fName

PAGE 141

130 Appendix C (continued) Load the image sequence docID = IpSeqOpen(gDirStart + fName, "SEQ",0,16) Start routine If docID >= 0 Then Extract frame of interest ret = IpSeqExtractFrames(gnFrame, 1) Converting to binary ret = IpTemplateMode(0) Select Calibration for 10x Objective Lens ret = IpSCalSelect("10x_065") ret = IpBlbSetAttr(BLOB_MEASUREOBJECTS, 1) Apply Filter Ranges ret = IpBlbSetAttr(BLOB_FILTEROBJECTS, 1) Do accumulate count ret = IpBlbSetAttr(BLOB_ADDCOUNT, 0) Reset for no measurements ret = IpBlbEnableMeas(BLBM_ALL, 0) Measure Min Feret ret = IpBlbEnableMeas(BLBM_MINCALIP, 1) Measure Area ret = IpBlbEnableMeas(BLBM_AREA, 1) Count range for partilcles (obtaine d from the manual intensity selection) ret = IpBlbSetAttr(BLOB_AUTORANGE, 0) ret = IpSegSetRange(-1, 0, gnInte) Apply smoothing ret = IpBlbSetAttr(BLOB_SMOOTHING,1) Apply 8-connected objects ret = IpBlbSetAttr(BLOB_8CONNECT,1) Fill holes ret = IpBlbSetAttr(BLOB_FILLHOLES,0) ret = IpBlbSetAttr(BLOB_MINAREA,1) ret = IpBlbSetAttr(BLOB_CLEANBORDER,1) ret = IpSortAttr(SORT_LABELS, 0) Count ret = IpBlbCount() Measure Min Feret ret = IpBlbEnableMeas(BLBM_MINCALIP, 1) Measure Area ret = IpBlbEnableMeas(BLBM_AREA, 1)

PAGE 142

131 Appendix C (continued) Filter that excludes particles outside the range 50
PAGE 143

132 Appendix C (continued) Get the next file name fName = Dir() Wend ret = IpMacroStop("All images in directory processed.", MS_MODAL) End Sub This Macro: Opens sorted GSI's and lets the operator get rid of spots and defected shapes Sub EditGSIs() ret = IpMacroStop ("This macro will help you edit GSIs before starting the process of measuring and counting.", 0) Dim IName As String*255 Dim fName As String Dim workStr As String Dim savefol2 As String Dim docID As Integer Dim F As Integer Dim B As Integer Dim X As Integer Initialize X Dim gnFrame1 As Long Select a folder where to store the outputs savefol2 = GetFilePath("EdGSIs", "", "C:\", "Select a folder where to store edited images", 2) Set up initial values gnFrame1 = 000 Begin Dialog UserDialog 520,112,"What is th e number of the last image saved?" Text 40,21,90,14,"Image number",.Frame1 TextBox 140,14,90,21,.nFrame1 OKButton 80,84,90,21 End Dialog Dim dlg31 As UserDialog Apply to dialog

PAGE 144

133 Appendix C (continued) dlg31.nFrame1 = Str(gnFrame1) Get user values Dialog dlg31 Get back from dialog gnFrame1 = Val(dlg31.nFrame1) X = gnFrame1 Creating starting point If gDirStart = "" Then gDirStart = "C:\" End If Get a file name from a folder workStr = GetFilePath("", "BMP", gDirStar t, "Specify a folder where to find the sorted GSIs", 0) Check if the user did not cancel If workStr = "" Then Exit Sub End If Close all open images prior processing ret = IpAppCloseAll() Extract the folder name from the full file name gDirStart = Left(workS tr, InStrRev(workStr, "\")) Clear the output for work purposes debugclear ret = IpOutputClear() Select Calibration for 10x Objective Lens ret = IpSCalSelect("10x_065") ret = IpTemplateMode(0) fName = Dir(gDirStart + "*.BMP", 32) Opening an EDF Test Strip for observation ret = IpWsLoad(gDirStart, "SEQ")

PAGE 145

134 Appendix C (continued) While fName <> "" ret = IpTemplateMode (1) ret = IpWsLoad(gDirStart + fName, "BMP") ret = IpMacroStop ("If this image pres ents undesirable areas that can be filled, select them as AOIs.", 0) ret = IpMacroStop ("Click conti nue to go to the next step", 0) B = IpMacroStop ("Do you want to fill AOIs with white?",MS_MODAL + MS_YESNO + MS_QUEST) If B = 1 Then ret = IpWsFill(0,2,0) ret = IpAoiShow(FRAME_RESET) ret = IpAoiShow(FRAME_NONE) ret = IpAoiMultAppend(0) ret = IpAoiMultShow(0) Else End If F = IpMacroStop ("Click on YES to save and open next image.", MS_MODAL + MS_YESNO) ret = IpTemplateMode(0) If F = 1 Then X = X + 1 'User selected folder where to save image 'DO NOT SAVE IN THE SAME FOLDER WHERE ORIGINAL FILES ARE STORED!!!!! ret = IpTemplateMode (1) ret = IpStAutoName(savefol 2 + "###.BMP", X, IName) ret = IpWsSaveAs(IName, "BMP") ret = IpAppCloseAll() Else Exit Sub End If ret = IpTemplateMode (0) Get the next file name

PAGE 146

135 Appendix C (continued) fName = Dir() Wend ret = IpMacroStop("All images in directory processed.", MS_MODAL) End Sub This Macro: Opens one by one all binary im ages in a folder, counts and measures all particle shapes found in each image, save s all data calculated as a text file (DATA.TXT) within folder Sub MakeBINI_C_M() Scan through and process all files in a folder ret = IpMacroStop ("This macro will open all binary images within a folder and will count, measure and sort all particles found. Im portant: Make sure al l BINIs have been audited before applying this macro.", 0) Dim IName As String*255 Dim fName As String Dim workStr As String Dim docID As Integer Dim savefol2 As String Dim X As Integer X = 0 Creating starting point If gDirStart = "" Then gDirStart = "C:\" End If Select a folder where to store the outputs savefol2 = GetFilePath("SORTED_BIN", "", "C:\", "Select a folder where to store binary images with edited particles", 2) Get a file name from a folder workStr = GetFilePath("", "BMP", gDirStar t, "Specify a folder where to find the edited GSIs", 0)

PAGE 147

136 Appendix C (continued) Check that user did not cancel If workStr = "" Then Exit Sub End If Close all open images prior to processing ret = IpAppCloseAll() Extract the directory name from the full file name gDirStart = Left(workS tr, InStrRev(workStr, "\")) Clear the output for work purposes debugclear ret = IpOutputClear() 'Select Calibration For 10x Objective Lens ret = IpSCalSelect("10x_065") ret = IpTemplateMode(0) fName = Dir(gDirStart + "*.BMP", 32) While fName <> "" X = X + 1 Print out the file name and its attributes Debug.Print GetAttr(gDirStart + fName); "; fName Load the image sequence docID = IpWsLoad(gDirStart + fName, "BMP") Start routine If docID >= 0 Then ret = IpTemplateMode(0) Selecting Spatial Calibration ret = IpSCalSelect("10x_065") ret = IpSCalShowEx(SCA L_DLG_SELECT, SCAL_HIDE) Start Count/Size Process 'ret = IpBlbShow(1) ret = IpBlbSetAttr(BLOB_AUTORANGE, 1)

PAGE 148

137 Appendix C (continued) ret = IpBlbSetAttr(BLOB_BRIGHTOBJ, 0) ret = IpBlbSetAttr(BLOB_ADDCOUNT, 0) ret = IpBlbSetAttr(BLOB_MEASUREOBJECTS, 1) ret = IpBlbSetAttr(BLOB_FILTEROBJECTS, 1) ret = IpBlbSetAttr(BLOB_8CONNECT,1) ret = IpBlbSetAttr(BLOB_MINAREA,0) ret = IpBlbSetAttr(BLOB_CLEANBORDER,1) ret = IpBlbSetAttr(BLOB_FILLHOLES, 1) ret = IpBlbSetAttr(BLOB_LABELMODE, 1) ret = IpSortAttr(SORT_ROTATE, 1) Reset for no measurements ret = IpBlbEnableMeas(BLBM_ALL, 0) Feret(min): Smallest caliper(feret) length ret = IpBlbEnableMeas(BLBM_MINCALIP, 1) Area of particle ret = IpBlbEnableMeas(BLBM_AREA, 1) Filter that excludes particles outside the range 50
PAGE 149

138 Appendix C (continued) Axis(major): Length of major axis of ellipse with same moments of order 1 and 2 as particle ret = IpBlbEnableMeas(BLBM_MAJORAX, 1) Axis(minor): Length of major axis of ellipse with same moments of order 1 and 2 as particle ret = IpBlbEnableMeas(BLBM_MINORAX, 1) Aspect: Ratio between major axis and minor axis of ellipse equivalent to particle ret = IpBlbEnableMeas(BLBM_ASPECT, 1) Diameter(max): Length of longest line joining two points of object's outline and passing through the centroid ret = IpBlbEnableMeas(BLBM_MAXFERRET, 1) Diameter(min): Length of shortest lin e joining two points of object's outline and passing through the centroid ret = IpBlbEnableMeas(BLBM_MINFERRET, 1) Diameter (mean): Average length of diameters measured at 2 degress intervals and passing through particle's centroid ret = IpBlbEnableMea s(BLBM_MEANFERRET, 1) Feret(max): Longest caliper(feret) length ret = IpBlbEnableMeas(BLBM_MAXCALIP, 1) Feret(min): Smallest caliper(feret) length ret = IpBlbEnableMeas(BLBM_MINCALIP, 1) Feret(mean): Average caliper(fert) length ret = IpBlbEnableMeas(BLBM_MEANCALIP, 1) Radius(max): Maximumdistance betw een particle's centroid and outline ret = IpBlbEnableMeas(BLBM_MAXRADIUS, 1) Radius (min): Minimumdistance be tween particle's centroid and outline ret = IpBlbEnableMeas(BLBM_MINRADIUS, 1) Radius Ratio: Ratio between Max. Radius and Min. Radius ret = IpBlbEnableMeas(BLBM_RADIUSRATIO, 1) Filter that excludes particles outside the range 50
PAGE 150

139 Appendix C (continued) ret = IpBlbShow(0) Else IpBlbSaveData(savefol2 + "DATA.TXT", S_APPEND+S_Y_AXIS) ret = IpBlbShow(0) End If 'User selected folder where to save image 'DO NOT SAVE IN THE SAME FOLDER WHERE ORIGINAL FILES ARE STORED!!!!! ret= IpStAutoName(savefol2 + "###.BMP", X, IName) ret= IpWsSaveAs(IName, "BMP") ret = IpAppCloseAll() Else Debug.Print "Error load ing "; gDirStart + fName End If Get the next file name fName = Dir() Wend ret = IpMacroStop("All images in fold er have been processed.", MS_MODAL) End Sub

PAGE 151

140 Appendix D. Source Code for the Script File Mult2DShape20x Option Explicit Global directory starting string, fo r saving where we last processed Dim gDirStart As String This Macro: Helps the operator to generate sets of images at different focal planes Sub Acquisition() ret = IpMacroStop ("Place the sample on the microscope stage. Locate a group of sand particles using the Preview screen and start acquiring image sets.",0) ret = IpTemplateMode(0) ret = IpAcqShow(ACQ_SNAP,1) ret = IpAcqShow(ACQ_LIVE, 1) IpArray(0) = 0 'left IpArray(1) = 0 'top IpArray(2) = 1391 'right IpArray(3) = 1039 'bottom ret = IpAcqControl(88, 1, IpArra y(0)) ACQCMD_AUTOEXPOSURE ret = IpTemplateMode(0) ret = IpScopeShow(1) ret = IpMacroStop ("Select a setting according to curre nt objective magnification. Set Top and Bottom limits and click on Acqui re. Save all files as SEQUENCES.",0) End Sub This Macro: Automatically opens imag e sequences one by one. Then it deconvolves each sequence, creates an EDF Test Stri p, applies a Local Best Fit Contrast Enhancement routine, Applies a Varian ce Filter and then saves edge enhanced images Sub EnhanceEdges() Scan through and process all files in a directory Dim IName As String*255 Dim fName As String Dim workStr As String Dim savefol As String Dim docID As Integer Dim X As Integer 'Initialize X X = 0

PAGE 152

141 Appendix D (continued) 'Operator selects a folder where to store enhanced images savefol = GetFilePath("EDFts", "", "C:\", "Select a file where to store enhanced images", 2) Creating starting point If gDirStart = "" Then gDirStart = "C:\" End If Get a file name in the desired directory workStr = GetFilePath("", "SEQ", gDirStar t, "Specify a folder where to find image sequences", 0) Check if user did not cancel If workStr = "" Then Exit Sub End If Close all open images prior to processing ret = IpAppCloseAll() Extract the directory name from the full file name gDirStart = Left(workS tr, InStrRev(workStr, "\")) Clear the output for work purposes debugclear ret = IpOutputClear() Select Calibration for 20x Objective Lens ret = IpSCalSelect("20x_065") ret = IpTemplateMode(0) fName = Dir(gDirStart + "*.SEQ", 32) While fName <> "" X = X + 1 Print out the file name and its attributes Debug.Print GetAttr(gDi rStart + fName); "; fName Load the image sequence docID = IpSeqOpen(gDirStart + fName, "SEQ",0,15)

PAGE 153

142 Appendix D (continued) ret = IpSMShowNav(SM_HIDE) ret = IpTemplateMode(0) ret = IpWsConvertImage(IMC_GRAY, CONV_SCALE, 0, 0, 0, 0) ret = IpDocCloseEx(0) Start routine If docID >= 0 Then ret = IpTemplateMode(0) Deconvolution using SharpStack for 10X Objective Lens parameters ret = IpDcnvShow(0) ret = IpLensApply("20x_065", APPLYTO_IMAGE) ret = IpSCalSetLong(SCAL_C URRENT_CAL, SCAL_APPLY, 0) ret = IpDCnvSet(DCNV_TYPE, DCTYPE_INVERSE) ret = IpDCnvSetSng(DCNV_NA, 0.400000) ret = IpDCnvSetSng(DCNV_RI, 1.000000) ret = IpDCnvSetSng(DCNV_WL, 775.000000) ret = IpDCnvSetSng(DCNV_XSPACING, 0.350877) ret = IpDCnvSetSng(DCNV_YSPACING, 0.350877) ret = IpDCnvSetSng(DCNV_ZSPACING, 1.5000000) ret = IpDCnvSet(DCNV_BRIGHTFIELD, 0) ret = IpDCnvSet(DCNV_PHASEOBJECTS, 0) ret = IpDCnvSet(DCNV_NEIGHBORSPACING, 1) ret = IpDCnvSet(DCNV_HAZEREMOVAL, 10) ret = IpDCnvSet(DCNV_USEACTIVEPORTION, 0) ret = IpDCnvSet(DCNV_CONVERTTOFLOAT, 0) ret = IpDCnvSet(DCNV_SPHERICALABERRATION, -14.6862) ret = IpDCnvDeconvolve ret = IpDCnvShow(0) Filtering EDF(Extended Depth of Field Test Strip) ret = IpTemplateMode(0) Dim nNorm%, nCriteria%, nOrder% Dim sNorm(0 To 1) As String, valNorm(0 To 1) As Integer Dim sCriteria(0 To 3) As Stri ng, valCriteria(0 To 3) As Integer Dim sOrder(0 To 1) As Stri ng, valOrder(0 To 1) As Integer Dim nSeries%, nEDF%, nFrames% Dim textStr As String Set source to the current document? ret = IpEDFRemove(DOCSEL_ALL)

PAGE 154

143 Appendix D (continued) ret = IpEDFNew(1) Set values and strings for the various parameters valNorm(0) = 0 sNorm(0) = "Not Normalized" valNorm(1) = 1 sNorm(1) = "Normalized" valCriteria(0) = EDF_MAX_LOCALCONTRAST sCriteria(0) = "Local Contrast" valCriteria(1) = EDF_MAX_DEPTHCONTRAST sCriteria(1) = "Depth Contrast" valCriteria(2) = EDF_MAX_INTENSITY sCriteria(2) = "Maxmimum" valCriteria(3) = EDF_MIN_INTENSITY sCriteria(3) = "Minimum" valOrder(0) = EDF_TOPDOWN sOrder(0) = "Top Down" valOrder(1) = EDF_BOTTOMUP sOrder(1) = "Bottom Up" Initialize value for series nSeries = -1 Loop through the various criteria Various criteria For nCriteria = 0 To 3 Various orders For nOrder = 0 To 1 Normalize or not For nNorm = 0 To 1 Set parameters and create the EDF ret = IpEDFSet(EDF_NORMALIZE, valNorm(nNorm), 0) ret = IpEDFSet(EDF_CRITERIA valCriteria(nCriteria), 0) ret = IpEDFSet(EDF_ORDER, valOrder(nOrder), 0) ret = IpEDFCreate(EDF_COMPOSITE) ret = IpDocGet(GETACTDOC, 0, nEDF) Write description onto images textStr = sCriteria(nCriteria) + Chr$(10)

PAGE 155

144 Appendix D (continued) textStr = textStr + sNorm(nNorm) + Chr$(10) textStr = textStr + sOrder(nOrder) ret = IpAnCreateObj(GO_OBJ_TEXT) ret = IpAnMove(0, 20, 20) ret = IpAnText(textStr) ret = IpAnSet(GO_ATTR_ZOOM, 0) ret = IpAnSet(GO_ATTR_RECTSTYLE, GO_RECTSTYLE_NOBORDER_FILL) ret = IpAnSet(GO_ATTR_TEXTAUTOSIZE, 1) ret = IpAnSet(GO_ATTR_FONTBOLD, 700) ret = IpAnSet(GO_ATTR_BRUSHCOLOR, 12632256) ret = IpAnSet(GO_ATTR_TEXTCOLOR, 0) ret = IpAnBurn() Add to the series If nSeries < 0 Then Set series to this image nSeries = nEDF Else Or append EDF to the accumulated series ret = IpAppSelectDoc(nEDF) ret = IpWsCopyFrames(0,1) ret = IpAppSelectDoc(nSeries) ret = IpWsPasteFrames(-1) Set to the last frame of the series ret = IpSeqGet(SEQ_NUMFRAMES, nFrames) ret = IpSeqSet(SEQ_ACTIVEFRAME, nFrames-1) Clean up the EDF ret = IpAppSelectDoc(nEDF) ret = IpDocClose() End If Next nNorm Next nOrder Next nCriteria Delete previous sequences ret = IpDocCloseEx(1)

PAGE 156

145 Appendix D (continued) ret = IpDocCloseEx(2) Further Image enhancement Local Best Fit Contrast Enhancement Dim source%, dest%, minima%, maxima%, diff%, floor%, scaled% Dim docInfo As IPDOCINFO, scaleVal As Single Check image class and scaling ret = IpDocGet(GETDOCINFO, DOCSEL_ACTIVE, docInfo) Select Case docInfo.Class Case IMC_GRAY, IMC_RGB scaleVal = 255.0 Case IMC_GRAY12, IMC_RGB36 scaleVal = 4095.0 Case IMC_GRAY16, IMC_RGB48 scaleVal = 65535.0 Case Else Not supported! Beep ret = IpMacroStop("Image type not supported!", vbOK) Exit Sub End Select Create working images ret = IpDocGet(GETACTDOC, DOCSEL_ACTIVE, source) dest = IpWsDuplicate() minima = IpWsDuplicate() maxima = IpWsDuplicate() Smoothed minima ret = IpAppSelectDoc(minima) ret = IpFltErode(MORPHO_7x7OCTAGON, 3) ret = IpFltGauss(7, 10, 3*2) Smoothed maxima ret = IpAppSelectDoc(maxima) ret = IpFltDilate(MORPHO_7x7OCTAGON, 3) ret = IpFltGauss(7, 10, 3*2) Difference (local contrast scale) diff = IpOpImageArithmetics(minima, 0.0, OPA_SUB, 1)

PAGE 157

146 Appendix D (continued) ret = IpAppSelectDoc(dest) ret = IpOpImageArithmetics(minima, 0.0, OPA_SUB, 0) ret = IpOpImageArithmetics( diff, scaleVal, OPA_DIV, 0) Clean up ret = IpAppSelectDoc(minima) ret = IpDocClose() ret = IpAppSelectDoc(maxima) ret = IpDocClose() ret = IpAppSelectDoc(diff) ret = IpDocClose() Average with image after enhancement ret = IpOpImageArithmetics(source, 0.0, OPA_AVG, 0) Application of Variance Filter ret = IpTemplateMode(0) ret = IpWsDuplicate() ret = IpFltVariance(7, 7) ret = IpDocCloseEx(1) Average with EDF TestStrip sequence ret = IpTemplateMode(0) ret = IpAppSelectDoc(18) ret = IpDocClose() ret = IpAppSelectDoc(19) ret = IpOpImageArithmetics(2, 0.0, OPA_AVG, 0) ret = IpOpShow(0) Convert image to grayscale 8 ret = IpTemplateMode(0) ret = IpAoiShow(FRAME_NONE) ret = IpWsConvertImage(IMC_GRAY, CONV_SCALE, 0, 0, 0, 0) ret = IpHstEqualize(EQ_BESTFIT) User selects folder where to save image DO NOT SAVE IN THE SAME FOLDER WHERE ORIGINAL FILES ARE STORED!!!!! ret= IpStAutoName(savefol + "###.SEQ", X, IName) ret= IpWsSaveAs(IName, "SEQ") ret = IpAppCloseAll()

PAGE 158

147 Appendix D (continued) Else Debug.Print "Error lo ading "; gDirStart + fName End If Get the next file name fName = Dir() Wend ret = IpMacroStop("All images in fold er have been processed.", MS_MODAL) End Sub This Macro: Opens EDF Test Strips from a folder in succesive order, Uses the Count/Measure tool to filter by area and min caliper. Sub Sort_GSIs() ret = IpMacroStop ("This m acro starts a new session.", 0) Dim IName As String*255 Dim fName As String Dim workStr As String Dim savefol2 As String Dim docID As Integer Dim X As Integer Initialize X X = 0 Select a folder where to store the outputs savefol2 = GetFilePath("SortedGSIs", "", "C :\", "Select a folder where to store sorted Gray Scale Images", 2) Creating starting point If gDirStart = "" Then gDirStart = "C:\" End If Get a file name from a folder workStr = GetFilePath("", "SEQ", gDirStar t, "Specify a folder where to find EDF Test Strips", 0)

PAGE 159

148 Appendix D (continued) Check if the user did not cancel If workStr = "" Then Exit Sub End If Close all open images prior processing ret = IpAppCloseAll() Extract the folder name from the full file name gDirStart = Left(workS tr, InStrRev(workStr, "\")) Clear the output for work purposes debugclear ret = IpOutputClear() Select Calibration for 20x Objective Lens ret = IpSCalSelect("20x_065") ret = IpTemplateMode(1) fName = Dir(gDirStart + "*.SEQ", 32) ret = IpMacroStop ("Explore any Test Strip from the group. Se lect the best frame where particles outlines are well defined.",0) 'ret = IpTemplateMode(1) Opening an EDF Test Strip for observation ret = IpWsLoad(gDirStart, "SEQ") Determine Frame number to extract for all the Test Strips within the folder Dim gnFrame As Long Set up initial values gnFrame = 2 Begin Dialog UserDialog 320,112,"Sel ect frame number to extract." Text 40,21,90,14,"Frame number",.Frame TextBox 140,14,90,21,.nFrame OKButton 80,84,90,21 End Dialog Dim dlg3 As UserDialog Apply to dialog dlg3.nFrame = Str(gnFrame)

PAGE 160

149 Appendix D (continued) Get user values Dialog dlg3 Get back from dialog gnFrame = Val(dlg3.nFrame) 1 ret = IpSeqExtractFrames(gnFrame, 1) Determine Intensity range manually Dim gnInte As Long 'ret = IpBlbShow(1) ret = IpSegShow(1) ret = IpSegSetAttr(SETCURSEL, 0) ret = IpSegSetAttr(CHANNEL, 0) ret = IpSegPreview(CURRENT_C_T) Set up initial values gnInte = 123 Begin Dialog UserDialog 320,112,"Manua l Selection of Intensity Range." Text 40,21,90,14,"Select a va lue for intensity",.Inte TextBox 140,14,90,21,.nInte OKButton 80,84,90,21 End Dialog Dim dlg4 As UserDialog Apply to dialog dlg4.nInte = Str(gnInte) Get user values Dialog dlg4 Get back from dialog gnInte = Val(dlg4.nInte) ret = IpTemplateMode(0) ret = IpAppCloseAll() While fName <> "" X = X + 1 Print out the file name and its attributes Debug.Print GetAttr(gDirStart + fName); "; fName

PAGE 161

150 Appendix D (continued) Load the image sequence docID = IpSeqOpen(gDirStart + fName, "SEQ",0,16) Start routine If docID >= 0 Then Extract frame of interest ret = IpSeqExtractFrames(gnFrame, 1) Converting to binary ret = IpTemplateMode(0) Select Calibration for 20x Objective Lens ret = IpSCalSelect("20x_065") ret = IpBlbSetAttr(BLOB_MEASUREOBJECTS, 1) Apply Filter Ranges ret = IpBlbSetAttr(BLOB_FILTEROBJECTS, 1) Do accumulate count ret = IpBlbSetAttr(BLOB_ADDCOUNT, 0) Reset for no measurements ret = IpBlbEnableMeas(BLBM_ALL, 0) Measure Min Feret ret = IpBlbEnableMeas(BLBM_MINCALIP, 1) Measure Area ret = IpBlbEnableMeas(BLBM_AREA, 1) Count range for partilcles (obtaine d from the manual intensity selection) ret = IpBlbSetAttr(BLOB_AUTORANGE, 0) ret = IpSegSetRange(-1, 0, gnInte) Apply smoothing ret = IpBlbSetAttr(BLOB_SMOOTHING,3) Apply 8-connected objects ret = IpBlbSetAttr(BLOB_8CONNECT,1) Fill holes ret = IpBlbSetAttr(BLOB_FILLHOLES,0) ret = IpBlbSetAttr(BLOB_MINAREA,1) ret = IpBlbSetAttr(BLOB_CLEANBORDER,1) ret = IpSortAttr(SORT_LABELS, 0) Count ret = IpBlbCount() Measure Min Feret ret = IpBlbEnableMeas(BLBM_MINCALIP, 1) Measure Area

PAGE 162

151 Appendix D (continued) ret = IpBlbEnableMeas(BLBM_AREA, 1) Filter that excludes particles outside the range 75
PAGE 163

152 Appendix D (continued) 'DO NOT SAVE IN THE SAME FOLDER WHERE ORIGINAL FILES ARE STORED!!!!! ret= IpStAutoName(savefol2 + "###.BMP", X, IName) ret= IpWsSaveAs(IName, "BMP") ret = IpAppCloseAll() Else Debug.Print "Error load ing "; gDirStart + fName End If Get the next file name fName = Dir() Wend ret = IpMacroStop("All images in directory processed.", MS_MODAL) End Sub This Macro: Opens sorted GSI's and lets the operator get rid of spots and defected shapes Sub EditGSIs() ret = IpMacroStop ("This macro will help you edit GSIs before starting the process of measuring and counting.", 0) Dim IName As String*255 Dim fName As String Dim workStr As String Dim savefol2 As String Dim docID As Integer Dim F As Integer Dim B As Integer '''''''''''''''Dim ori%, decon%, edfd%, cedfd% Dim X As Integer Initialize X Dim gnFrame1 As Long Select a folder where to store the outputs savefol2 = GetFilePath("EdGSIs", "", "C:\", "Select a folder where to store edited images", 2)

PAGE 164

153 Appendix D (continued) Set up initial values gnFrame1 = 000 Begin Dialog UserDialog 520,112,"What is th e number of the last image saved?" Text 40,21,90,14,"Image number",.Frame1 TextBox 140,14,90,21,.nFrame1 OKButton 80,84,90,21 End Dialog Dim dlg31 As UserDialog Apply to dialog dlg31.nFrame1 = Str(gnFrame1) Get user values Dialog dlg31 Get back from dialog gnFrame1 = Val(dlg31.nFrame1) X = gnFrame1 Creating starting point If gDirStart = "" Then gDirStart = "C:\" End If Get a file name from a folder workStr = GetFilePath("", "BMP", gDirStar t, "Specify a folder where to find the sorted GSIs", 0) Check if the user did not cancel If workStr = "" Then Exit Sub End If Close all open images prior processing ret = IpAppCloseAll() Extract the folder name from the full file name gDirStart = Left(workS tr, InStrRev(workStr, "\")) Clear the output for work purposes debugclear

PAGE 165

154 Appendix D (continued) ret = IpOutputClear() Select Calibration for 20x Objective Lens ret = IpSCalSelect("20x_065") ret = IpTemplateMode(0) fName = Dir(gDirStart + "*.BMP", 32) Opening an EDF Test Strip for observation ret = IpWsLoad(gDirStart, "SEQ") While fName <> "" ret = IpTemplateMode (1) ret = IpWsLoad(gDirStart + fName, "BMP") ret = IpMacroStop ("If this image pres ents undesirable areas that can be filled, select them as AOIs.", 0) 'ret = IpAoiCreateIrregular(Pts(0), 7) ret = IpMacroStop ("Click conti nue to go to the next step", 0) B = IpMacroStop ("Do you want to fill AOIs with white?",MS_MODAL + MS_YESNO + MS_QUEST) If B = 1 Then ret = IpWsFill(0,2,0) ret = IpAoiShow(FRAME_RESET) ret = IpAoiShow(FRAME_NONE) ret = IpAoiMultAppend(0) ret = IpAoiMultShow(0) Else End If F = IpMacroStop ("Click on YES to save and open next image.", MS_MODAL + MS_YESNO) ret = IpTemplateMode(0) If F = 1 Then X = X + 1

PAGE 166

155 Appendix D (continued) 'User selected folder where to save image 'DO NOT SAVE IN THE SAME FOLDER WHERE ORIGINAL FILES ARE STORED!!!!! ret = IpTemplateMode (1) ret = IpStAutoName(savefol 2 + "###.BMP", X, IName) ret = IpWsSaveAs(IName, "BMP") ret = IpAppCloseAll() Else Exit Sub End If ret = IpTemplateMode (0) Get the next file name fName = Dir() Wend ret = IpMacroStop("All images in directory processed.", MS_MODAL) End Sub This Macro: Opens one by one all binary im ages in a folder, counts and measures all particle shapes found in each image, save s all data calculated as a text file (DATA.TXT) within folder Sub MakeBINI_C_M() Scan through and process all files in a folder ret = IpMacroStop ("This macro will open all binary images within a folder and will count, measure and sort all particles found. Im portant: Make sure al l BINIs have been audited before applying this macro.", 0) Dim IName As String*255 Dim fName As String Dim workStr As String Dim docID As Integer Dim savefol2 As String Dim X As Integer X = 0

PAGE 167

156 Appendix D (continued) Creating starting point If gDirStart = "" Then gDirStart = "C:\" End If Select a folder where to store the outputs savefol2 = GetFilePath("SORTED_BIN", "", "C:\", "Select a folder where to store binary images with edited particles", 2) Get a file name from a folder workStr = GetFilePath("", "BMP", gDirStar t, "Specify a folder where to find the edited GSIs", 0) Check that user did not cancel If workStr = "" Then Exit Sub End If Close all open images prior to processing ret = IpAppCloseAll() Extract the directory name from the full file name gDirStart = Left(workS tr, InStrRev(workStr, "\")) Clear the output for work purposes debugclear ret = IpOutputClear() 'Select Calibration For 20x Objective Lens ret = IpSCalSelect("20x_065") ret = IpTemplateMode(0) fName = Dir(gDirStart + "*.BMP", 32) While fName <> "" X = X + 1 Print out the file name and its attributes Debug.Print GetAttr(gDirStart + fName); "; fName Load the image sequence docID = IpWsLoad(gDirStart + fName, "BMP")

PAGE 168

157 Appendix D (continued) Start routine If docID >= 0 Then ret = IpTemplateMode(0) Selecting Spatial Calibration ret = IpSCalSelect("20x_065") ret = IpSCalShowEx(SCA L_DLG_SELECT, SCAL_HIDE) Start Count/Size Process 'ret = IpBlbShow(1) ret = IpBlbSetAttr(BLOB_AUTORANGE, 1) ret = IpBlbSetAttr(BLOB_BRIGHTOBJ, 0) ret = IpBlbSetAttr(BLOB_ADDCOUNT, 0) ret = IpBlbSetAttr(BLOB_MEASUREOBJECTS, 1) ret = IpBlbSetAttr(BLOB_FILTEROBJECTS, 1) ret = IpBlbSetAttr(BLOB_8CONNECT,1) ret = IpBlbSetAttr(BLOB_MINAREA,0) ret = IpBlbSetAttr(BLOB_CLEANBORDER,1) ret = IpBlbSetAttr(BLOB_FILLHOLES, 1) ret = IpBlbSetAttr(BLOB_LABELMODE, 1) ret = IpSortAttr(SORT_ROTATE, 1) Reset for no measurements ret = IpBlbEnableMeas(BLBM_ALL, 0) Feret(min): Smallest caliper(feret) length ret = IpBlbEnableMeas(BLBM_MINCALIP, 1) Area of particle ret = IpBlbEnableMeas(BLBM_AREA, 1) Filter that excludes particles outside the range 50
PAGE 169

158 Appendix D (continued) Area of particle ret = IpBlbEnableMeas(BLBM_AREA, 1) Roundness: Perieter^2/ (4*pi*Area). ret = IpBlbEnableMeas(BLBM_ROUNDNESS, 1) Perimeter(ellipse): Perimeter of the equivalent ellipse ret = IpBlbEnableMeas(BLBM_PELLIPSE, 1) Perimeter(convex): Perimeter of the convex outline of the particle ret = IpBlbEnableMeas(BLBM_PCONVEX, 1) Fractal dimension of the particle's outline ret = IpBlbEnableMeas(BLBM_FRACTDIM, 1) Axis(major): Length of major axis of ellipse with same moments of order 1 and 2 as particle ret = IpBlbEnableMeas(BLBM_MAJORAX, 1) Axis(minor): Length of major axis of ellipse with same moments of order 1 and 2 as particle ret = IpBlbEnableMeas(BLBM_MINORAX, 1) Aspect: Ratio between major axis and minor axis of ellipse equivalent to particle ret = IpBlbEnableMeas(BLBM_ASPECT, 1) Diameter(max): Length of longest line joining two points of object's outline and passing through the centroid ret = IpBlbEnableMeas(BLBM_MAXFERRET, 1) Diameter(min): Length of shortest lin e joining two points of object's outline and passing through the centroid ret = IpBlbEnableMeas(BLBM_MINFERRET, 1) Diameter (mean): Average length of diameters measured at 2 degress intervals and passing through particle's centroid ret = IpBlbEnableMea s(BLBM_MEANFERRET, 1) Feret(max): Longest caliper(feret) length ret = IpBlbEnableMeas(BLBM_MAXCALIP, 1) Feret(min): Smallest caliper(feret) length ret = IpBlbEnableMeas(BLBM_MINCALIP, 1) Feret(mean): Average caliper(fert) length ret = IpBlbEnableMeas(BLBM_MEANCALIP, 1) Radius(max): Maximumdistance betw een particle's centroid and outline ret = IpBlbEnableMeas(BLBM_MAXRADIUS, 1) Radius (min): Minimumdistance be tween particle's centroid and outline ret = IpBlbEnableMeas(BLBM_MINRADIUS, 1) Radius Ratio: Ratio between Max. Radius and Min. Radius ret = IpBlbEnableMeas(BLBM_RADIUSRATIO, 1) Filter that excludes particles outside the range 50
PAGE 170

159 Appendix D (continued) ret = IpBlbSetFilterRang e(BLBM_MINCALIP, 50, 3000) ret = IpBlbSetFilter Range (BLBM_AREA, 1500, 1000000) count BINIs ret = IpBlbUpdate(0) ret = IpBlbCount() If X = 1 Then ret = IpBlbSaveData(savefol2 + "DATA.TXT", S_APPEND+S_HEADER+S_Y_AXIS) ret = IpBlbShow(0) Else IpBlbSaveData(savefol2 + "DATA.TXT", S_APPEND+S_Y_AXIS) ret = IpBlbShow(0) End If 'User selected folder where to save image 'DO NOT SAVE IN THE SAME FOLDER WHERE ORIGINAL FILES ARE STORED!!!!! ret= IpStAutoName(savefol2 + "###.BMP", X, IName) ret= IpWsSaveAs(IName, "BMP") ret = IpAppCloseAll() Else Debug.Print "Error load ing "; gDirStart + fName End If Get the next file name fName = Dir() Wend ret = IpMacroStop("All images in fold er have been processed.", MS_MODAL) End Sub

PAGE 171

160 Appendix E. Results of Sieve Analys is for Some Sand Samples Collected Table 6. Percentages Retained by Weight for Different Size Ranges of Some Sand Samples Collected

PAGE 172

161 Appendix F. Comparison of Results of a Rhode Island Sand Particle Shape Obtained Using the Scripts Mult2DShape4x, Mult2DShape10x and Mult2DShape20x Figure 38. Enhanced Image of a Rhode Island Sand Particle Obtained Using the Script Mult2DShape4x Figure 39. Enhanced Image of a Rhode Island Sand Particle Obtained Using the Script Mult2DShape10x

PAGE 173

162 Appendix F (continued) Figure 40. Enhanced Image of a Rhode Island Sand Particle Obtained Using the Script Mult2DShape20x Mult2DShape4x 53040.45 m2Mult2DShape10x 55539.80 m2Mult2DShape20x 54094.77 m2Mult2DShape4x 53040.45 m2Mult2DShape10x 55539.80 m2Mult2DShape20x 54094.77 m2 Figure 41. Measurement of Areas of a Rhode Is land Sand Particle Using Scripts Mult2DShape4x, Mult2DShape10x and Mult2DShape20x

PAGE 174

163 Appendix F (continued) 0.00 50.00 100.00 150.00 200.00 250.00 300.00 350.00 400.00 Axis (major)Axis (minor)Radius (max)Radius (min)um 4x 10x 20x Figure 42. Comparison of Measurements Axis (mayor), Axis (minor), Radius (max) and Radius (min) for a Rhode Island Sand Particle Using Scripts Mult2DShape4x, Mult2DShape10x and Mult2DShape20x 820.00 840.00 860.00 880.00 900.00 920.00 940.00 960.00 980.00 PerimeterPerimeter (convex)Perimeter (ellipse)um 4x 10x 20x Figure 43. Comparison of Measurements Perimete r, Perimeter (convex) a nd Perimeter (ellipse) for a Rhode Island Sand Particle Using Sc ripts Mult2DShape4x, Mult2DShape10x and Mult2DShape20x

PAGE 175

164 Appendix F (continued) 0.00 50.00 100.00 150.00 200.00 250.00 300.00 350.00 400.00 Ferret (max)Ferret (min)Ferret (mean)um 4x 10x 20x Figure 44. Comparison of Measurements Ferret (max), Ferret (min) and Ferret (mean) for a Rhode Island Sand Particle Using Scripts Mult2DShape4x, Mult2DShape10x and Mult2DShape20x 0.00 50.00 100.00 150.00 200.00 250.00 300.00 350.00 400.00 Diameter (max)Diameter (min)Diameter (mean)um 4x 10x 20x Figure 45. Comparison of Measurements Diameter (max), Diameter (min) and Diameter (mean) for a Rhode Island Sand Particle Using Sc ripts Mult2DShape4x, Mult2DShape10x and Mult2DShape20x

PAGE 176

165 Appendix G. Grayscale Pict ures of Sands Collected b) a)b) a) Figure 46. Pictures of Sands from: a) US Silica Standard Melt and b) US Silica #1 Dry b) a)b) a) Figure 47. Pictures of Sands from: a) O xnard and b) Belmont Pier, Long Beach, CA b) a)b) a) Figure 48. Pictures of Sands from: a) Ri ncon Beach, Puerto Rico and b) Rhode Island

PAGE 177

166 Appendix G (continued) b) a)b) a) Figure 49. Pictures of Sands from: a) Redingt on Shores, FL and b) Belleair Beach, FL b) a)b) a) Figure 50. Pictures of Sands from: a) Dayt ona Beach, FL and b) Indian Rocks Beach, FL b) a)b) a) Figure 51. Pictures of Sands from: a) Made ira Beach, FL and b) Clearwater Beach, FL

PAGE 178

167 Appendix G (continued) b) a)b) a) Figure 52. Pictures of Sands from: a) Loire River, France and b) Fontainbleau, France b) a)b) a) Figure 53. Pictures of Sands from: a) Hostun, France and b) Nice, France b) a)b) a) Figure 54. Pictures of Sands from: a) Arroyo Alamar, Mexico and b) Tecate River, Mexico

PAGE 179

168 Appendix G (continued) b) a)b) a) Figure 55. Pictures of Sands from: a) To youra, Japan and b) Malibu Beach, Panama Figure 56. Pictures of Sands from Bo ca Grande Beach, Cartagena, Colombia