0% found this document useful (0 votes)
14 views65 pages

Previewpdf

The document is an overview of the book 'Image Processing and Acquisition using Python, Second Edition' by Ravishankar Chityala and Sridevi Pudipeddi, part of the Chapman & Hall/CRC Python Series. It highlights the book's focus on teaching Python for image processing applications, including data science and machine learning, and provides a structured table of contents detailing various topics covered. The book is designed for both beginners and advanced users, with supplementary materials available through Jupyter notebooks.

Uploaded by

Alejandro Valle
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
14 views65 pages

Previewpdf

The document is an overview of the book 'Image Processing and Acquisition using Python, Second Edition' by Ravishankar Chityala and Sridevi Pudipeddi, part of the Chapman & Hall/CRC Python Series. It highlights the book's focus on teaching Python for image processing applications, including data science and machine learning, and provides a structured table of contents detailing various topics covered. The book is designed for both beginners and advanced users, with supplementary materials available through Jupyter notebooks.

Uploaded by

Alejandro Valle
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 65

Image Processing and

Acquisition using Python


Chapman & Hall/CRC
The Python Series

About the Series


Python has been ranked as the most popular programming language, and it is widely used in education
and industry. This book series will offer a wide range of books on Python for students and
professionals. Titles in the series will help users learn the language at an introductory and advanced
level, and explore its many applications in data science, AI, and machine learning. Series titles can
also be supplemented with Jupyter notebooks.

Image Processing and Acquisition using Python, Second Edition


Ravishankar Chityala, Sridevi Pudipeddi

For more information about this series please visit: https://www.crcpress.com/Chapman--HallCRC/book-series/PYTH


Image Processing and
Acquisition using Python
Second Edition

Ravishankar Chityala
IonPath and University of California Santa Cruz
Sridevi Pudipeddi
University of California, Berkeley
MATLAB R is a trademark of The MathWorks, Inc. and is used with permission. The MathWorks
does not warrant the accuracy of the text or exercises in this book. This book’s use or discus-
sion of MATLAB R software or related products does not constitute endorsement or sponsorship
by The MathWorks of a particular pedagogical approach or particular use of the MATLAB R
software.

First edition published 2021


by CRC Press
6000 Broken Sound Parkway NW, Suite 300, Boca Raton, FL 33487-2742

and by CRC Press


2 Park Square, Milton Park, Abingdon, Oxon, OX14 4RN

c 2021 Taylor & Francis Group, LLC

CRC Press is an imprint of Taylor & Francis Group, LLC

Reasonable efforts have been made to publish reliable data and information, but the author and
publisher cannot assume responsibility for the validity of all materials or the consequences of their
use. The authors and publishers have attempted to trace the copyright holders of all material
reproduced in this publication and apologize to copyright holders if permission to publish in this
form has not been obtained. If any copyright material has not been acknowledged please write
and let us know so we may rectify in any future reprint.

Except as permitted under U.S. Copyright Law, no part of this book may be reprinted, repro-
duced, transmitted, or utilized in any form by any electronic, mechanical, or other means, now
known or hereafter invented, including photocopying, microfilming, and recording, or in any infor-
mation storage or retrieval system, without written permission from the publishers.

For permission to photocopy or use material electronically from this work, access www.copyright
.com or contact the Copyright Clearance Center, Inc. (CCC), 222 Rosewood Drive, Danvers, MA
01923, 978-750-8400. For works that are not available on CCC please contact mpkbookspermis-
sions@tandf.co.uk

Trademark notice: Product or corporate names may be trademarks or registered trademarks,


and are used only for identification and explanation without intent to infringe.

Library of Congress Cataloging-in-Publication Data


Names: Chityala, Ravishankar, author. | Pudipeddi, Sridevi, author.
Title: Image processing and acquisition using Python / Ravishankar Chityala
and Sridevi Pudipeddi.
Description: Second edition. | Boca Raton : Chapman & Hall/CRC Press, 2020.
| Series: Chapman & Hall/CRC the Python series | Includes
bibliographical references and index.
Identifiers: LCCN 2020015556 | ISBN 9780367198084 (hardback) | ISBN
9780429243370 (ebook)
Subjects: LCSH: Image processing. | Python (Computer program language)
Classification: LCC TA1637 .C486 2020 | DDC 006.6/63--dc23
LC record available at https://lccn.loc.gov/2020015556

ISBN: 9780367198084 (hbk)


ISBN: 9780429243370 (ebk)

Visit the Taylor & Francis Web site at


http://www.taylorandfrancis.com

and the CRC Press Web site at


http://www.crcpress.com
To our parents
Contents

Foreword xvii

Preface xix

Preface to the First Edition xxi

Introduction xxv

Authors xxvii

List of Symbols and Abbreviations xxix

I Introduction to Images and Computing using


Python 1

1 Introduction to Python 3
1.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . 3
1.2 What Is Python? . . . . . . . . . . . . . . . . . . . . . 3
1.3 Python Environments . . . . . . . . . . . . . . . . . . 5
1.3.1 Python Interpreter . . . . . . . . . . . . . . . . 5
1.3.2 Anaconda Python Distribution . . . . . . . . . 6
1.4 Running a Python Program . . . . . . . . . . . . . . . 6
1.5 Basic Python Statements and Data Types . . . . . . . 7
1.5.1 Data Structures . . . . . . . . . . . . . . . . . . 11
1.5.2 File Handling . . . . . . . . . . . . . . . . . . . 16
1.5.3 User-Defined Functions . . . . . . . . . . . . . . 18
1.6 Summary . . . . . . . . . . . . . . . . . . . . . . . . . 19
1.7 Exercises . . . . . . . . . . . . . . . . . . . . . . . . . 20

vii
viii Contents

2 Computing using Python Modules 23


2.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . 23
2.2 Python Modules . . . . . . . . . . . . . . . . . . . . . 23
2.2.1 Creating Modules . . . . . . . . . . . . . . . . . 24
2.2.2 Loading Modules . . . . . . . . . . . . . . . . . 24
2.3 Numpy . . . . . . . . . . . . . . . . . . . . . . . . . . 26
2.3.1 Numpy Array or Matrices? . . . . . . . . . . . . 30
2.4 Scipy . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
2.5 Matplotlib . . . . . . . . . . . . . . . . . . . . . . . . . 31
2.6 Python Imaging Library . . . . . . . . . . . . . . . . . 32
2.7 Scikits . . . . . . . . . . . . . . . . . . . . . . . . . . . 32
2.8 Python OpenCV Module . . . . . . . . . . . . . . . . 33
2.9 Summary . . . . . . . . . . . . . . . . . . . . . . . . . 34
2.10 Exercises . . . . . . . . . . . . . . . . . . . . . . . . . 34

3 Image and Its Properties 37


3.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . 37
3.2 Image and Its Properties . . . . . . . . . . . . . . . . . 38
3.2.1 Bit-Depth . . . . . . . . . . . . . . . . . . . . . 38
3.2.2 Pixel and Voxel . . . . . . . . . . . . . . . . . . 39
3.2.3 Image Histogram . . . . . . . . . . . . . . . . . 41
3.2.4 Window and Level . . . . . . . . . . . . . . . . 42
3.2.5 Connectivity: 4 or 8 Pixels . . . . . . . . . . . . 43
3.3 Image Types . . . . . . . . . . . . . . . . . . . . . . . 44
3.3.1 JPEG . . . . . . . . . . . . . . . . . . . . . . . 44
3.3.2 TIFF . . . . . . . . . . . . . . . . . . . . . . . . 45
3.3.3 DICOM . . . . . . . . . . . . . . . . . . . . . . 45
3.4 Data Structures for Image Analysis . . . . . . . . . . . 49
3.5 Reading, Writing and Displaying Images . . . . . . . . 49
3.5.1 Reading Images . . . . . . . . . . . . . . . . . . 49
3.5.2 Reading DICOM Images using pyDICOM . . . 51
3.5.3 Writing Images . . . . . . . . . . . . . . . . . . 52
3.5.4 Writing DICOM Images using pyDICOM . . . . 52
3.5.5 Displaying Images . . . . . . . . . . . . . . . . . 53
Contents ix

3.6 Programming Paradigm . . . . . . . . . . . . . . . . . 53


3.7 Summary . . . . . . . . . . . . . . . . . . . . . . . . . 56
3.8 Exercises . . . . . . . . . . . . . . . . . . . . . . . . . 57

II Image Processing using Python 59

4 Spatial Filters 61
4.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . 61
4.2 Filtering . . . . . . . . . . . . . . . . . . . . . . . . . . 62
4.2.1 Mean Filter . . . . . . . . . . . . . . . . . . . . 64
4.2.2 Median Filter . . . . . . . . . . . . . . . . . . . 68
4.2.3 Max Filter . . . . . . . . . . . . . . . . . . . . . 70
4.2.4 Min Filter . . . . . . . . . . . . . . . . . . . . . 72
4.3 Edge Detection using Derivatives . . . . . . . . . . . . 73
4.3.1 First Derivative Filters . . . . . . . . . . . . . . 74
4.3.1.1 Sobel Filter . . . . . . . . . . . . . . . 76
4.3.1.2 Prewitt Filter . . . . . . . . . . . . . . 78
4.3.1.3 Canny Filter . . . . . . . . . . . . . . 80
4.3.2 Second Derivative Filters . . . . . . . . . . . . . 82
4.3.2.1 Laplacian Filter . . . . . . . . . . . . . 83
4.3.2.2 Laplacian of Gaussian Filter . . . . . . 86
4.4 Shape Detecting Filter . . . . . . . . . . . . . . . . . . 89
4.4.1 Frangi Filter . . . . . . . . . . . . . . . . . . . . 89
4.5 Summary . . . . . . . . . . . . . . . . . . . . . . . . . 91
4.6 Exercises . . . . . . . . . . . . . . . . . . . . . . . . . 92

5 Image Enhancement 95
5.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . 95
5.2 Pixel Transformation . . . . . . . . . . . . . . . . . . . 95
5.3 Image Inverse . . . . . . . . . . . . . . . . . . . . . . . 97
5.4 Power Law Transformation . . . . . . . . . . . . . . . 99
5.5 Log Transformation . . . . . . . . . . . . . . . . . . . 102
5.6 Histogram Equalization . . . . . . . . . . . . . . . . . 104
x Contents

