0% found this document useful (0 votes)
52 views26 pages

Lecture14 - MRI Processing (Python)

The document outlines a lecture on MR image processing, covering programming languages suitable for biomedical engineering, Python IDEs, and the basics of medical imaging. It discusses medical image processing techniques such as preprocessing, segmentation, and integration of AI, along with file formats like DICOM and alternatives. Additionally, it includes exercises related to noise addition, SNR measurement, and k-space sampling in MRI imaging.
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)
52 views26 pages

Lecture14 - MRI Processing (Python)

The document outlines a lecture on MR image processing, covering programming languages suitable for biomedical engineering, Python IDEs, and the basics of medical imaging. It discusses medical image processing techniques such as preprocessing, segmentation, and integration of AI, along with file formats like DICOM and alternatives. Additionally, it includes exercises related to noise addition, SNR measurement, and k-space sampling in MRI imaging.
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

MR Image Processing

Instructor: Kisoo Kim

Department of Biomedical Engineering


Kyung Hee University

1
This Lecture is based on a basic programming
(BME213)

2
Programming
Language

Language Application Strengths Weaknesses


JavaScript Web, Mobile, Server Versatile, Strong Ecosystem Runtime Errors
Python AI, Data Science, Web Easy, Extensive Libraries Slower Execution
HTML/CSS Web Development Core Web Tech Not a Language
SQL Databases Efficient Queries Limited Use
Java Enterprise, Android Portable, Secure Verbose Syntax
C# Windows, Unity Games Strong .NET Support Microsoft Focused
C/C System, Gaming High Performance Complex Syntax
TypeScript Web, Large Apps Type Safe JS Needs Compilation
Swift iOS/macOS Fast, Safe Apple Only
PHP Web Backend Easy Deployment Security Issues
Go Cloud, Networking Scalable, Fast Few Libraries
Kotlin Android Modern Android Small Community
R Data Analysis Great for Stats Not General Use
Rust System Programming Memory Safe Steep Learning Curve
Ruby Web Friendly Syntax Declining Popularity
Dart Mobile, Web Flutter Support Smaller Ecosystem
Scala Big Data Functional OOP Complex Learning
Perl Scripting Text Processing Outdated Use
3
Python IDE

Integrated Development Environment IDE

• VS Code
• Anaconda
• Colab
• Pycharm
• Spyder
• Atom

4
How to use the Python in the computer ???
2 Anaconda distribution

• Easy to manage coding scripts e.g., Library


• Include many packages
• Install Python, Jupyter Notebook, …

5
Website download
How to use the Python in the computer ???

6
How to use the Python in the computer ???

Jupyter Notebook, Jupyterlab Web based computing

1. User Interface
•Jupyter Notebook: Simple, easy-to-learn interface; ideal for
beginners.
•Jupyter Lab: More flexible and customizable; better suited
for large or complex projects.

2. File Management
•Jupyter Notebook: Each notebook is saved as a separate
file, requiring manual organization.
•Jupyter Lab: Includes a file browser, allowing easy creation,
editing, and management of files and directories.

3. Document Support
•Jupyter Notebook: Primarily focused on notebook (.ipynb)
files.
•Jupyter Lab: Supports multiple document types, including
notebooks, scripts, and markdown files, making it more
useful for data science and machine learning workflows.

4. Use Cases
•Jupyter Notebook: Best for beginners, small-scale projects,
and quick experiments.
•Jupyter Lab: Designed for advanced users handling
complex projects, providing a more powerful and extensible
workspace.
7
How to use the Python in the computer ???
3 VS Code
• Free open source
editor by Microsoft
• Support many
languages
• Good for debugging,
highlight, auto filling,
etc

8
How to use the Python in the computer ???
3 VS Code
Install Python
1 Open VS code
2 Search python →
3 Create a new file↓

9
How to use the Python in the computer ???
4 Google Colab

• Jupyter based web service


• Available Google server and GPU server Cloud computing
• Most of libraries are available through the google server
• Good for collaboration, testing before going into a project
• Still developing …

10
How to use the Python in the computer ???
4 Google Colab

11
Medical Imaging Processing (in BME213 lectures)

12
What is a Medical Image ?

• Medical imaging refers to the visualization of the


internal structures and physiological functions of
the human body.

• It is widely used for disease diagnosis, treatment


planning, surgical guidance, and treatment
evaluation.

• Medical images are acquired using various


