ebook img

MATLAB for Medical Physics: Real-life Clinical Scenarios and Projects PDF

288 Pages·2023·8.134 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 MATLAB for Medical Physics: Real-life Clinical Scenarios and Projects

Jidi Sun MATLAB for Medical Physics Real-life Clinical Scenarios and Projects MATLAB for Medical Physics Jidi Sun MATLAB for Medical Physics Real-life Clinical Scenarios and Projects Jidi Sun Peter MacCallum Cancer Centre Melbourne, VIC, Australia ISBN 978-981-19-9856-0 ISBN 978-981-19-7565-3 (eBook) https://doi.org/10.1007/978-981-19-7565-3 © The Editor(s) (if applicable) and The Author(s), under exclusive license to Springer Nature Singapore Pte Ltd. 2023 This work is subject to copyright. All rights are solely and exclusively licensed by the Publisher, whether the whole or part of the material is concerned, specifically the rights of translation, reprinting, reuse of illustrations, recitation, broadcasting, reproduction on microfilms or in any other physical way, and transmission or information storage and retrieval, electronic adaptation, computer software, or by similar or dissimilar methodology now known or hereafter developed. The use of general descriptive names, registered names, trademarks, service marks, etc. in this publication does not imply, even in the absence of a specific statement, that such names are exempt from the relevant protective laws and regulations and therefore free for general use. The publisher, the authors, and the editors are safe to assume that the advice and information in this book are believed to be true and accurate at the date of publication. Neither the publisher nor the authors or the editors give a warranty, expressed or implied, with respect to the material contained herein or for any errors or omissions that may have been made. The publisher remains neutral with regard to jurisdictional claims in published maps and institutional affiliations. This Springer imprint is published by the registered company Springer Nature Singapore Pte Ltd. The registered company address is: 152 Beach Road, #21-01/04 Gateway East, Singapore 189721, Singapore To my wife Qiusi Li and our daughter Jacqueline Sun I love you forever Preface During the past 13 years of researching, teaching, clinical training and work, I have been using MATLAB to find effective and efficient solutions to daily problems and to create multiple open-source automatic image quality assurance software. In mid- 2019, I had this idea to share my MATLAB experiences with the medical physics community through some of the work that I have done over the past years. MATLAB is a mature, well-resourced, constantly maintained and updated commercial programming software. It allows users to perform numerical analysis, but more importantly MATLAB comes with a large collection of toolboxes that are designed for solving standard problems in different areas. Because of this, MATLAB has been widely used in the scientific and engineering areas. As a result, MATLAB becomes one of the mandatory undergraduate courses at many universities. The best way to learn MATLAB is by solving problems. Often the undergraduate course briefly introduces the basics of MATLAB and teaches students using some general mathematical problems as examples. For medical physics postgraduate students and clinical medical physicists, the clinical scenarios are more relevant because they are the daily problems that physicists face. Therefore, this book uses the clinical scenarios as examples to introduce and demonstrate MATLAB with supplied data files. This book is structured into two main parts. The first part (Chap. 1) introduces the fundamentals of the MATLAB software, so that the readers can be confident to use MATLAB to solve simple problems. This part is designed for readers who has no or limited experiences in MATLAB. It first introduces the MATLAB software layout to help readers to orient around the software. Then it showed readers various ways to get help. Finally, the basics of MATLAB is introduced systematically with over 100 examples. In terms of the knowledge introduced in this part, it is not too different from other MATLAB introduction textbooks. However, I have used clinically relevant problems in some examples where are appropriate. The intermediate and advanced MATLAB users can skip the first part. The second part of the book (Chaps. 2–4) focuses on using MATLAB to solve routine clinical problems that medical physicists may face on daily basis. A total of 18 real-life clinical scenarios were included to demonstrate how to use MATLAB to solve complex problems. The scenarios cover vii viii Preface areas including DICOM file manipulation, film dosimetry, brachytherapy application, linac and CT quality assurance and their automations. Some of these 18 scenarios were further modified to expand to additional 23 clinical scenario expansions. For all the examples and clinical scenarios and their expansions in this book, the step- by-step solutions are provided as well as coding explanations. The data files (e.g. DICOM) used for all clinical scenarios are provided. The code and data files can be downloaded from one of the following links (https://www.dropbox.com/sh/t9r xtglw8yz0yaf/AADHHVwxSiga3gGlBIN75lFOa?dl=0 or https://drive.google.com/ drive/folders/1ZjZyfB9fFIBNiJ9qOdWE7KRQKd__58TT). I have a medical physics background rather than computer science, so the solutions given in this book are limited by my knowledge and experiences. With my best effort, I have minimised bugs in the solution code to make sure they are runnable. There is often no unique solution to a problem. The solutions in this book are not necessarily the most efficient ones but rather one of many ways to solve the problem. Some of the solutions were deliberately made more complicated than needed just to demonstrate some of MATLAB functions where applicable. Readers are encouraged to modify, improve and find better solutions. Learning by doing and have fun. English is my second language, so some paragraphs may not be concise. I apologise in advance for the grammar mistakes that cause readers trouble while reading this book. This book is primarily written for medical physics students and clinical medical physicists. As a potential textbook for medical physics students, the clinical back- grounds at the beginning of the clinical scenarios briefly introduce the relevant medical physics knowledge. For clinical medical physicists who want to learn MATLAB, hopefully the clinical scenarios in this book can put the programming problems into context they are familiar with. Melbourne, Australia Jidi Sun Contents 1 Introduction of MATLAB ....................................... 1 1.1 MATLAB Window Layout ................................. 1 1.2 Where to Get Help ........................................ 4 1.2.1 In-software Help ................................... 5 1.2.2 Online Community Support ......................... 10 1.3 MATLAB Basic ........................................... 11 1.3.1 Data Types and Manipulations ....................... 11 1.3.2 File and Directory ................................. 27 1.3.3 Graph Plotting ..................................... 31 1.3.4 Image Display ..................................... 37 1.3.5 Basic Image Processing ............................. 41 1.3.6 Basic Data Analysis ................................ 51 1.3.7 Control Flows ..................................... 56 1.3.8 User-Defined Function .............................. 64 1.4 DICOM-RT File Reading and Manipulation ................... 67 1.4.1 Types of DICOM-RT File ........................... 67 1.4.2 Read DICOM Attributes ............................ 68 1.4.3 Extract DICOM Image ............................. 69 1.4.4 Write DICOM File ................................. 69 1.4.5 Search DICOM Attribute ........................... 70 Reference ...................................................... 71 2 Data Reading, Manipulation and Displaying ...................... 73 2.1 Varian RPM VXP File ..................................... 73 2.1.1 Clinical Background ............................... 73 2.1.2 Clinical Scenario .................................. 73 2.1.3 Clinical Scenario Expansion A ....................... 77 2.1.4 Clinical Scenario Expansion B ....................... 79 ix x Contents 3 DICOM File Functions in MATLAB ............................. 83 3.1 Compare Specific DICOM Attribute Among Different DICOM Files ............................................. 83 3.1.1 Clinical Background ............................... 83 3.1.2 Initial Clinical Scenario ............................. 83 3.1.3 Clinical Scenario Expansion A ....................... 88 3.1.4 Clinical Scenario Expansion B ....................... 89 3.2 Differentiate DICOM Files in a Folder Based on Specific DICOM Header Information ................................ 92 3.2.1 Clinical Background ............................... 92 3.2.2 Initial Clinical Scenario ............................. 92 3.2.3 Clinical Scenario Expansion A ....................... 97 3.2.4 Clinical Scenario Expansion B ....................... 100 3.2.5 Clinical Scenario Expansion C ....................... 104 3.3 Anonymise DICOM File ................................... 107 3.3.1 Clinical Background ............................... 107 3.3.2 Initial Clinical Scenario ............................. 107 3.4 Modify DICOM-RT QA Plan File ........................... 109 3.4.1 Clinical Background ............................... 109 3.4.2 Initial Clinical Scenario ............................. 110 3.4.3 Clinical Scenario Expansion A ....................... 112 3.5 Invert Pixel Values on All DICOM Images in a Folder .......... 114 3.5.1 Initial Clinical Scenario ............................. 114 3.6 Check Whether the Planned MU Has Been Completely Delivered on an EPID Image ................................ 117 3.6.1 Clinical Background ............................... 117 3.6.2 Initial Clinical Scenario ............................. 117 References ..................................................... 121 4 Image Display, Processing and Analysis .......................... 123 4.1 Dosimetry: Scanner Reproducibility .......................... 123 4.1.1 Clinical Background ............................... 123 4.1.2 Initial Clinical Scenario ............................. 123 4.1.3 Clinical Scenario Expansion A ....................... 129 4.1.4 Clinical Scenario Expansion B ....................... 131 4.2 Dosimetry: Film Calibration ................................ 134 4.2.1 Clinical Background ............................... 134 4.2.2 Initial Clinical Scenario ............................. 134 4.2.3 Clinical Scenario Expansion A ....................... 142 4.2.4 Clinical Scenario Expansion B ....................... 144 4.2.5 Clinical Scenario Expansion C ....................... 148 4.3 Brachytherapy: HDR Source Position QA Using Film .......... 151 4.3.1 Clinical Background ............................... 151 4.3.2 Initial Clinical Scenario ............................. 152 Contents xi 4.4 OBI: KV Imager Centre versus Gantry Angle ................. 159 4.4.1 Clinical Background ............................... 159 4.4.2 Initial Clinical Scenario ............................. 161 4.4.3 Clinical Scenario Expansion A ....................... 170 4.5 OBI: Leeds Phantom High-Contrast Spatial Resolution Test ..... 176 4.5.1 Clinical Background ............................... 176 4.5.2 Initial Clinical Scenario ............................. 177 4.5.3 Clinical Scenario Expansion B ....................... 196 4.6 EPID: EPID Centre and Scaling QA Using Graticule ........... 200 4.6.1 Clinical Background ............................... 200 4.6.2 Initial Clinical Scenario ............................. 202 4.6.3 Clinical Scenario Expansion A ....................... 213 4.7 MLC: EPID Picket Fence QA ............................... 217 4.7.1 Clinical Background ............................... 217 4.7.2 Initial Clinical Scenario ............................. 217 4.8 CT: MAR (Metal Artefact Reduction) Image Analysis .......... 227 4.8.1 Clinical Background ............................... 227 4.8.2 Initial Clinical Scenario ............................. 228 4.8.3 Clinical Scenario Expansion A ....................... 235 4.8.4 Clinical Scenario Expansion B ....................... 238 4.8.5 Clinical Scenario Expansion C ....................... 242 4.9 CT: Catphan QA HU Reproducibility Test .................... 245 4.9.1 Clinical Background ............................... 245 4.9.2 Initial Clinical Scenario ............................. 246 4.9.3 Clinical Scenario Expansion A ....................... 252 4.10 CT: Automatically Find Catphan QA Sections ................. 254 4.10.1 Clinical Background ............................... 254 4.10.2 Initial Clinical Scenario ............................. 255 4.11 X-ray QA Using Step Wedge ................................ 268 4.11.1 Clinical Background ............................... 268 4.11.2 Initial Clinical Scenario ............................. 268 4.11.3 Clinical Scenario Expansion A ....................... 274 4.11.4 Clinical Scenario Expansion B ....................... 275 References ..................................................... 278

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.