5.7 Contrast Limited Adaptive Histogram Equalization


(CLAHE) . . . . . . . . . . . . . . . . . . . . . . . . . 110
5.8 Contrast Stretching . . . . . . . . . . . . . . . . . . . 112
5.9 Sigmoid Correction . . . . . . . . . . . . . . . . . . . . 114
5.10 Local Contrast Normalization . . . . . . . . . . . . . . 117
5.11 Summary . . . . . . . . . . . . . . . . . . . . . . . . . 121
5.12 Exercises . . . . . . . . . . . . . . . . . . . . . . . . . 121

6 Affine Transformation 123


6.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . 123
6.2 Affine Transformation . . . . . . . . . . . . . . . . . . 124
6.2.1 Translation . . . . . . . . . . . . . . . . . . . . 124
6.2.2 Rotation . . . . . . . . . . . . . . . . . . . . . . 127
6.2.3 Scaling . . . . . . . . . . . . . . . . . . . . . . . 128
6.2.4 Interpolation . . . . . . . . . . . . . . . . . . . . 130
6.3 Summary . . . . . . . . . . . . . . . . . . . . . . . . . 134
6.4 Exercises . . . . . . . . . . . . . . . . . . . . . . . . . 135

7 Fourier Transform 137


7.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . 137
7.2 Definition of Fourier Transform . . . . . . . . . . . . . 138
7.3 Two-Dimensional Fourier Transform . . . . . . . . . . 141
7.3.1 Fast Fourier Transform using Python . . . . . . 143
7.4 Convolution . . . . . . . . . . . . . . . . . . . . . . . . 146
7.4.1 Convolution in Fourier Space . . . . . . . . . . 147
7.5 Filtering in the Frequency Domain . . . . . . . . . . . 148
7.5.1 Ideal Lowpass Filter . . . . . . . . . . . . . . . 148
7.5.2 Butterworth Lowpass Filter . . . . . . . . . . . 151
7.5.3 Gaussian Lowpass Filter . . . . . . . . . . . . . 152
7.5.4 Ideal Highpass Filter . . . . . . . . . . . . . . . 154
7.5.5 Butterworth Highpass Filter . . . . . . . . . . . 157
7.5.6 Gaussian Highpass Filter . . . . . . . . . . . . . 159
7.5.7 Bandpass Filter . . . . . . . . . . . . . . . . . . 160
Contents xi

7.6 Summary . . . . . . . . . . . . . . . . . . . . . . . . . 164


7.7 Exercises . . . . . . . . . . . . . . . . . . . . . . . . . 164

8 Segmentation 167
8.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . 167
8.2 Histogram-Based Segmentation . . . . . . . . . . . . . 168
8.2.1 Otsu’s Method . . . . . . . . . . . . . . . . . . 168
8.2.2 Renyi Entropy . . . . . . . . . . . . . . . . . . . 172
8.2.3 Adaptive Thresholding . . . . . . . . . . . . . . 176
8.3 Region-Based Segmentation . . . . . . . . . . . . . . . 179
8.3.1 Watershed Segmentation . . . . . . . . . . . . . 181
8.4 Contour-Based Segmentation . . . . . . . . . . . . . . 187
8.4.1 Chan-Vese Segmentation . . . . . . . . . . . . . 187
8.5 Segmentation Algorithm for Various Modalities . . . . 191
8.5.1 Segmentation of Computed Tomography Image 192
8.5.2 Segmentation of MRI Image . . . . . . . . . . . 192
8.5.3 Segmentation of Optical and Electron
Microscope Images . . . . . . . . . . . . . . . . 192
8.6 Summary . . . . . . . . . . . . . . . . . . . . . . . . . 193
8.7 Exercises . . . . . . . . . . . . . . . . . . . . . . . . . 193

9 Morphological Operations 195


9.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . 195
9.2 History . . . . . . . . . . . . . . . . . . . . . . . . . . 195
9.3 Dilation . . . . . . . . . . . . . . . . . . . . . . . . . . 196
9.4 Erosion . . . . . . . . . . . . . . . . . . . . . . . . . . 201
9.5 Grayscale Dilation and Erosion . . . . . . . . . . . . . 205
9.6 Opening and Closing . . . . . . . . . . . . . . . . . . . 209
9.7 Grayscale Opening and Closing . . . . . . . . . . . . . 213
9.8 Hit-or-Miss . . . . . . . . . . . . . . . . . . . . . . . . 217
9.9 Thickening and Thinning . . . . . . . . . . . . . . . . 221
9.9.1 Skeletonization . . . . . . . . . . . . . . . . . . 222
9.10 Summary . . . . . . . . . . . . . . . . . . . . . . . . . 224
9.11 Exercises . . . . . . . . . . . . . . . . . . . . . . . . . 224
xii Contents

10 Image Measurements 227


10.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . 227
10.2 Labeling . . . . . . . . . . . . . . . . . . . . . . . . . . 228
10.3 Hough Transform . . . . . . . . . . . . . . . . . . . . . 231
10.3.1 Hough Line . . . . . . . . . . . . . . . . . . . . 232
10.3.2 Hough Circle . . . . . . . . . . . . . . . . . . . 234
10.4 Template Matching . . . . . . . . . . . . . . . . . . . . 238
10.5 Corner Detector . . . . . . . . . . . . . . . . . . . . . 242
10.5.1 FAST Corner Detector . . . . . . . . . . . . . . 243
10.5.2 Harris Corner Detector . . . . . . . . . . . . . . 244
10.6 Summary . . . . . . . . . . . . . . . . . . . . . . . . . 248
10.7 Exercises . . . . . . . . . . . . . . . . . . . . . . . . . 249

11 Neural Network 251


11.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . 251
11.2 Introduction . . . . . . . . . . . . . . . . . . . . . . . . 252
11.3 Mathematical Modeling . . . . . . . . . . . . . . . . . 252
11.3.1 Forward Propagation . . . . . . . . . . . . . . . 252
11.3.2 Back-Propagation . . . . . . . . . . . . . . . . . 254
11.4 Graphical Representation . . . . . . . . . . . . . . . . 256
11.5 Neural Network for Classification Problems . . . . . . 259
11.6 Neural Network Example Code . . . . . . . . . . . . . 259
11.7 Summary . . . . . . . . . . . . . . . . . . . . . . . . . 264
11.8 Exercises . . . . . . . . . . . . . . . . . . . . . . . . . 264

12 Convolutional Neural Network 265


12.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . 265
12.2 Convolution . . . . . . . . . . . . . . . . . . . . . . . . 266
12.3 Maxpooling . . . . . . . . . . . . . . . . . . . . . . . . 267
12.4 LeNet Architecture . . . . . . . . . . . . . . . . . . . . 268
12.5 Summary . . . . . . . . . . . . . . . . . . . . . . . . . 273
12.6 Exercises . . . . . . . . . . . . . . . . . . . . . . . . . 273
Contents xiii

III Image Acquisition 275

13 X-Ray and Computed Tomography 277


13.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . 277
13.2 History . . . . . . . . . . . . . . . . . . . . . . . . . . 277
13.3 X-Ray Generation . . . . . . . . . . . . . . . . . . . . 278
13.3.1 X-Ray Tube Construction . . . . . . . . . . . . 278
13.3.2 X-Ray Generation Process . . . . . . . . . . . . 280
13.4 Material Properties . . . . . . . . . . . . . . . . . . . . 284
13.4.1 Attenuation . . . . . . . . . . . . . . . . . . . . 284
13.4.2 Lambert-Beer Law for Multiple Materials . . . 286
13.4.3 Factors Determining Attenuation . . . . . . . . 287
13.5 X-Ray Detection . . . . . . . . . . . . . . . . . . . . . 288
13.5.1 Image Intensifier . . . . . . . . . . . . . . . . . 289
13.5.2 Multiple-Field II . . . . . . . . . . . . . . . . . 290
13.5.3 Flat Panel Detector (FPD) . . . . . . . . . . . . 291
13.6 X-Ray Imaging Modes . . . . . . . . . . . . . . . . . . 293
13.6.1 Fluoroscopy . . . . . . . . . . . . . . . . . . . . 293
13.6.2 Angiography . . . . . . . . . . . . . . . . . . . . 293
13.7 Computed Tomography (CT) . . . . . . . . . . . . . . 295
13.7.1 Reconstruction . . . . . . . . . . . . . . . . . . 295
13.7.2 Parallel-Beam CT . . . . . . . . . . . . . . . . . 296
13.7.3 Central Slice Theorem . . . . . . . . . . . . . . 296
13.7.4 Fan-Beam CT . . . . . . . . . . . . . . . . . . . 300
13.7.5 Cone-Beam CT . . . . . . . . . . . . . . . . . . 301
13.7.6 Micro-CT . . . . . . . . . . . . . . . . . . . . . 303
13.8 Hounsfield Unit (HU) . . . . . . . . . . . . . . . . . . 304
13.9 Artifacts . . . . . . . . . . . . . . . . . . . . . . . . . . 306
13.9.1 Geometric Misalignment Artifacts . . . . . . . . 307
13.9.2 Scatter . . . . . . . . . . . . . . . . . . . . . . . 307
13.9.3 Offset and Gain Correction . . . . . . . . . . . . 309
13.9.4 Beam Hardening . . . . . . . . . . . . . . . . . 310
13.9.5 Metal Artifacts . . . . . . . . . . . . . . . . . . 311
xiv Contents

13.10 Summary . . . . . . . . . . . . . . . . . . . . . . . . . 311


13.11 Exercises . . . . . . . . . . . . . . . . . . . . . . . . . 313

14 Magnetic Resonance Imaging 315