imaging modalities, including X-ray, Computed
Tomography (CT), Magnetic Resonance Imaging
(MRI), Ultrasound, and Positron Emission
Tomography (PET).

13
Medical Image Processing
Preprocessing
• Denoising: Removing noise to enhance image clarity
• Contrast Enhancement: Adjusting contrast to improve visibility of structures
• Normalization: Ensuring consistent brightness and resolution across images

Image Segmentation
• Automatically distinguishing specific organs or lesions for further analysis
• Deep learning models such as U-Net and CNNs are widely used

Image Registration & Reconstruction


• Aligning multiple images for comparative analysis
• 3D modeling for surgical guidance

Feature Extraction & Analysis


• Quantitative analysis of lesion size, shape, and density for diagnosis

Integration of AI in Medical Imaging


Recently, deep learning-based AI technologies have been actively applied in
medical image analysis.
14
Image

• In computer, an image is defined by a Matrix

15
Medical image file format

DICOM Digital Imaging and Communications in


Medicine

• Industry standard format for storing and


transmitting medical images.

• Used for X ray, CT, MRI, and ultrasound images.

• Stores both image data and metadata patient


information, scan parameters, device details .

• Ensures compatibility across different imaging


systems through a standardized protocol.

• Used with PACS Picture Archiving and


Communication System for hospital wide
storage and retrieval.

16
Medical image file format
DICOM files are divided into:

1. Header (Metadata):
• Contains key patient and scan information.
• Example tags:
• Patient’s Name (0010,0010)
• Patient ID (0010,0020)
• Modality (0008,0060) - Indicates scan type (CT, MRI, etc.)
• Image Position/Orientation - Defines spatial alignment.

2. Image Data:
• Stores pixel values for high-resolution medical images.
• Supports multi-dimensional (2D, 3D, 4D) datasets.
• Allows lossless storage for accurate medical diagnosis.

17
Alternative image file formats
NIfTI (.nii, .[Link])
• Designed for neuroimaging, especially MRI brain scans.
• Supports 3D and 4D datasets in a single file.
• Efficient storage and compression options (e.g., .[Link] for reduced file size).

Nrrd (.nrrd)
• Developed for storing multidimensional scientific data, including medical images.
• Used in volumetric imaging, scientific visualization, and AI applications.
• Compatible with tools like ITK (Insight Segmentation and Registration Toolkit) and VTK (Visualization Toolkit).

MHA/MHD (MetaImage)
• Supports multidimensional medical imaging with metadata.
• Frequently used in ITK-based medical image processing.
• MHD file: Text-based metadata; MHA file: Includes both metadata and binary image data.

Common Image Formats (JPG, PNG, TIFF)


• JPG (JPEG): Lossy compression, small file size, but image quality degradation.
• PNG: Lossless compression, supports transparency, but lacks multi-dimensional storage.
• TIFF: High-quality, lossless format; supports metadata storage, but large file size.
18
Basic MR Image Processing

19
How to open an image in Python ???

• Python Modules: pydicom, SimpleITK

• pip install pydicom

20
Quality Assurance QA : SNR Measurement

For quality control purposes, we are concerned with random background noise, primarily thermal in nature,
arising from radiofrequency coil resistance, electronic noise in the preamplifier, and dielectric and inductive
losses in the imaged object.

𝜇!"#$%&'
SNR =
𝜎#(&)*+,"-.

𝜇: mean
𝜎: standard deviation

[Link] 21
White Noise
In Python,

We can use the numpy module

[Link] start , end : random number in a range of start , end

[Link] m,n : matrix m,n , 0 1 random uniform distribution

[Link] m,n : matrix m,n , mean 0, std 1 gaussian distribution white noise

Random noise, 10 % of
the maximum intensity 22
Exercise

• Add 5%, 10%, 15% noise to the original image


• Calculate SNR and compare them

23
k space However, this is not a real k-space because it is
reconstructed from the magnitude image

24
Under sampled k space

Random sampled k-space:


Line 126~130 is kept because it has
low-frequency components of the
image (important structure
information)
25
Exercise

• Make evenly-undersampled k-space (50% sampled, 25% sampled)


• Look at aliasing artifacts
• Make a real random sampled k-space with dots, not random lines

Report comparison between artifacts from these sampling methods

*This report provides 10 scores to the final exam score (out of 100)
If you submit a sucessful report, you will get 10/100

26

You might also like