ebook img

Biomedical Image Analysis Recipes in MATLAB: For Life Scientists and Engineers PDF

421 Pages·2015·18.05 MB·English
Save to my drive
Quick download
Download
Most books are stored in the elastic cloud where traffic is expensive. For this reason, we have a limit on daily download.

Preview Biomedical Image Analysis Recipes in MATLAB: For Life Scientists and Engineers

Biomedical Image Analysis Recipes in MATLAB® For Life Scientists and Engineers Constantino Carlos Reyes-Aldasoro LecturerinBiomedicalImageAnalysis SchoolofMathematics,ComputerScienceandEngineering CityUniversityLondon London Contents 1 The Basic Ingredients, 1 1.1 The Matlab Environment, 1 1.2 Introduction to Matlab, 3 1.3 Operations with Matrices, 7 1.4 Combining Matrices, 10 1.5 Addressing a Matrix, 13 1.6 Mathematical Functions and Graphical Display, 17 1.7 Random Numbers, 23 1.8 Statistics in Matlab, 26 1.9 Displaying Two-Dimensional Matrices, 29 1.10Scripts, Functions and Shortcuts, 37 1.11Using Help, 43 2 Introduction to Images, 45 2.1 An Image as a Matrix, 45 2.2 Reading Images, 46 2.3 Displaying Images, 49 2.4 Colormap, 54 2.5 Thresholding and Manipulating Values of Images, 59 2.6 Converting Images into Doubles, 68 2.7 Save Your Code and Data, 69 3 Introduction to Colour, 71 3.1 Mixing and Displaying Colours, 71 4 Western Blots, 79 4.1 Recipe 1: Many Ways to Display a Western Blot, 80 4.2 Recipe 2: Investigating the Numbers That Make a Western Blot, 93 4.3 Recipe 3: Image Histograms, 97 4.4 Recipe 4: Transforming an Image of a Western Blot, 104 4.5 Recipe 5: Quantification of the Data, 111 4.6 Recipe 6: Investigating Position of Bands, 121 5 Scratch Wound Assays, 135 5.1 Analysis of Scratch Wound Assays, 135 5.2 Recipe1:LowPassFilteringScratchWoundAssaysintheSpatialDomain,139 5.3 Recipe2:HighPassFilteringScratchWoundAssaysintheSpatialDomain,143 5.4 Recipe 3: Combining Filters and Morphological Operations, 154 5.5 Recipe 4: Sensitivy to Thresholds and Hysteresis Thresholding, 161 5.6 Recipe 5: Morphological Operators, 167 5.7 Recipe 6: Measuring Distances Between Cellular Boundaries, 178 5.8 Recipe 7: Introduction to Fourier Analysis, 187 5.9 Recipe 8: Filtering Scratch Wound Assays in the Fourier Domain, 201 References, 213 6 Bright Field Microscopy, 215 6.1 Recipe 1: Changing the Brightness and Contrast of an Image, 215 6.2 Recipe 2: Shading Correction: Estimation of Shading Component as a Plane, 224 6.3 Recipe 3: Estimation of Shading Component with Filters, Morphological Operators and Envelopes, 235 6.4 Recipe 4: Mosaicking and Stitching, 247 6.5 Recipe 5: Pixel Intensity and Histograms in Immunohistochemistry, 261 6.6 Recipe 6: Hue-Saturation-Value, 271 6.7 Recipe 7: Multidimensional Histograms, 278 Reference, 289 7 Fluorescence Microscopy, 291 7.1 Recipe 1: Separating and Combining Colour Channels, 294 7.2 Recipe 2: Investigating the Scaling of Values, 298 7.3 Recipe 3: Automatic Threshold Selection, 301 7.4 Recipe 4: Measuring Absolute and Relative Areas, 304 7.5 Recipe 5: Counting Nuclei, 305 7.6 Recipe 6: Quantification of Region Properties Beyond the Area, 308 7.7 Recipe 7: Dividing an Image into Regions, 310 7.8 Recipe 8: Batch Processing and Montages, 316 7.9 Recipe 9: A Myriad of Measurements, 327 References, 341 8 Creating Publication-Quality Figures from Matlab, 343 8.1 Recipe 1: Modifying the Characteristics of the Figures, 344 8.2 Recipe 2: Numerous Plots in One Figure, 352 8.3 Recipe 3: Three-Dimensional Ribbons with Different Annotations, 362 8.4 Recipe 4: Three-Dimensional Graphics, 378 8.5 Recipe 5: Projections, 388 8.6 Recipe 6: Four-Dimensional Data Set Explored, 391 Index, 401 Preface Most newcomers to the emerging interdisciplinary fields inspired by biological prob- lems, Systems Biology, Bioinformatics or Computational Biology, will face two difficulties. The first is, of course, that in order to interact properly, a common understanding of the “other” discipline is required. Engineers or computer scientists will need to understand immunohistochemistry or molecular processes at a deep level; deeper perhaps than the statistics and physics that biologists might need to understand. The second problem, which is a bit more subtle, arises at conferences or meetings when two collaborators on the opposite sides of the spectrum engage in a conversation and after some time they begin to wonder if they are speaking the same language. Suddenly, simple concepts do not appear to resonate in the same frequency for the in-vivoscientistasforthemathematician.Sowhenyousay’model’areyoureallyreferring to a mouse? Equally surprised may be the neurosurgeons when they listen to two engineerstalkingaboutsomeNeuralNetworks,whichhaveverylittletodowithCajal’s discoveries. A table at the end of this section shows a few words, which according to the discipline, can have very distinct meanings. Within this interdisciplinary atmosphere, the acquisition of images and more generallysignalsofmanydimensionshasbecomeabridgebetweenfields:chemistry, physics and engineering that develop new acquisition technologies, then biology and medicine that apply the technologies to analyse specific problems and then mathematics, computer science and statistics that try to extract meaningful infor- mation of the signals. A systematic, algorithmic approach to the storage, processing, classification and statistical analysis, the images can reveal much more than what a human can observe. Furthermore, besides the technological advances that have produced a myriad of imaging techniques, computers have decreased in price and increasedinstoragecapacityandprocessingpower.Theneedforimageanalysisfrom an algorithmic point of view is therefore essential to cope with the rate at which the signals are produced, to provide more reliable and reproducible results and to ease the labour to those who perform manual measurements for hours in front of a microscope or a computer screen. This book is designed as a tutorial for those researchers who are interested in performingimageanalysisandwhosebackgroundisnotbasedonthestudyofapplied mathematics. This book does not assume any previous knowledge of mathematics, physics or programming except probably some basic principles with which most life scientists should already be familiar. The basic concepts of image analysis are presented without delving deep into the theory and applications, and solutions to common biological images are presented. This is the emphasis of the book: to solve common biological problems through the use of image analysis algorithms. In the process of reading this book, a reader should then learn the basics of image analysis and algorithm development so that he or she can then apply these new skills into solving a particular problem in their own laboratories. The book is based on Matlab, a mathematical language that allows a user to execute flexible and powerful image analysis programmes tailored to the specific needs of the problem. As the nature of Matlab is mathematical, there are numerous textbooks designed for engineers and scientists who may already have a deeper knowledge of mathematics and programming and other concepts such as linear algebra and signals and systems. These books rarely delve into biomedical-specific topics. Thisbookisdesignedasarecipebook,inthesensethateachchapterwillpresent one self-contained biomedical experiment to be analysed. Chapters 1–3 presents the two basic ingredients of the book: essential concepts of image analysis and Matlab. In Chapters 4–7, algorithm and techniques will be presented as a series of “recipes” or solved examples that show the reader how a particular technique is applied in a specific biomedical experiment. Four biomedical cases are analysed: Western Blots, Scratch Wound Assays, Bright Field Microscopy and Fluorescent Microscopy. Each chapter begins with simpler techniques, which then advance in complexity towards the last recipes. Chapter 8 presents some advanced techniques for the generation of publication-quality figures. Therecipesaredesignedtoperformaspecificanalysisandlearnsometechniques andalgorithms.Itisexpectedthatreaderswillbeabletoapplythesetechniqueslater totheirownproblems.Inaddition,theywillhavethebasestoexploreMatlabfurther. Term Context Biological Nonbiological Matrix Thewomb;theuterusofamammal. Arectangulararrayofsymbolsormathematical Anamorphousorfibrillarmaterialthat expressionsarrangedinrowsandcolumns, surroundscells;especiallytheextracellular treatedasasingleentity,andnowusually substanceofconnectivetissue.Alsotheground writtenwithinroundbrackets.Alsogenerally substanceinwhichstructuralelements(e.g.of anysimilartabulatedarrangementofitems. ashell,cellwall,etc.)areembedded. Vector Abacteriophagethattransfersgeneticmaterial Aquantityhavingdirectionaswellas fromonebacteriumtoanother;also,aphage magnitude,oftendepictedbyalinedrawn orplasmidusedtotransferextraneousDNA fromitsoriginaltoitsfinalposition. intoacell. Anorderedsetoftwoormorenumbers (interpretableasthecoordinatesofapoint);a matrixwithoneroworonecolumn;also,any elementofavectorspace. Model Aperson,animalorplantthatcarriesa Asimplifiedoridealiseddescriptionor pathogenicagentandactsasapotentialsource conceptionofaparticularsystem,situation,or ofinfectionformembersofanotherspecies. process,ofteninmathematicalterms,thatis Ananimalorplanttowhichanotherbearsa putforwardasabasisfortheoreticalor mimeticresemblance. empiricalunderstanding,orforcalculations, predictions,etc. CHAPTER 1 The Basic Ingredients 1.1 The Matlab Environment The word “Matlab” is an acronym for MATrix LABoratory. Matlab is a powerful technical computing environment and a high-level computer programming lan- guage, which provides core mathematics and advanced graphical tools for data analysis, visualisation, as well as algorithm and application development. Matlab is intuitive and easy to use, but it requires the use of command-line interface. That is, contrary to other image-analysis software products, which have interfaces and buttons, in Matlab the user needs to type commands to perform tasks. This may seemdauntingforexperiencedusersofgraphical/textuserinterfaces.However,with a little practice the command-line becomes easy to use. Furthermore, graphical user interfacescanbecreatedwithinMatlab.Manycommonfunctions,algorithms,matrix manipulationroutinesandplottingoptionsareavailableinthemainMatlabprogram or on one of the many toolboxes that accompany Matlab. ThereareseveralwaystostartMatlab:throughthe“MatlabIcon”ontheDesktop, whichappearsontheDesktopofyourcomputerafterinstallationofMatlab,onMacs itshouldbeunder“Applications>Matlab”andonWindowsin“Start>Programs”.The following figure shows the location of the icons in a Mac Operating System. BiomedicalImageAnalysisRecipesinMATLAB®:ForLifeScientistsandEngineers,FirstEdition. ConstantinoCarlosReyes-Aldasoro. ©2015JohnWiley&Sons,Ltd.Published2015byJohnWiley&Sons,Ltd. 1 2 Chapter1 When you start Matlab, one or more windows will appear once the pro- grammehasbeenlaunched.Thesemayincludethe'Desktop','Help Window',and 'm-file Editor', as shown in the following figure. You can later configure which windows to launch with Matlab. Themainwindowisthe'Desktop',whichissubdividedintoseveralsections.The 'Command Window'is where the instructions or commands are written to perform a given task. The user will type the instructions in the 'Command Window'. For example, we can add two numbers, 2 and 5, and store the result in the variable'a' by typing the following in the'Command Window': a = 2 + 5 a = 7 Toexecutecommands,theusermustpressthe“enter”or“return”keyaftertyping each command. It is possible to have one or more commands in a single line, which is sometimes called a line of instructions. After being executed, each line is stored in the'Command History'window, together with the date when the command was written. This can be very useful for repeating commands that were typed in the past orforfindingthecommandsthatgeneratedacertainresult.TheCommandWindow isthefirstplacewherecommandsareused,butifacomplextaskisneeded,itmaybe better to store the commands in a file called an'm-file', which can be saved, edited and debugged. The 'm-files' are files of Matlab code that can be used as 'scripts' or 'functions'. Scripts are files in which a series of commands are written. When the file is'run', all the commands will be executed in the sequence in which they TheBasicIngredients 3 have been written. Functions are different; when a script is executed, any variable thatexistsalreadyinMatlabmaybeused.Functionshavenoknowledgeofanything thatexistsoutsidethefunction.Inorderforafunctiontoknowacertainvalue(stored in a variable), this variable has to be “passed” to the function as input values or 'arguments'. In the same way, any variables that are created inside a script remain in the'workspace'after the script is executed. With functions the opposite is true; all intermediate variables created inside a function are deleted once the function finishes its execution unless we specifically'pass'out the variable as an output argument. To edit the scripts or functions, Matlab provides an'm-file editor', which is a specialtexteditorthatunderstandsMatlab;ithighlightsthecodeindifferentcolours so that it is easier to read, it highlights possible errors in the code and suggests improvements and it is very powerful to debug large functions. It even allows the creation of documents. This entire book has been written in the Matlab Editor. When the commands assign values to variables, a list of variables is displayed on the'workspace'. Some characteristics of the variables such as their dimensions, value, class ('double','single','char','cell', etc.) are shown. To visualise the details of the variable or to modify some of the contents, a double-click on the variablewilldisplayitonthe'Array Editor'.The'Help Window'providesdetailed information about Matlab, functions, editors and toolboxes. New windows can be used, for example when graphics are displayed as will be shown in the next section. 1.2 Introduction to Matlab In MATLAB everything is a matrix. A matrix should be understood in the math- ematical sense as defined by the Oxford English Dictionary: “A rectangular array of symbols or mathematical expressions arranged in rows and columns, treated as a single entity, and now usually written within round brackets” and not as any of the other definitions such as “the uterus of a mammal” or “the amorphous or fibrillar material that surrounds cells”. Table 1 in the preface shows some terms with extremely different meanings within the context of the Life Sciences and that of Mathematics and Engineering. Therefore, a single number can be understood as a matrix of dimensions 1×1, i.e. one row and one column. A pair of numbers can be understood as a matrix of dimensions 2×1 or 1×2. This notion of “matrix orientation” (horizontal or vertical) is a very important concept and will be very relevant once operations are performed. Four numbers can be the elements of matrices with dimensions 4×1, 1×4 or 2×2. It is not possible to leave “empty” spacesinsideamatrix.Forexampleitwouldnotbepossibletoplacethreeofthefour elements in the first row and the remaining element in the second row. That matrix would automatically become a 2×3 matrix, that is two rows, three columns. The “empty” spaces in the second row would be filled with zeros. The values of a matrix, that is, the matrix itself, can be assigned to a “variable”, which will store the values. The variable can be understood as the name by which the matrix will be known. The basic objective of saving matrices as variables is that they can later be used in conjunction with other variables. For example, to store the valueof5inamatrixwiththename'a',thefollowingcodeistypedintheCommand Window after the prompt (>>): 4 Chapter1 a=5 a = 5 After pressing enter, the value is stored, the workspace will show an entry for 'a'and Matlab will “echo” the answer to the command entered in the Command Window.Inthiscase,theechojustrepeatswhatwastypedbefore,butitcanbeused to find the solution of an equation with more data. For instance: b = 45 + 123 + a b = 173 Notice that we used the matrix'a'as one of the values to be added and stored in the variable'b'. In this way, Matlab can be used as a simple calculator. If we are not interested in saving the result, there is no need to assign it to a variable. Matlab will store it in a temporary variable called'ans'(short of answer). The order of precedence in which the operations are carried out is the following: exponentiation,multiplication/divisionandthenadditionandsubtraction.Thisorder can be modified by using round brackets. The order is sometimes referred to with the acronyms “BODMAS” or “BIDMAS”, which stand for “Brackets, Order of, Division, Multiplication, Addition, Subtraction” and “Brackets, Indices (powers androots),Division,Multiplication,Addition,Subtraction”.Therefore,thefollowing instruction line: 1 + 2 * 3 ˆ 4 ans = 163 is equivalent to: 1 + (2 * (3 ˆ 4)) ans = 163

See more

The list of books you might like

Most books are stored in the elastic cloud where traffic is expensive. For this reason, we have a limit on daily download.