14.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . 315
14.2 Laws Governing NMR and MRI . . . . . . . . . . . . 316
14.2.1 Faraday’s Law . . . . . . . . . . . . . . . . . . . 316
14.2.2 Larmor Frequency . . . . . . . . . . . . . . . . . 317
14.2.3 Bloch Equation . . . . . . . . . . . . . . . . . . 318
14.3 Material Properties . . . . . . . . . . . . . . . . . . . . 319
14.3.1 Gyromagnetic Ratio . . . . . . . . . . . . . . . 319
14.3.2 Proton Density . . . . . . . . . . . . . . . . . . 320
14.3.3 T1 and T2 Relaxation Times . . . . . . . . . . . 321
14.4 NMR Signal Detection . . . . . . . . . . . . . . . . . . 324
14.5 MRI Signal Detection or MRI Imaging . . . . . . . . . 324
14.5.1 Slice Selection . . . . . . . . . . . . . . . . . . . 326
14.5.2 Phase Encoding . . . . . . . . . . . . . . . . . . 326
14.5.3 Frequency Encoding . . . . . . . . . . . . . . . 327
14.6 MRI Construction . . . . . . . . . . . . . . . . . . . . 327
14.6.1 Main Magnet . . . . . . . . . . . . . . . . . . . 328
14.6.2 Gradient Magnet . . . . . . . . . . . . . . . . . 329
14.6.3 RF Coils . . . . . . . . . . . . . . . . . . . . . . 329
14.6.4 K-Space Imaging . . . . . . . . . . . . . . . . . 330
14.7 T1 , T2 and Proton Density Image . . . . . . . . . . . . 331
14.8 MRI Modes or Pulse Sequence . . . . . . . . . . . . . 333
14.8.1 Spin Echo Imaging . . . . . . . . . . . . . . . . 333
14.8.2 Inversion Recovery . . . . . . . . . . . . . . . . 334
14.8.3 Gradient Echo Imaging . . . . . . . . . . . . . . 335
14.9 MRI Artifacts . . . . . . . . . . . . . . . . . . . . . . . 336
14.9.1 Motion Artifact . . . . . . . . . . . . . . . . . . 337
14.9.2 Metal Artifact . . . . . . . . . . . . . . . . . . . 339
14.9.3 Inhomogeneity Artifact . . . . . . . . . . . . . . 339
14.9.4 Partial Volume Artifact . . . . . . . . . . . . . . 340
Contents xv

14.10 Summary . . . . . . . . . . . . . . . . . . . . . . . . . 340


14.11 Exercises . . . . . . . . . . . . . . . . . . . . . . . . . 341

15 Light Microscopes 343


15.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . 343
15.2 Physical Principles . . . . . . . . . . . . . . . . . . . . 344
15.2.1 Geometric Optics . . . . . . . . . . . . . . . . . 344
15.2.2 Numerical Aperture . . . . . . . . . . . . . . . . 345
15.2.3 Diffraction Limit . . . . . . . . . . . . . . . . . 346
15.2.4 Objective Lens . . . . . . . . . . . . . . . . . . 348
15.2.5 Point Spread Function (PSF) . . . . . . . . . . 349
15.2.6 Wide-Field Microscopes . . . . . . . . . . . . . 350
15.3 Construction of a Wide-Field Microscope . . . . . . . 350
15.4 Epi-Illumination . . . . . . . . . . . . . . . . . . . . . 352
15.5 Fluorescence Microscope . . . . . . . . . . . . . . . . . 352
15.5.1 Theory . . . . . . . . . . . . . . . . . . . . . . . 352
15.5.2 Properties of Fluorochromes . . . . . . . . . . . 353
15.5.3 Filters . . . . . . . . . . . . . . . . . . . . . . . 355
15.6 Confocal Microscopes . . . . . . . . . . . . . . . . . . 356
15.7 Nipkow Disk Microscopes . . . . . . . . . . . . . . . . 357
15.8 Confocal or Wide-Field? . . . . . . . . . . . . . . . . . 359
15.9 Summary . . . . . . . . . . . . . . . . . . . . . . . . . 360
15.10 Exercises . . . . . . . . . . . . . . . . . . . . . . . . . 361

16 Electron Microscopes 363


16.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . 363
16.2 Physical Principles . . . . . . . . . . . . . . . . . . . . 364
16.2.1 Electron Beam . . . . . . . . . . . . . . . . . . 365
16.2.2 Interaction of Electron with Matter . . . . . . . 366
16.2.3 Interaction of Electrons in TEM . . . . . . . . . 368
16.2.4 Interaction of Electrons in SEM . . . . . . . . . 368
16.3 Construction of EMs . . . . . . . . . . . . . . . . . . . 370
16.3.1 Electron Gun . . . . . . . . . . . . . . . . . . . 370
xvi Contents

16.3.2 Electromagnetic Lens . . . . . . . . . . . . . . . 372


16.3.3 Detectors . . . . . . . . . . . . . . . . . . . . . . 373
16.4 Specimen Preparations . . . . . . . . . . . . . . . . . . 374
16.5 Construction of the TEM . . . . . . . . . . . . . . . . 375
16.6 Construction of the SEM . . . . . . . . . . . . . . . . 376
16.7 Factors Determining Image Quality . . . . . . . . . . . 377
16.8 Summary . . . . . . . . . . . . . . . . . . . . . . . . . 379
16.9 Exercises . . . . . . . . . . . . . . . . . . . . . . . . . 380

A Process-Based Parallelism using Joblib 381


A.1 Introduction to Process-Based Parallelism . . . . . . . 381
A.2 Introduction to Joblib . . . . . . . . . . . . . . . . . . 381
A.3 Parallel Examples . . . . . . . . . . . . . . . . . . . . 382

B Parallel Programming using MPI4Py 385


B.1 Introduction to MPI . . . . . . . . . . . . . . . . . . . 385
B.2 Need for MPI in Python Image Processing . . . . . . . 386
B.3 Introduction to MPI4Py . . . . . . . . . . . . . . . . . 387
B.4 Communicator . . . . . . . . . . . . . . . . . . . . . . 388
B.5 Communication . . . . . . . . . . . . . . . . . . . . . . 389
B.5.1 Point-to-Point Communication . . . . . . . . . 389
B.5.2 Collective Communication . . . . . . . . . . . . 391
B.6 Calculating the Value of PI . . . . . . . . . . . . . . . 393

C Introduction to ImageJ 395


C.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . 395
C.2 ImageJ Primer . . . . . . . . . . . . . . . . . . . . . . 396

D MATLAB R and Numpy Functions 399


D.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . 399

Bibliography 403

Index 417
Foreword

I first met one of the authors, Dr. Ravishankar (Ravi) Chityala, in 2006
when he was a PhD student at the Toshiba Stroke Research Center,
SUNY-Buffalo. Ravi’s PhD work in medical imaging was fruitful and
influential, and I have been following his post-PhD career ever since.
In reading this book, I was impressed by the fact that, despite Ravi’s
current focus on computing and visualization, his knowledge of medical
imaging has only deepened and expanded, which has enabled him, along
with his co-author, Dr. Sridevi Pudipeddi, to write a very competent
treatment of the subject of medical imaging. Thus, it is a pleasure for
me to write a foreword to this very good book.
This is a book that every imaging scientist should have on his
or her desk because image acquisition and processing is becoming a
standard method for qualifying and quantifying experimental measure-
ments. Moreover, I believe students and researchers need a course or a
book to learn both image acquisition and image processing using a sin-
gle source, and this book, as a well-rounded introduction to both topics,
serves that purpose very well. The topics treated are complex, but the
authors have done a great job of covering the most commonly used
image acquisition modalities, such as x-ray and computed tomography,
magnetic resonance imaging, and microscopes, concisely and effectively,
providing a handy compendium of the most useful information.
As Confucius said, “I see and I remember, I do and I understand;”
this book aims to provide hands-on learning that enables the reader to
understand the concepts explained in the book by means of applying
the various examples written in the Python code. But do not be dis-
couraged if you have never used Python or any other script language

xvii
xviii Foreword

since learning it is very straightforward. As a long-time Perl user, I had


no problem installing Python and trying several useful examples from
the book. Most of the equations provided in the book are accompanied
by codes that can be quickly run and modified for the reader to test
new ideas and apply to his or her own research.
Being a medical imaging scientist myself, I really enjoyed reading
the sections on x-ray, computed tomography and magnetic resonance
imaging. The authors provide a well-balanced introduction to these
modalities and cover all the important aspects of image acquisition,
as well as image reconstruction and artifacts correction. The authors
also provide a large number of references to other books and papers for
readers interested in learning more details.
In summary, the strengths of the book are:

1. It teaches image processing using Python, one of the easiest and


most powerful programming languages

2. It covers commonly used image acquisition and processing


techniques

3. It cements readers’ understanding with numerous clear examples.

Alexander Zamyatin
Distinguished Scientist
Toshiba Medical Research Institute USA, Inc.
Vernon Hills, Illinois
Preface

We received feedback from people who bought the first edition of the
book and also from experts in the topic while working on the second
edition of the book.
We added three new chapters and one new appendix. When the
first edition was written, machine learning (ML) and deep learning
(DL) were not yet mainstream. Today, problems that cannot be solved
by using traditional image processing and computer vision techniques
are being solved using ML and DL. So we added one chapter on neural
network and another chapter on convolutional neural network (CNN).
In these two chapters, we discuss the mathematical underpinnings of
these two networks. We also discuss solving these two networks using
Keras, a ML / DL library.
We also added a new chapter on affine transformation, a geometric
transformation that preserves lines. We also added an appendix on par-
allel computing using joblib, a Python module that allows distributing
tasks to multiple Python process that can run on multiple cores on a
given computer.
We added new algorithms to existing chapters and also improved
the explanation of the code. Some of the new algorithms introduced
are Frangi filter, Contrast Limited Adaptive Histogram Equaliza-
tion (CLAHE), Local contrast normalization, Chan-Vese segmentation,
Gray scale morphology etc.
When the first edition was written, we used Python 2.7 for testing
the code. As of January 2020, Python 2.7 is no longer supported. So we
modified the code for the latest version of Python 3. We also modified
the code for the latest version of numpy, scipy, scikit and OpenCV.
We hope you enjoy learning from the book.
xix
xx Preface

MATLAB R is a registered trademark of The MathWorks, Inc. For


product information, please contact:
The MathWorks, Inc.
3 Apple Hill Drive
Natick, MA 01760-2098 USA
Tel: 508-647-7000
Fax: 508-647-7001
E-mail: info@mathworks.com
Web: www.mathworks.com
Preface to the First Edition

Image acquisition and processing have become a standard method for


qualifying and quantifying experimental measurements in various Sci-
ence, Technology, Engineering, and Mathematics (STEM) disciplines.
Discoveries have been made possible in medical sciences by advances
in diagnostic imaging such as x-ray based computed tomography (CT)
and magnetic resonance imaging (MRI). Biological and cellular func-
tions have been revealed with new imaging techniques in light based
microscopy. Advancements in material sciences have been aided by elec-
tron microscopy. All these examples and many more require knowledge
of both the physical methods of obtaining images and the analytical
processing methods to understand the science behind the images. Imag-
ing technology continues to advance with new modalities and meth-
ods available to students and researchers in STEM disciplines. Thus,
a course in image acquisition and processing has broad appeal across
the STEM disciplines and is useful for transforming undergraduate and
graduate curriculum to better prepare students for their future.
This book covers both image acquisition and image processing.
Existing books discuss either image acquisition or image processing,
leaving a student to rely on two different books containing different
notations and structures to obtain a complete picture. Integration of
the two is left to the readers.
During the authors’ combined experiences in image processing, we
have learned the need for image processing education. We hope this
book will provide sufficient background material in both image acqui-
sition and processing.

xxi
xxii Preface to the First Edition

Audience
The book is intended primarily for advanced undergraduate and
graduate students in applied mathematics, scientific computing, med-
ical imaging, cell biology, bioengineering, computer vision, computer
science, engineering and related fields, as well as to engineers, profes-
sionals from academia, and the industry. The book can be used as a
textbook for an advanced undergraduate or graduate course, a summer
seminar course, or can be used for self-learning. It serves as a self-
contained handbook and provides an overview of the relevant image
acquisition techniques and corresponding image processing. The book
also contains practice exercises and tips that students can use to remem-
ber key information.

Acknowledgments
We are extremely thankful to students, colleagues, and friends who
gave valuable input during the process of writing this book. We are
thankful to the Minnesota Supercomputing Institute (MSI) at the Uni-
versity of Minnesota. At MSI, Ravi Chityala had discussions with stu-
dents, staff and faculty on image processing. These discussions helped
him recognize the need for a textbook that combines both image pro-
cessing and acquisition.
We want to specially thank Dr. Nicholas Labello, University of
Chicago; Dr. Wei Zhang, University of Minnesota; Dr. Guillermo Mar-
ques, University Imaging Center, University of Minnesota; Dr. Greg
Metzger, University of Minnesota; Mr. William Hellriegel, University of
Minnesota; Dr. Andrew Gustafson, University of Minnesota; Mr. Abhi-
jeet More, Amazon; Mr. Arun Balaji; and Mr. Karthik Bharathwaj for
proofreading the manuscript and for providing feedback.
Preface to the First Edition xxiii

We thank Carl Zeiss Microscopy; Visible Human Project; Siemens


AG; Dr. Uma Valeti, University of Minnesota; Dr. Susanta Hui, Univer-
sity of Minnesota; Dr. Robert Jones, University of Minnesota; Dr. Wei
Zhang, University of Minnesota; Mr. Karthik Bharathwaj for providing
us with images that were used in this book.
We also thank our editor Sunil Nair and editorial assistant
Sarah Gelson; project coordinator Laurie Schlags; project editor Amy
Rodriguez at Taylor and Francis/CRC Press for helping us during the
proofreading and publication process.
Introduction

This book is meant for upper level undergraduates, graduate students


and researchers in various disciplines in science, technology and mathe-
matics. The book covers both image acquisition and image processing.
The knowledge of image acquisition will help readers to perform experi-
ments more effectively and cost efficiently. The knowledge of image pro-
cessing will help the reader to analyze and measure accurately. Through
this book, the concepts of image processing will become ingrained using
examples written using Python, long recognized as one of the easiest
languages for non-programmers to learn.

Python is a good choice for teaching image processing because:

1. It is freely available and open source. Since it is a free software,


all students will have access to it without any restriction.

2. It provides pre-packed installations available for all major plat-


forms at no cost.

3. It is the high-level language of choice for scientists and engineers.

4. It is recognized as perhaps the easiest language to learn for non-


programmers.

Due to new developments in imaging technology as well as the sci-


entific need for higher resolution images, the image data sets are getting
larger every year. Such large data sets can be analyzed quickly using
a large number of computers. Closed source software like MATLAB R
cannot be scaled to a large number of computers as the licensing cost is
high. On the other hand, Python, being free and open-source software,

xxv
xxvi Introduction

can be scaled to thousands of computers at no cost. For these reasons,


we strongly believe the future need for image processing for all students
can be met using Python.
The book consists of three parts: Python programming, image pro-
cessing, and image acquisition. Each of these parts consists of multiple
chapters. The parts are self-contained. Hence, a user well versed in
Python programming can skip Part I and read only Parts II and III.
Each chapter contains many examples, detailed derivations, and work-
ing Python examples of the techniques discussed within. The chapters
are also interspersed with practical tips on image acquisition and pro-
cessing. The end of every chapter contains a summary of the important
points discussed and a list of exercise problems to cement the reader’s
understanding.
Part I consists of introduction to Python, Python modules, read-
ing and writing images using Python, and an introduction to images.
Readers can skip or skim this part if they are already familiar with the
material. This part is a refresher and readers will be directed to other
resources as applicable.
In Part II, we discuss image processing and computer vision algo-
rithms. The various chapters discuss pre- and post-processing using
filters, affine transformation, segmentation, morphological operations,
image measurements, neural network and convolutional neural network.
In Part III, we discuss image acquisition using various modal-
ities such as X-ray, Computed Tomography (CT), Magnetic Reso-
nance Imaging (MRI), light microscopy and electron microscopy. These
modalities cover most of the common image acquisition methods used
currently by researchers in academia and industry.
Details about exercises
The Python programming and image processing parts of the book
contain exercises that test the reader’s skills in Python program-
ming, image processing, and integration of the two. Solutions to odd-
numbered problems, example programs and images are available at
https://github.com/zenr/IMAUP-book-ed-2.
Authors

Ravishankar Chityala, Ph.D. is currently working as Principal Engi-


neer in Silicon Valley. He has more than eighteen years of experience in
image processing. He teaches Python programming and Deep learning
using Tensorflow at the University of California Santa Cruz, Silicon Val-
ley Campus. Previously, he worked as an image processing consultant
at the Minnesota Supercomputing Institute of the University of Min-
nesota. As an image processing consultant, Dr. Chityala had worked
with faculty, students and staff from various departments in the sci-
entific, engineering and medical fields at the University of Minnesota,
and his interaction with students had made him aware of their need
for greater understanding of and ability to work with image processing
and acquisition. Dr. Chityala co-authored “Essential Python” (Essen-
tial Education, California, 2018), also contributed to the writing of
Handbook of Physics in Medicine and Biology (CRC Press, Boca Raton,
2009, Robert Splinter). His research interests are in image processing,
machine learning and deep learning.

Sridevi Pudipeddi, Ph.D. has eleven years experience teaching under-


graduate courses. She teaches Machine Learning with Python and
Python for Data Analysis at the University of California Berkeley
at San Francisco campus. Dr. Pudipeddi’s research interests are in
machine learning, applied mathematics and image and text process-
ing. Python’s simple syntax and its vast image processing capabilities,
along with the need to understand and quantify important experimental
information through image acquisition, have inspired her to co-author
this book. Dr. Pudipeddi co-authored “Essential Python” (Essential
Education, California, 2018).
xxvii
List of Symbols and Abbreviations

P
summation
θ angle
|x| absolute value of x
e 2.718281
∗ convolution
log logarithm base 10
morphological erosion
⊕ morphological dilation
◦ morphological open
• morphological close
∪ union
λ wavelength
E energy
h Planck’s constant
c speed of light
µ attentuation coefficient
γ gyromagnetic ratio
NA numerical aperture
ν frequency
dx differential
∇ gradient

∂x derivative along x-axis
∇2
R =∆ Laplacian
integration
CDF cumulative distribution function
CT computed tomography
DICOM digital imaging and communication in medicine
JPEG joint photographic experts group
MRI magnetic resonance imaging
PET positron emission tomography
PNG portable network graphics
PSF point spread function
RGB red, green, blue channels
TIFF tagged image file format

xxix
Part I

Introduction to Images and


Computing using Python

1
Chapter 1
Introduction to Python

1.1 Introduction
Before we begin discussion on image acquisition and processing
using Python, we will provide an overview of the various aspects of
Python. This chapter focuses on some of the basic materials covered
by many other books [Bea09], [Het10], [Lut06], [Vai09] and also from
the book, “Essential Python” ([PC18]), a book from the authors of this
book. If you are already familiar with Python and are currently using
it, then you can skip this chapter.
We begin with an introduction to Python. We will then discuss
the installation of Python with all the modules using the Anaconda
distribution. Once the installation has been completed, we can begin
exploring the various features of Python. We will quickly review the
various data structures such as list, dictionary, and tuples and state-
ments such as for-loop, if-else, iterators and list comprehension.

1.2 What Is Python?


Python is a popular high-level programming language. It can han-
dle various programming tasks such as numerical computation, web
development, database programming, network programming, parallel
processing, etc.

3
4 Image Processing and Acquisition using Python

Python is popular for various reasons including:

1. It is free.

2. It is available on all the popular operating systems such as Win-


dows, Mac or Linux.

3. It is an interpreted language. Hence, programmers can test por-


tions of code on the command line before incorporating it into
their program. There is no need for compiling or linking.

4. It gives the ability to program faster.

5. It is syntactically simpler than C/C++/Fortran. Hence it is


highly readable and easier to debug.

6. It comes with various modules that are standard or can be


installed in an existing Python installation. These modules can
perform various tasks like reading and writing various files, sci-
entific computation, visualization of data, etc.

7. Programs written in Python can be run on various OS or plat-


forms with little or no change.

8. It is a dynamically typed language. Hence the data type of vari-


ables does not have to be declared prior to their use, making it
easier for people with less coding experience.

9. It has a dedicated developer and user community and is kept up


to date.

Although Python has many advantages that have made it one of


the most popular interpreted languages, it has a couple of drawbacks
that are discussed below:

1. Since its focus is on the ability to program faster, the speed of


execution suffers. A Python program might be 10 times or more
slower (say) than an equivalent C program, but it will contain
Introduction to Python 5

fewer lines of code and can be programmed to handle multiple


data types easily. This drawback in the Python code can be over-
come by converting the computationally intensive portions of the
code to C/C++ or by the appropriate use of data structure and
modules.

2. Indentation of the code is not optional. This makes the code read-
able. However, a code with multiple loops and other constructs
will be indented to the right, making it difficult to read the code.

1.3 Python Environments


There are several Python environments from which to choose. Some
operating systems like Mac, Linux, Unix, etc. have a built-in inter-
preter. The interpreter may contain all modules but is not turn-key
ready for scientific computing. Specialized distributions have been cre-
ated and sold to the scientific community, pre-built with various Python
scientific modules. When using these distributions, the users do not
have to individually install scientific modules. If a particular mod-
ule that is of interest is not available in the distribution, it can be
installed. One of the most popular distributions is Anaconda [Ana20b].
The instructions for installing Anaconda distribution can be found at
https://www.anaconda.com/distribution/.

1.3.1 Python Interpreter

The Python interpreter built into most operating systems can be


started by simply typing python in the terminal window. When the
interpreter is started, a command prompt (>>>) appears. Python com-
mands can be entered at the prompt for processing. For example, in
Mac, when the built-in Python interpreter is started, an output similar
to the one shown below appears:
6 Image Processing and Acquisition using Python

(base) mac:ipaup ravi$ python


Python 3.7.3 | packaged by conda-forge |
(default, Dec 6 2019, 08:36:57)
[Clang 9.0.0 (tags/RELEASE_900/final)] :: Anaconda, Inc.
on darwin
Type "help", "copyright", "credits" or "license"
for more information.
>>>

Notice that in the example above, the Python interpreter is version


3.7.3. It is possible that you might have a different version.

1.3.2 Anaconda Python Distribution

The Anaconda Python Distribution [Ana20a] provides programmers


with close to 100 of the most popular scientific Python modules like sci-
entific computation, linear algebra, symbolic computing, image process-
ing, signal processing, visualization, integration of C/C++ programs to
Python etc. It is distributed and maintained by Continuum Analytics.
It is available for free for academics and is available for a price to all
others. In addition to the various modules built into Anaconda, pro-
grammers can install other modules using the conda [Ana20b] package
manager, without affecting the main distribution.
To access Python from the command line, start the ‘Anaconda
Prompt’ executable and then type python.

1.4 Running a Python Program


Using any Python interpreter (built-in or from a distribution), you
can run your program using the command at the operating system (OS)
command prompt. If the file firstprog.py is a Python file that needs
Introduction to Python 7

to be executed, then type the following command on the OS command


prompt.

>> python firstprog.py

The >> is the terminal prompt and >>> represents the Python
prompt.
The best approach to running Python programs under any oper-
ating systems is to use an Integrated Development Environment like
IDLE or Spyder as it provides an ability to edit the file and also run it
under the same interface.

1.5 Basic Python Statements and Data Types

Indentation
In Python, a code block is indicated by indentation. For example in
the code below, we first print a message, ‘We are computing squares of
numbers between 0 and 9’. Then we loop through values in the range
of 0 to 9 and store it in the variable ‘i’ and also print the square of ‘i’.
Finally we print the message, ‘We completed the task ...’ at the end.
In other languages, the code block under the for-loop would be
identified with a pair of curly braces {}. However, in Python we do
not use curly braces. The code block is identified by moving the line
print(i*i) four spaces to the right. You can also choose to use a tab
instead.

print('Computing squares of numbers between 0 and 9')


for i in range(10):
print(i*i)
print('Completed the task ...')

There is a significant disadvantage to indentation especially to


new Python programmers. A code containing multiple for-loops and
8 Image Processing and Acquisition using Python

if-statements will be indented farther to the right making the code


unreadable. This problem can be alleviated by reducing the number of
for-loops and if-statements. This not only makes the code readable but
also reduces computational time. This can be achieved by programming
using data structures like lists, dictionary, and sets appropriately.

Comments
Comments are an important part of any programming language. In
Python, a single line comment is denoted by a hash # at the beginning
of a line. Multiple lines can be commented by using triple quoted strings
(triple single quotes or triple double quotes) at the beginning and at
the end of the block.

# This is a single line comment

'''
This is
a multiline
comment
'''

# Comments are a good way to explain the code.

Variables
Python is a dynamic language and hence you do not need to specify
the variable type as in C/C++. Variables can be imagined as contain-
ers of values. The values can be an integer, float, string, lists, tuples,
dictionary, set, etc.

>>> a = 1
>>> a = 10.0
>>> a = 'hello'
Introduction to Python 9

In the above example the integer value of 1, float value of 10.0, and
a string value of hello for all cases are stored in the same variable.
However, only the last assigned value is the current value for a.
Operators
Python supports all the common arithmetic operators such as
+, −, ∗, /. It also supports the common comparison operators such
as >, <, ==, ! =, >=, <=, etc. In addition, through various modules
Python provides many operators for performing trigonometric, mathe-
matical, geometric operations, etc.
Loops
The most common looping construct in Python is the for-loop
statement, which allows iterating through the collection of objects. Here
is an example:

>>> for i in range(1,5):


... print(i)

In the above example the output of the for-loop are the numbers
from 1 to 5. The range function allows us to create values starting from
1 and ending with 5. Such a concept is similar to the for-loop normally
found in C/C++ or most programming languages.
The real power of for-loop lies in its ability to iterate through
other Python objects such as lists, dictionaries, sets, strings, etc. We
will discuss these Python objects in more detail subsequently.

>>> a = ['python', 'scipy']


>>> for i in a:
... print(i)

In the program above, the for-loop iterates through each element


of the list and prints it.
In the next program, the content of a dictionary is printed using the
for-loop. A dictionary with two keys lang and ver is defined. Then,
using the for-loop, the various keys are iterated and the corresponding
values are printed.
10 Image Processing and Acquisition using Python

>>> a = {
'lang':'python'
'ver': '3.6.6'
}
>>> for keys in a:
... print(a[key])

The discussion about using a for-loop for iterating through the


various lines in a text file, such as comma separated value file, is post-
poned to a later section.
if-else statement
The if-else is a popular conditional statement in all programming
languages including Python. An example of if-elif-else statement
is shown below.

if a<10:
print('a is less than 10')
elif a<20:
print('a is between 10 and 20')
else:
print('a is greater than 20')

The if-else statement conditionals do not necessarily have to use


the conditional operators such as <, >, ==, etc.
For example, the following if statement is legal in Python. This if
statement checks for the condition that the list d is not empty.

>>> d = [ ]
>>> if d:
... print('d is not empty')
... else:
... print('d is empty')

d is empty
Introduction to Python 11

In the above code, since d is empty, the else clause is true and we
enter the else block and print d is empty.

1.5.1 Data Structures

The real power of Python lies in the liberal usage of its data struc-
ture. The common criticism of Python is that it is slow compared to
C/C++. This is especially true if multiple for-loops are used in pro-
gramming Python. This can be alleviated by appropriate use of data
structures such as lists, tuples, dictionary and sets. We describe each
of these data structures in this section.
Lists
Lists are similar to arrays in C/C++. But, unlike arrays in C/C++,
lists in Python can hold objects of any type such as int, float, string and
including another list. Lists are mutable, as their size can be changed
by adding or removing elements. The following examples will help show
the power and flexibility of lists.

>>> a = ['python','scipy', 3.6]


>>> a.pop(-1)
3.6
>>> print(a)
a = ['python','scipy']
>>> a.append('numpy')
>>> print(a)
['python','scipy', 3.6]
>>> print(a[0])
python
>>> print(a[-1])
numpy
>>> print(a[0:2])
['python','scipy']
12 Image Processing and Acquisition using Python

In the first line, a new list is created. This list contains two strings
and one floating-point number. In the second line, we use the pop func-
tion to remove the last element (index = −1). The popped element
is printed to the terminal. After the pop, the list contains only two
elements instead of the original three. We use append, and insert a
new element, “numpy” to the end of the list. Finally, in the next two
commands we print the value of the list in index 0 and the last posi-
tion indicated by using “−1” as the index. In the last command, we
introduce slicing and obtain a new list that contains only the first two
values of the list. This indicates that one can operate on the list using
methods such as pop, insert, or remove and also using operators such
as slicing.
A list may contain another list. Here is an example. We will consider
the case of a list containing four numbers and arranged to look like a
matrix.

>>> a = [[1,2],[3,4]]
>>> print(a[0])
[1,2]
>>> print(a[1])
[3,4]
>>> print(a[0][0])
1

In line 1, we define a list of the list. The values [1, 2] are in the
first list and the values [3, 4] are in the second list. The two lists are
combined to form a 2D list. In the second line, we print the value of
the first element of the list. Note that this prints the first row or the
first list and not just the first cell. In the fourth line, we print the value
of the second row or the second list. To obtain the value of the first
element in the first list, we need to index the list as given in line 6. As
you can see, indexing the various elements of the list is as simple as
calling the location of the element in the list.
Introduction to Python 13

Although the list elements can be individually operated, the power


of Python is in its ability to operate on the entire list at once using list
methods and list comprehensions.
List functions/methods
Let us consider the list that we created in the previous section.
We can sort the list using the sort method as shown in line 2. The
sort method does not return a list; instead, it modifies the current list.
Hence the existing list will contain the elements in a sorted order. If
a list contains both numbers and strings, Python sorts the numerical
values first and then sorts the strings in alphabetical order.

>>> a = ['python','scipy','numpy']
>>> a.sort()
>>> a
['numpy','python','scipy']

List comprehensions
A list comprehension allows building a list from another list. Let us
consider the case where we need to generate a list of squares of numbers
from 0 to 9. We will begin by generating a list of numbers from 0 to 9.
Then we will determine the square of each element.

>>> a = list(range(10))
>>> print(a)
[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
>>> b = [x*x for x in a]
[0, 1, 4, 9, 16, 25, 36, 49, 64, 81]
>>> b = []
>>> for x in a:
b.append(x*x)
>>> print(b)
[0, 1, 4, 9, 16, 25, 36, 49, 64, 81]

In line 1, a list is created containing values from 0 to 9 using the


function “range” and the print command is given in line 2. In line
14 Image Processing and Acquisition using Python

number 4, list comprehension is performed by taking each element in


’a’ and multiplying by itself. The result of the list comprehension is
shown in line 5. The same operation can be performed by using lines
6 to 8 but the list comprehension approach is compact in syntax as it
eliminates two lines of code, one level of indentation, and a for-loop. It
is also faster when applied to a large list.
For a new Python programmer, the list comprehension might seem
daunting. The best way to understand and read a list comprehension is
by imagining that you will first operate on the for-loop and then begin
reading/writing the left part of the list comprehension. In addition to
applying for-loop using list comprehension, you can also apply logical
operations like if-else.

Tuples
Tuples are similar to lists except that they are not mutable, i.e.,
the length and the content of the tuple cannot be changed at runtime.
Syntactically, the list uses [ ] while tuples use ( ). Similar to lists,
tuples may contain any data type including other tuples. Here are a
few examples:

>>> a = (1,2,3,4)
>>> print(a)
(1,2,3,4)
>>> b = (3,)
>>> c = ((1,2),(3,4))

In line 1, we define a tuple containing four elements. In line 4, we


define a tuple containing only one element. Although the tuple contains
only one element, we need to add the trailing comma, so that Python
understands it as a tuple. Failure to add a comma at the end of this
tuple will result in the value 3 being treated as an integer and not a
tuple. In line 5, we create a tuple inside another tuple.
Introduction to Python 15

Sets
A set is an unordered collection of unique objects. To create a set,
we need to use the function set or the operator {}. Here are some
examples:

>>> s1 = set([1,2,3,4])
>>> s2 = set((1,1,3,4))
>>> print(s2)
set([1,3,4])

In line 1, we create a set from a list containing four values. In line


2, we create a set containing a tuple. The elements of a set need to be
unique. Hence when the content of s2 is printed, we notice that the
duplicates have been eliminated. Sets in Python can be operated using
many of the common mathematical operations on sets such as union,
intersection, set difference, symmetric difference, etc.
Since sets do not store repeating values and since we can convert
lists and tuples to sets easily, they can be used to perform useful oper-
ations faster which otherwise would involve multiple loops and condi-
tional statements. For example, a list containing only unique values can
be obtained by converting the list to a set and back to a list. Here is
an example:

>>> a = [1,2,3,4,3,5]
>>> b = set(a)
>>> print(b)
set([1,2,3,4,5])
>>> c = list(b)
>>> print(c)
[1,2,3,4,5]

In line 1, we create a list containing six values with one duplicate.


We convert the list into a set by using the set() function. During this
process, the duplicate value 3 is eliminated. We can then convert the
set back to list using the list() function.
16 Image Processing and Acquisition using Python

Dictionaries
Dictionaries store key-value pairs. A dictionary is created by enclos-
ing a key-value pair inside { }.

>>> a = {
'lang':'python'
'ver': '3.6.6'
}

Any member of the dictionary can be accessed using [ ] operator.

>>> print a['lang']


python

To add a new key,

>>> a['creator'] = 'Guido Von Rossum'


>>> print(a)
{'lang': 'python', 'ver': '3.6.6', 'creator': 'Guido Von
Rossum'}

In the example above, we added a new key called creator and stored
the string, “Guido Von Rossum.”
In certain instances, the dictionary membership needs to be tested
using the ‘in’ operator. To obtain a list of all the dictionary keys, use
the keys() method.

1.5.2 File Handling

This book is on image processing; however, it is important to under-


stand and be able to include in your code, reading and writing text files
so that the results of computation can be written or the input param-
eters can be read from external sources. Python provides the ability
to read and write files. It also has functions, methods and modules for
reading specialized formats such as the comma separated value (csv)
file, Microsoft Excel (xls) format, etc. We will look into each method
in this section.
Introduction to Python 17

The following code reads a csv file as a text file.

>>> fo = open('myfile.csv')
>>> for i in fo.readlines():
... print(i)
>>> fo.close()
Python,3.6.6

Django, 3.0.5

Apache, 2.4

The first line opens a file and returns a new file object which is
stored in the file object “fo.” The method readlines in line 2, reads
all the lines of input. The for-loop then iterates over each of those lines,
and prints. The file is finally closed using the close method.
The output of the print command is a string. Hence, string manip-
ulation using methods like split, strip, etc., needs to be applied in order
to extract elements of each column. Also, note that there is an extra
newline character at the end of each print statement.

Reading CSV files


Instead of reading a csv file as a text file, we can use the csv module.

>>> import csv


>>> for i in csv.reader(open('myfile.csv')):
... print(i)
['Python', '3.6.6']
['Django', ' 3.0.5']
['Apache', ' 2.4']

The first line imports the csv module. The second line opens and
reads the content of the csv file using the reader function in the csv
module. In every iteration of the loop, the content of one line of the csv
file is returned and stored in the variable ‘i’. Finally, the value of ‘i’ is
printed.
18 Image Processing and Acquisition using Python

Reading Excel files


Microsoft Excel files can be read and written using the openpyxl
module. The openpyxl module has to be installed before we can use it.
To install this module, you can go to the Python prompt and type ‘pip
install openpyxl’. Alternately, the module can be installed by selecting
the Environment tab in Anaconda Navigator. Here is a simple example
of reading an Excel file using the openpyxl module.

from openpyxl import load_workbook


wb = load_workbook('myfile.xlsx')
for sheet in wb:
for row in sheet.values:
for col in row:
print(col, end=' | ')
print()

In line 2, the open workbook() function is used to read the file. We


loop through all sheets in the file. In this particular example, there is
only one sheet. Then we loop through each row in the sheet followed
by looping through every column. In the print function where the value
in a column is printed, we are indicating that a column must be sepa-
rated from the next column by a | (pipe symbol). Finally the last print
function adds a new line, so that the next row can be printed in a new
line.

Date | Time |
2020-01-02 00:00:00 | 10:15:00 |
2020-01-05 00:00:00 | 11:00:00 |
2020-01-07 00:00:00 | 15:00:00 |

1.5.3 User-Defined Functions

A function is a reusable section of code that may take input and


may or may return an output. If there is any block of code that will be
Introduction to Python 19

called many times, it is advisable to convert it to a function. Calls can


then be made to this function.
A Python function can be created using the def keyword. Here is
an example:

import math
def circleproperties(r):
area = math.pi*r*r;
circumference = 2*math.pi*r
return area, circumference

a, c = circleproperties(5) # Radius of the circle is 5


print("Area and Circumference of the circle are", a, c)

The function circleproperties takes in one input argument, the


radius (r). The return statement at the end of the function definition
passes the computed values (in this case, area and circumference) to the
calling function. To invoke the function, use the name of the function
and provide the radius value as an argument enclosed in parentheses.
Finally, the area and circumference of the circle are displayed using the
print function call.
The variables area and circumference have local scope. Hence the
variables cannot be invoked outside the body of the function. It is
possible to pass on variables to a function that have global scope using
the global statement.
When we run the above program, we get the following output:

Area and Circumference of the circle are 78.539 31.415

1.6 Summary
• Python is a popular high-level programming language. It is used
for most common programming tasks such as scientific computa-
tion, text processing, building dynamic websites, etc.
20 Image Processing and Acquisition using Python

• Python distributions such as Anaconda Python distribution are


pre-built with many scientific modules and enable scientists to
focus on their research instead of installation of modules.

• Python, like other programming languages, uses common rela-


tional and mathematical operators, comment statements, for-
loops, if-else statements, etc.

• To program like a Pythonista, use lists, sets, dictionary and tuples


liberally.

• Python can read most of the common text formats like CSV,
Microsoft Excel, etc.

1.7 Exercises
1. If you are familiar with any other programming language, list the
differences between that language and Python.

2. Write a Python program that will print numbers from 10 to 20


using a for-loop.

3. Create a list of state names such as states = [‘Minnesota’, ‘Texas’,


‘New York’, ‘Utah’, ‘Hawaii’]. Add another entry ‘California’ to
the end of the list. Then, print all the values of this list.

4. Print the content of the list from Question 3 and also the
corresponding index using the list's enumerate method in the
for-loop.

5. Create a 2D list of size 3-by-3 with the following elements:


1, 2, 3|4, 5, 6|6, 7, 8

6. It is easy to convert a list to a set and vice versa. For exam-


ple, a list ‘mylist = [1, 1, 2, 3, 4, 4, 5]0 can be converted to a set
Introduction to Python 21

using the command newset = set(mylist). The set can be con-


verted back to a list using newlist = list(newset). Compare
the contents of mylist and newlist. What do you infer?

7. Look up documentation for the join method and join the con-
tents of the list [‘Minneapolis’,‘MN’,‘USA’] and obtain the string
‘Minneapolis, MN, USA.’

8. Consider the following Python code:

a = [1,2,3,4,2,3,5]
b = []
for i in a:
if i>2:
b.append(i)
print(b)

Rewrite the above code using list comprehension and reduce the
number of lines.
Bibliography

[ABC+ 16] Martin Abadi, Paul Barham, Jianmin Chen, Zhifeng Chen,
Andy Davis, Jeffrey Dean, Matthieu Devin, Sanjay Ghe-
mawat, Geoffrey Irving, Michael Isard, Manjunath Kudlur,
Josh Levenberg, Rajat Monga, Sherry Moore, Derek G.
Murray, Benoit Steiner, Paul Tucker, Vijay Vasudevan,
Pete Warden, Martin Wicke, Yuan Yu, and Xiaoqiang
Zheng. Tensorflow: A system for large-scale machine learn-
ing. In 12th USENIX Symposium on Operating Systems
Design and Implementation (OSDI 16), pages 265–283,
2016.

[AFFV98] Koen L. Vinc Alejandro F. Frangi, Wiro J. Niessen and


Max A. Viergever. Multiscale vessel enhancement filtering.
Medical Image Computing and Computer-Assisted Inter-
vention (MICCAI) Lecture Notes in Computer Science,
1998.

[Ana20a] Continuum Analytics. Anaconda. www.anaconda.com,


2020. Accessed on 14 January 2020.

[Ana20b] Continuum Analytics. conda. http://docs.conda.io, 2020.


Accessed on 14 January 2020.

[Bea09] D.M. Beazley. Python: Essential Reference. Addison-


Wesley Professional, Boston, MA, 2009.

[Bir11] W. Birkfellner. Applied Medical Image Processing: A Basic


Course. Taylor & Francis, Boca Raton, FL, 2011.

23
24 Bibliography

[BK04] J. Barrett and N. Keat. Artifacts in CT: Recognition and


avoidance. Radiographics, 24(6):1679–1691, 2004.

[BR98] J.J. Bozzola and L.D. Russell. Electron Microscopy, 2nd


ed. Jones & Bartlett, Burlington, MA, 1998.

[Bra78] R.N. Bracewell. Fourier Transform and its Applications.


McGraw-Hill, New York, NY, 1978.

[Bra99] R.N. Bracewell. The Impulse Symbol. McGraw-Hill, New


York, NY, 1999.

[Bre12] E. Bressert. SciPy and NumPy. O’Reilly Media,


Sebastopol, CA, 2012.

[BS13] F.J. Blanco-Silva. Learning SciPy for Numerical and Scien-


tific Computing. Packt Publishing, Birmingham, England,
2013.

[Bus88] S.C. Bushong. Magnetic Resonance Imaging. CV Mosby,


St. Louis, MO, 1988.

[Bus00] S. Bushong. Computed Tomography. Essentials of medical


imaging series. McGraw-Hill Education, 2000.

[C+ 20] François Chollet et al. Keras. https://keras.io, 2020.


Accessed on 22 Jan 2020.

[Can86] J. Canny. A computational approach to edge detection.


IEEE Transactions on Pattern Analysis and Machine Intel-
ligence, 8(6):679–698, 1986.

[CDM84a] T.S. Curry, J.E. Dowdey, and R.C. Murray. Introduction


to the Physics of Diagnostic Radiology. Lea and Febiger,
Philadelphia, PA, 1984.

[CDM84b] T.S. Curry, J.E. Dowdey, and R.C. Murry. Christensen’s


Introduction to Physics of Diagnostic Radiology. Lippincott
Williams and Wilkins, Philadelphia, PA, 1984.
Bibliography 25

[CMSJ05] Y. Cho, D.J. Moseley, J.H. Siewerdsen, and D.A. Jaf-


fray. Accurate technique for complete geometric calibra-
tion of cone-beam computed tomography systems. Medical
Physics, 32:968–983, 2005.

[CT65] J.W. Cooley and J.W. Tukey. An algorithm for the machine
calculation of complex Fourier series. Mathematics of Com-
putation, 19:297–301, 1965.

[CV99] Tony Chan and Luminita Vese. An active contour model


without edges. Scale-Space Theories in Computer Vision,
pages 141–151, 1999.

[Dim12] C.A. Dimarzio. Optics for engineers. CRC Press, Boca


Raton, FL, 2012.

[DKJ06] D. Dowsett, P.A. Kenny, and R.E. Johnston. The Physics


of Diagnostic Imaging, 2nd ed. CRC Press, Boca Raton,
FL, 2006.

[Dom15] Pedro Domingos. The Master Algorithm: How the Quest for
the Ultimate Learning Machine Will Remake Our World.
Basic Books, 2015.

[Dou92] E.R. Dougherty. Introduction to Morphological Image Pro-


cessing. SPIE International Society for Optical Engineer-
ing, 1992.

[DR03] M.J. Dykstra and L.E. Reuss. Biological Electron


Microscopy: Theory, Techniques, and Troubleshooting.
Kluwer Academic/Plenum Publishers, Dordrecht, The
Netherlands, 2003.

[ED82] J. C. Elliott and S. D. Dover. X-ray microtomography.


Journal of Microscopy, 126(2):211–213, 1982.

[Eva10] L.C. Evans. Partial Differential Equations, 2nd ed. Amer-


ican Mathematical Society, 2010.
26 Bibliography

[FDK84] L. Feldkamp, L. Davis, and J. Kress. Practical cone beam


algorithm. Journal of the Optical Society of America,
A6:612–619, 1984.

[FH00] R. Fahrig and D.W. Holdsworth. Three-dimensional com-


puted tomographic reconstruction using a c-arm mounted
xrii: Image-based correction of gantry motion nonidealities.
Medical Physics, 27(1):30–38, 2000.

[Fuk80] Kunihiko Fukushima. Neocognitron: A self-organizing neu-


ral network model for a mechanism of pattern recogni-
tion unaffected by shift in position. Biological Cybernetics,
36(4):193–202, Apr 1980.

[GBC16] Ian Goodfellow, Yoshua Bengio, and Aaron Courville.


Deep Learning. MIT Press, 2016. http://www.
deeplearningbook.org.

[GLS99] W. Gropp, E.L. Lusk, and A. Skjellum. Using MPI, 2nd


ed. The MIT Press, Boston, MA, 1999.

[Gol03] J. Goldstein. Scanning Electron Microscopy and X-ray


Microanalysis, volume v. 1. Kluwer Academic/Plenum
Publishers, Dordrecht, The Netherlands, 2003.

[Gro17] Aurlien Gron. Hands-On Machine Learning with Scikit-


Learn and TensorFlow: Concepts, Tools, and Techniques to
Build Intelligent Systems. O?Reilly Media, Inc., 1st edition,
2017.

[GT01] D. Gilbarg and N.S. Trudinger. Elliptic Partial Differential


Equations. Springer, New York, NY, 2001.

[GWE09] R.C. Gonzalez, R.E. Woods, and S.L. Eddins. Digital image
processing using MATLAB R , 2nd ed. Gatesmark Publish-
ing, TN, 2009.
Bibliography 27

[Haj99] A.N. Hajibagheri. Electron Microscopy: Methods and Pro-


tocols. Humana Press, New York, NY, 1999.

[Hay00] A. Hayat. Principles and Techniques of Electron


Microscopy: Biological Applications. Cambridge University
Press, Cambridge, England, 2000.

[HBS13] C.L.L. Hendriks, G. Borgefors, and R. Strand. Mathemat-


ical Morphology and Its Applications to Signal and Image
Processing. Springer, New York, NY, 2013.

[Hen83] W.R. Hendee. The Physical Principles of Computed Tomog-


raphy. Little, Brown library of radiology. Little Brown, New
York, NY, 1983.

[Het10] M.L. Hetland. Python Algorithms: Mastering Basic Algo-


rithms in the Python Language. Apress, New York, NY,
2010.

[HK93] S.L. Fleglerand J.W. Heckman and K.L. Klomparens. Scan-


ning and Transmission Electron Microscopy: An Introduc-
tion. Oxford University Press, Oxford, England, 1993.

[HL93] B. Herman and J.J. Lemasters. Optical microscopy: Emerg-


ing Methods and Applications. Academic Press, Waltham,
MA, 1993.

[Hor95] A.L. Horowitz. MRI Physics for Radiologists: A Visual


Approach. Springer-Verlag, New York, NY, 1995.

[HS88] Chris Harris and Mike Stephens. A combined corner and


edge detector. In Proc. of Fourth Alvey Vision Conference,
pages 147–151, 1988.

[Hsi03] J. Hsieh. Computed Tomography: Principles, Design, Arti-


facts, and Recent Advances. SPIE, 2003.
28 Bibliography

[HWJ98] L. Hong, Y. Wan, and A. Jain. Fingerprint image enhance-


ment: algorithm and performance evaluation. IEEE Trans-
actions on Pattern Analysis and Machine Intelligence,
20(8):777–789, 1998.

[Idr12] I. Idris. NumPy Cookbook. Packt Publishing, Birmingham,


England, 2012.

[IK87] J. Illingworth and J. Kittler. The adaptive Hough trans-


form. IEEE Transactions on Pattern Analysis and Machine
Intelligence, 9(5):690–698, 1987.

[IK88] J. Illingworth and J. Kittler. A survey of the Hough trans-


form. Computer Vision, Graphics, and Image Processing,
44(1):87–116, 1988.

[Ins20] National Health Institute. ImageJ documentation. http:


//imagej.nih.gov/ij/docs/guide/, 2020. Accessed on
21 Jan 2020.

[JKRL09] K. Jarrett, K. Kavukcuoglu, M. Ranzato, and Y. LeCun.


What is the best multi-stage architecture for object recog-
nition? 2009 IEEE 12th International Conference on Com-
puter Vision, pages 2146–2153, Sep. 2009.

[Job20] Joblib. https://joblib.readthedocs.io/, 2020.


Accessed on 21 January 2020.

[JS78] P.M. Joseph and R.D. Spital. A method for correcting bone
induced artifacts in computed tomography scanners. Jour-
nal of Computer Assisted Tomography, 2:100–108, 1978.

[Kal00] W. Kalender. Computed Tomography: Fundamentals, Sys-


tem Technology, Image Quality, Applications. Publicis
MCD Verlag, 2000.
Bibliography 29

[KB46] E. Kohl and W. Burton. The Electron Microscope; An


Introduction to Its Fundamental Principles and Applica-
tions. Reinhold, 1946.

[Key97] R.J. Keyse. Introduction to Scanning Transmission Elec-


tron Microscopy. Microscopy Handbooks. Bios Scientific
Publishers, Oxford, England, 1997.

[KS88] A.C. Kak and M. Slaney. Principles of Computerized Tomo-


graphic Imaging. IEEE Press, New York, NY, 1988.

[Kuo07] J. Kuo. Electron Microscopy: Methods and Protocols. Meth-


ods in Molecular Biology. Humana Press, New York, NY,
2007.

[LBBH98] Y. Lecun, L. Bottou, Y. Bengio, and P. Haffner. Gradient-


based learning applied to document recognition. Proceed-
ings of the IEEE, 86(11):2278–2324, Nov 1998.

[LBD+ 89] Y. LeCun, B. Boser, J. S. Denker, D. Henderson, R. E.


Howard, W. Hubbard, and L. D. Jackel. Backpropagation
applied to handwritten zip code recognition. Neural Com-
putation, 1(4):541–551, Dec 1989.

[LCB10] Yann LeCun, Corinna Cortes, and CJ Burges. Mnist


handwritten digit database. ATT Labs. Available:
http://yann.lecun.com/exdb/mnist, 2, 2010.

[Lew95] J.P. Lewis. Fast template matching. Vision Interface,


95:120–123, 1995.

[LK87] L.A. Love and R.A. Kruger. Scatter estimation for a digital
radiographic system using convolution filtering. Medical
Physics, 14(2):178–185, 1987.

[LLM86] H. Li, M.A. Lavin, and R.J. Le Master. Fast hough trans-
form: A hierarchical approach. Computer Vision, Graphics,
and Image Processing, 36(2-3):139–161, 1986.
30 Bibliography

[Lut06] M. Lutz. Programming Python. O’Reilly, Sebastopol, CA,


2006.

[Mac83] A. Macovski. Medical Imaging Systems. Prentice Hall,


Upper Saddle River, NJ, 1983.

[Mar72] A. Martelli. Edge detection using heuristic search meth-


ods. Computer Graphics and Image Processing, 1(2):169–
182, 1972.

[Mas20] et al Mason, D. L. https://github.com/pydicom/


pydicom, 2020. Accessed on 22 Jan 2020.

[Mat20a] Materialise. MimicsTM . http://biomedical.


materialise.com/mimics, 2020. Accessed on 22 Jan
2020.

[Mat20b] Mathworks. Matlab R . https://www.mathworks.com/,


2020. Accessed on 21 Jan 2020.

[MB90] F. Meyer and S. Beucher. Morphological segmentation.


Journal of Visual Communication and Image Representa-
tion, 1(1):21–46, 1990.

[McR03] D.W. McRobbie. MRI from Picture to Proton. Cambridge


University Press, Cambridge, England, 2003.

[Mer10] J. Mertz. Introduction to Optical Microscopy. Roberts and


Company, Greenwood Village, CO, 2010.

[Mey92] F. Meyer. Color image segmentation. Proceedings of


the International Conference on Image Processing and its
Applications, pages 303–306, 1992.

[Mey94] F. Meyer. Topographic distance and watershed lines. Signal


Processing, 38:113–125, 1994.
Bibliography 31

[MH80] D. Marr and E. Hildreth. Theory of edge detection. Pro-


ceedings of the Royal Society of London. Series B, Biological
Sciences, 207(1167):187–217, 1980.

[MPI20] MPI4Py.org. Mpi4py. https://mpi4py.readthedocs.io/,


2020. Accessed on 22 Jan 2020.

[MTH] Mark H. Beale Orlando De Jesus Martin T. Hagan, Howard


B. Demuth. Neural Network Design (2nd Edition). http:
//hagan.okstate.edu/NNDesign.pdf.

[MW98] J.A. Markisz and J.P. Whalen. Principles of MRI: Selected


Topics. Appleton & Lange, East Norwalk, CT, 1998.

[NT10] L. Najman and H. Talbot. Mathematical Morphology.


Wiley-ISTE, 2010.

[OFKR99] B. Ohnesorge, T. Flohr, and K. Klingenbeck-Regn. Efficient


object scatter correction algorithm for third and fourth gen-
eration CT scanners. European Radiology, 9:563–569, 1999.

[Ope20a] OpenCV. http://docs.opencv.org, 2020. Accessed on 21


Jan 2020.

[Ope20b] OpenMP.org. OpenMP. http://openmp.org/, 2020.


Accessed on 22 Jan 2020.

[OR89] S. Osher and L.I. Rudin. Feature-oriented image enhance-


ment using shock filters. SIAM Journal Numerical Analy-
sis, 27(4):919–940, 1989.

[Ots79] N. Otsu. A threshold selection method from gray level his-


tograms. IEEE Transactions on Systems, Man and Cyber-
netics, 9(1):62–66, 1979.

[Pac11] P. Pacheco. An Introduction to Parallel Programming. Mor-


gan Kaufmann, Burlington, MA, 2011.
32 Bibliography

[Par91] J.R. Parker. Gray level thresholding in badly illumi-


nated images. IEEE Transactions on Pattern Analysis and
Machine Intelligence, 13:813–819, 1991.

[PC18] Sridevi Pudipeddi and Ravi Chityala. Essential Python.


Essential Education, 2018.

[PK81] S.K. Pal and R.A. King. Image enhancement using smooth-
ing with fuzzy sets. IEEE Transactions on Systems, Man,
and Cybernetics, 11(7):494–501, 1981.

[PK91] M. Petrou and J. Kittler. Optimal edge detectors for


ramp edges. IEEE Transactions on Pattern Analysis and
Machine Intelligence, 13(5):483–491, 1991.

[ppr20] Hubel Weisel Nobel prize press release. https:


//www.nobelprize.org/prizes/medicine/1981/
press-release/, 2020. Accessed on 19 January 2020.

[Pre70] J.M.S. Prewitt. Object enhancement and extraction. Pic-


ture Processing and Psychopictorics, pages 75–149, 1970.

[R9̈5] W. Röntgen. On a new kind of rays. Würzburg Physical


and Medical Society, 137:132–141, 1895.

[RD06] Edward Rosten and Tom Drummond. Machine learning for


high-speed corner detection. ECCV, 2006.

[RDLF05] K. Rogers, P. Dowswell, K. Lane, and L. Fearn. The


Usborne Complete Book of the Microscope: Internet Linked.
Complete Books. EDC Publishing, Tulsa, OK, 2005.

[Ren61] A. Renyi. On measures of entropy and information. Pro-


ceedings of Fourth Berkeley Symposium on Mathematics
Statistics and Probability, pages 547–561, 1961.

[RHW86] David E. Rumelhart, Geoffrey E. Hinton, and Ronald J.


Williams. Learning representations by back-propagating
errors. Nature, 323(6088):533–536, 1986.
Bibliography 33

[Rob77] G.S. Robinson. Detection and coding of edges using direc-


tional masks. Optical Engineering, 16(6):166580–166580,
1977.

[Ror20] Chris Rorden. https://people.cas.sc.edu/rorden/


ezdicom/index.html, 2020. Accessed on 22 Jan 2020.

[Rus11] J.C. Russ. The Image Processing Handbook, 6th ed. CRC
Press, Boca Raton, FL, 2011.

[SAR20] Pixmeo SARL. http://www.osirix-viewer.com/, 2020.


Accessed on 22 Jan 2020.

[Sch89] R.J. Schalkoff. Digital Image Processing and Computer


Vision. Wiley, New York, 1989.

[Sch04] H.M. Schey. Div, Grad, Curl, and All That, 4th ed. W.W.
Norton and Company, New York, NY, 2004.

[Sci20a] Scikits.org. Scikits. http://scikit-image.org/docs/


dev/api/api.html, 2020. Accessed on 22 Jan 2020.

[Sci20b] SciPy.org. Numpy to MATLAB r . https://docs.scipy.


org/doc/numpy/user/numpy-for-matlab-users.html,
2020. Accessed on 21 Jan 2020.

[Sci20c] SciPy.org. Scipy. http://docs.scipy.org/doc/scipy/


reference, 2020. Accessed on 22 Jan 2020.

[Sci20d] SciPy.org. Scipy ndimage. http://docs.scipy.org/doc/


scipy/reference/ndimage.html, 2020. Accessed on 22
Jan 2020.

[Ser82] J. Serra. Image analysis and mathematical morphology.


Academic Press, Waltham, MA, 1982.

[Sha48] C.E. Shannon. A mathematical theory of communication.


Bell System Technical Journal, 27:379–423, 1948.
34 Bibliography

[Sha96] V.A. Shapiro. On the Hough transform of multi-level pic-


tures. Pattern Recognition, 29(4):589–602, 1996.

[SHB+ 99] M. Sonka, V. Hlavac, R. Boyle, et al. Image Processing,


Analysis, and Machine Vision. PWS, Pacific Grove, CA,
1999.

[Si20] Scikits-image.org. Scikits-image. https://scikit-image.


org/docs/dev/api/skimage.measure.html, 2020.
Accessed on 22 Jan 2020.

[Smi07] J.O. Smith. Mathematics of Discrete Fourier Transform:


With Audio Applications. W3K, 2007.

[Soi04] P. Soille. Morphological Image Analysis: Principles and


Applications, 2nd ed. Springer, New York, NY, 2004.

[SPK98] L. Shafarenko, H. Petrou, and J. Kittler. Histogram-based


segmentation in a perceptually uniform color space. IEEE
Transactions on Image Processing, 7(9):1354–1358, 1998.

[Spl10] R. Splinter. Handbook of Physics in Medicine and Biology.


CRC Press, Boca Raton, FL, 2010.

[SS94] J. Serra and P. Soille. Mathematical Morphology and Its


Applications to Image Processing. Springer, New York, NY,
1994.

[SS03] E. Stein and R. Shakarchi. Fourier Analysis: An Introduc-


tion. Princeton University Press, Princeton, NJ, 2003.

[SSW88] P.K. Sahoo, S. Soltani, and A.K.C. Wong. A survey of


thresholding techniques. Computer Vision, Graphics, and
Image Processing, 4(8):233–260, 1988.

[Vai09] S. Vaingast. Beginning Python Visualization: Crafting


Visual Transformation Scripts. Apress, New York, NY,
2009.
Bibliography 35

[Wat97] I.M. Watt. The Principles and Practice of Electron


Microscopy. Cambridge University Press, Cambridge, Eng-
land, 1997.

[Wes09] C. Westbrook. MRI at a Glance. Wiley, New York, NY,


2009.

[WSOV96] G. Wang, D.L. Snyder, J.A. O’Sullivan, and M.W. Vannier.


Iterative deblurring for CT metal artifact reduction. IEEE
Transactions on Medical Imaging, 15:657–664, 1996.

[WSS01] Wes Wallace, Lutz H. Schaefer, and Jason R. Swedlow. A


working persons guide to deconvolution in light microscopy.
BioTechniques Open Access., 31(5):1076–1097, 2001.

[XO93] L. Xu and E. Oja. Randomized Hough transform:


Basic mechanisms, algorithms, and computational com-
plexities. Computer Vision, Graphics, and Image Process-
ing, 57(2):131–154, 1993.

[ZMP+ 02] W. Zhang, S. Mukhopadhyay, S.V. Pletnev, T.S. Baker,


R.J. Kuhn, and M.G. Rossmann. Placement of the struc-
tural proteins in Sindbis virus. Journal of Virology,
76:11645–11658, 2002.

[Zui94] Karel Zuiderveld. Contrast limited adaptive histogram


equalization. Graphics gems IV, pages 474–485, 1994.

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy