SlideShare a Scribd company logo
IMAGES
ARE ARRAY
[PART 2:
DICOM]
Nada Fitrieyatul Hikmah
Loading Images (DICOM)
• imageio : read and save images.
Loading Images
• Slice the array by specifying values along each available dimension.
Metadata
• Images are always
acquired in a specific
context. This
information is often
referred to as
metadata.
• Accessible in image
objects through the
meta dictionary
attribute.
Plotting Images
• Matplotlib's imshow()
function displays 2D image
data.
• Many colormaps available but
ofen shown in grayscale
( cmap='gray' )
• Axis ticks and labels are
often not useful for images
N-DIMENSIONAL
IMAGES
N-dimensional
images are stacks of
arrays
Loading volumes directly
Imageio.volread() :
• Read multi-dimensional data
directly.
• Assemble a volume from multiple
images
Sampling and field of view
• Sampling rate: physical
space covered by each
element.
• Field of view: physical
space covered along each
axis.
IMAGE PLOTTING
Plotting multiple images at once
• plt.subplots: creates
a figure canvas with
multiple
AxesSubplots
objects.
Another views
Modifying the aspect ratio
(1)
• Many datasets do not have equal sampling
rates across all dimensions. In these
cases, we will want to stretch the pixels
along one side to account for the
differences.
• Any two dimensions of an array can form
an image, and slicing along different axes
can provide a useful perspective.
• However, unequal sampling rates can
create distorted images.
• Changing the aspect ratio can address
this by increasing the width of one of the
dimensions.
Modifying the aspect ratio (2)
• This results in a properly proportioned image.
• Failing to adjust the aspect would have resulted
in a distorted image.
OTHER WAYS…
Handle DICOM Files (1)
References :
(1) Albertina, B., Watson, M.,Holback, C., Jarosz, R., Kirk, S., Lee, Y., …
Lemmerman, J. (2016). Radiology Data from The Cancer Genome Atlas Lung
Adenocarcinoma [TCGA-LUAD] collection. The Cancer Imaging
Archive. http://doi.org/10.7937/K9/TCIA.2016.JGNIHEP5
(2) Clark K, Vendt B, Smith K, Freymann J, Kirby J, Koppel P, Moore S, Phillips S,
Maffitt D, Pringle M, Tarbox L, Prior F. The Cancer Imaging Archive (TCIA):
Maintaining and Operating a Public Information Repository, Journal of Digital
Imaging, Volume 26, Number 6, December, 2013, pp 1045-1057.
Handle DICOM Files (2)
Download data:
 Log in to Kaggle
 Open link :
https://www.kaggle.com/kmader/siim-
medical-images?select=dicom_dir
Click on Download
Imports
 pathlib for easy path handling
 pydicom to handle dicom files
 matplotlib for visualization
 numpy to create the 3D container
Read a single dcm file
All information
about dicom file can
be accessed.
Show dicom image
Get information about shape of
image :
3D Data
 Data of full head MRI scan :
https://zenodo.org/record/16956#.
YFMM5PtKiV5
 Ref : Lionheart, W. R. B. (2015).
An MRI DICOM data set of the
head of a normal male human aged
52 [Data set].
Zenodo. http://doi.org/10.5281/zen
odo.16956
Make list of 3D Data (1)
Use the glob function to return all items
in a directory which correspond to the
provided pattern. As in this case, the
directory only contains the DICOM files
 return all files in it ("*")
Make list of 3D Data (2)
It is possible that the DICOM files are not ordered according to their actual image
position  This can be verified by inspecting the SliceLocation.
Make list of 3D Data (3)
It crucial to order them  use the "SliceLocation" attribute passed to
the sorted function to identify the 2D slice position and thus order the slices.
Store 3D data in a list
Extract the actual data (pixel_arrays) from Dicome files and store in a list:
Show 3D data
Some slices of the ordered 3D volume:
NIfTI
(NEUROIMAGING INFORMATICS TECHNOLOGY
INITIATIVE)
What is NIfTI?
 An open file format for storage of medical image data (historically used for
neuroimaging – hence the name, but not restricted to neuroimaging).
 Efficiently store medical image data together with necessary metadata.
 Mainly used in research settings.
 Not a clinical standard.
Structure
 Header : Containing information mainly about image geometry (resolution,
position, orientation).
 Body : Actual image pixel data (2D, 3D, 4D, …)
 In general, easier to handle than DICOM files.
 File extension usually “.nii” or “.nii-gz” (compressed version)
How to work with NIfTI files
 Python libraries : NiBabel, SimpleITK.
 Image viewer : 3D Slicer (www.slicer.org)
 Transform DICOM to NIfTI in Python  dicom2nifti
Convert DICOM to NIfTI
Convert DICOM to NIfTI using last DICOM data :
Generating file 201_t2w_tse.nii.gz in the path_to_nifti.
 Creating complete 3D MRI Scan.
Read NIfTI files (1)
 nibabel to handle nifti files
 matplotlib to plot the brain images
 load using nib.load(path)
Read NIfTI files (2)
Image Shape and Image Pixel Data
Obtaining image pixel data  The image pixel data can be extracted using the
get_fdata() function of the nifti object.
View the image

More Related Content

PDF
Using DICOM and NIfTI in R
PDF
PDF
dFuse: An Optimized Compression Algorithm for DICOM-Format Image Archive
PDF
Implementation of Brain Tumor Extraction Application from MRI Image
PPTX
Structure of DICOM Image
PDF
Biomedical Engineering (Medical Equipment's) - Mathankumar.S - VMKVC, SALEM,...
PPTX
Mohannad hussain dicom and imaging tools
PPTX
Data De-identification
Using DICOM and NIfTI in R
dFuse: An Optimized Compression Algorithm for DICOM-Format Image Archive
Implementation of Brain Tumor Extraction Application from MRI Image
Structure of DICOM Image
Biomedical Engineering (Medical Equipment's) - Mathankumar.S - VMKVC, SALEM,...
Mohannad hussain dicom and imaging tools
Data De-identification

Similar to Images are array for medical image processing (20)

PPT
Bimcv eub heidelberg
DOCX
Conquest for dummies: how to setup a pacs server
PPTX
Recent Developments in Free Medical Imaging Software
PPTX
Public Databases for Radiomics Research: Current Status and Future Directions
PPT
Application Hosting
PDF
IMAGE PROCESSING - MATHANKUMAR.S - VMKVEC
PDF
TO DEVELOP A DICOM VIEWER TOOL FOR VIEWING JPEG 2000 IMAGE AND PATIENT INFORM...
PPTX
Mohannad hussain community track - siim dataset & dico mweb proxy
PPT
dicom.ppt
PDF
Data De-identification
PPT
DOCX
Intelligent generator of big data medical
PPTX
Data Explosion in Medical Imaging
PDF
A N E XQUISITE A PPROACH FOR I MAGE C OMPRESSION T ECHNIQUE USING L OSS...
PDF
AN EXQUISITE APPROACH FOR IMAGE COMPRESSION TECHNIQUE USING LOSSLESS COMPRESS...
PDF
Data preparation for artificial intelligence in medical imaging - A comprehen...
PPT
Nrrd to Dicom Conversion-3769
PDF
OpenAIRE webinar: Principles of Research Data Management, with S. Venkatarama...
PPTX
Medical Image Compression with security & water marking
PDF
Data Standards in Radiomics Research
Bimcv eub heidelberg
Conquest for dummies: how to setup a pacs server
Recent Developments in Free Medical Imaging Software
Public Databases for Radiomics Research: Current Status and Future Directions
Application Hosting
IMAGE PROCESSING - MATHANKUMAR.S - VMKVEC
TO DEVELOP A DICOM VIEWER TOOL FOR VIEWING JPEG 2000 IMAGE AND PATIENT INFORM...
Mohannad hussain community track - siim dataset & dico mweb proxy
dicom.ppt
Data De-identification
Intelligent generator of big data medical
Data Explosion in Medical Imaging
A N E XQUISITE A PPROACH FOR I MAGE C OMPRESSION T ECHNIQUE USING L OSS...
AN EXQUISITE APPROACH FOR IMAGE COMPRESSION TECHNIQUE USING LOSSLESS COMPRESS...
Data preparation for artificial intelligence in medical imaging - A comprehen...
Nrrd to Dicom Conversion-3769
OpenAIRE webinar: Principles of Research Data Management, with S. Venkatarama...
Medical Image Compression with security & water marking
Data Standards in Radiomics Research
Ad

More from Nada Hikmah (6)

PDF
Application NAÏVE BAYES CLASSIFIER for cancer
PDF
Part 1 Clinical Decision Support System v2.pdf
PDF
Curve Fitting in Numerical Methods Regression
PDF
[2] Computed Tomography (CT) Imaging v2.pdf
PDF
[1] MEDICAL IMAGING, X-RAY.pdf
PDF
[0] BASIC CONCEPT OF IMAGE.pdf
Application NAÏVE BAYES CLASSIFIER for cancer
Part 1 Clinical Decision Support System v2.pdf
Curve Fitting in Numerical Methods Regression
[2] Computed Tomography (CT) Imaging v2.pdf
[1] MEDICAL IMAGING, X-RAY.pdf
[0] BASIC CONCEPT OF IMAGE.pdf
Ad

Recently uploaded (20)

PPTX
IMMUNITY IMMUNITY refers to protection against infection, and the immune syst...
PPTX
Microbial diseases, their pathogenesis and prophylaxis
PDF
Abdominal Access Techniques with Prof. Dr. R K Mishra
PDF
Saundersa Comprehensive Review for the NCLEX-RN Examination.pdf
PDF
O7-L3 Supply Chain Operations - ICLT Program
PDF
Microbial disease of the cardiovascular and lymphatic systems
PPTX
Final Presentation General Medicine 03-08-2024.pptx
PDF
O5-L3 Freight Transport Ops (International) V1.pdf
PDF
Complications of Minimal Access Surgery at WLH
PPTX
master seminar digital applications in india
PDF
Chapter 2 Heredity, Prenatal Development, and Birth.pdf
PDF
Module 4: Burden of Disease Tutorial Slides S2 2025
PPTX
Pharma ospi slides which help in ospi learning
PDF
01-Introduction-to-Information-Management.pdf
PPTX
Cell Types and Its function , kingdom of life
PPTX
PPT- ENG7_QUARTER1_LESSON1_WEEK1. IMAGERY -DESCRIPTIONS pptx.pptx
PDF
VCE English Exam - Section C Student Revision Booklet
PDF
Pre independence Education in Inndia.pdf
PDF
Supply Chain Operations Speaking Notes -ICLT Program
PPTX
GDM (1) (1).pptx small presentation for students
IMMUNITY IMMUNITY refers to protection against infection, and the immune syst...
Microbial diseases, their pathogenesis and prophylaxis
Abdominal Access Techniques with Prof. Dr. R K Mishra
Saundersa Comprehensive Review for the NCLEX-RN Examination.pdf
O7-L3 Supply Chain Operations - ICLT Program
Microbial disease of the cardiovascular and lymphatic systems
Final Presentation General Medicine 03-08-2024.pptx
O5-L3 Freight Transport Ops (International) V1.pdf
Complications of Minimal Access Surgery at WLH
master seminar digital applications in india
Chapter 2 Heredity, Prenatal Development, and Birth.pdf
Module 4: Burden of Disease Tutorial Slides S2 2025
Pharma ospi slides which help in ospi learning
01-Introduction-to-Information-Management.pdf
Cell Types and Its function , kingdom of life
PPT- ENG7_QUARTER1_LESSON1_WEEK1. IMAGERY -DESCRIPTIONS pptx.pptx
VCE English Exam - Section C Student Revision Booklet
Pre independence Education in Inndia.pdf
Supply Chain Operations Speaking Notes -ICLT Program
GDM (1) (1).pptx small presentation for students

Images are array for medical image processing

  • 2. Loading Images (DICOM) • imageio : read and save images.
  • 3. Loading Images • Slice the array by specifying values along each available dimension.
  • 4. Metadata • Images are always acquired in a specific context. This information is often referred to as metadata. • Accessible in image objects through the meta dictionary attribute.
  • 5. Plotting Images • Matplotlib's imshow() function displays 2D image data. • Many colormaps available but ofen shown in grayscale ( cmap='gray' ) • Axis ticks and labels are often not useful for images
  • 8. Loading volumes directly Imageio.volread() : • Read multi-dimensional data directly. • Assemble a volume from multiple images
  • 9. Sampling and field of view • Sampling rate: physical space covered by each element. • Field of view: physical space covered along each axis.
  • 11. Plotting multiple images at once • plt.subplots: creates a figure canvas with multiple AxesSubplots objects.
  • 13. Modifying the aspect ratio (1) • Many datasets do not have equal sampling rates across all dimensions. In these cases, we will want to stretch the pixels along one side to account for the differences. • Any two dimensions of an array can form an image, and slicing along different axes can provide a useful perspective. • However, unequal sampling rates can create distorted images. • Changing the aspect ratio can address this by increasing the width of one of the dimensions.
  • 14. Modifying the aspect ratio (2) • This results in a properly proportioned image. • Failing to adjust the aspect would have resulted in a distorted image.
  • 16. Handle DICOM Files (1) References : (1) Albertina, B., Watson, M.,Holback, C., Jarosz, R., Kirk, S., Lee, Y., … Lemmerman, J. (2016). Radiology Data from The Cancer Genome Atlas Lung Adenocarcinoma [TCGA-LUAD] collection. The Cancer Imaging Archive. http://doi.org/10.7937/K9/TCIA.2016.JGNIHEP5 (2) Clark K, Vendt B, Smith K, Freymann J, Kirby J, Koppel P, Moore S, Phillips S, Maffitt D, Pringle M, Tarbox L, Prior F. The Cancer Imaging Archive (TCIA): Maintaining and Operating a Public Information Repository, Journal of Digital Imaging, Volume 26, Number 6, December, 2013, pp 1045-1057.
  • 17. Handle DICOM Files (2) Download data:  Log in to Kaggle  Open link : https://www.kaggle.com/kmader/siim- medical-images?select=dicom_dir Click on Download
  • 18. Imports  pathlib for easy path handling  pydicom to handle dicom files  matplotlib for visualization  numpy to create the 3D container
  • 19. Read a single dcm file All information about dicom file can be accessed.
  • 20. Show dicom image Get information about shape of image :
  • 21. 3D Data  Data of full head MRI scan : https://zenodo.org/record/16956#. YFMM5PtKiV5  Ref : Lionheart, W. R. B. (2015). An MRI DICOM data set of the head of a normal male human aged 52 [Data set]. Zenodo. http://doi.org/10.5281/zen odo.16956
  • 22. Make list of 3D Data (1) Use the glob function to return all items in a directory which correspond to the provided pattern. As in this case, the directory only contains the DICOM files  return all files in it ("*")
  • 23. Make list of 3D Data (2) It is possible that the DICOM files are not ordered according to their actual image position  This can be verified by inspecting the SliceLocation.
  • 24. Make list of 3D Data (3) It crucial to order them  use the "SliceLocation" attribute passed to the sorted function to identify the 2D slice position and thus order the slices.
  • 25. Store 3D data in a list Extract the actual data (pixel_arrays) from Dicome files and store in a list:
  • 26. Show 3D data Some slices of the ordered 3D volume:
  • 28. What is NIfTI?  An open file format for storage of medical image data (historically used for neuroimaging – hence the name, but not restricted to neuroimaging).  Efficiently store medical image data together with necessary metadata.  Mainly used in research settings.  Not a clinical standard.
  • 29. Structure  Header : Containing information mainly about image geometry (resolution, position, orientation).  Body : Actual image pixel data (2D, 3D, 4D, …)  In general, easier to handle than DICOM files.  File extension usually “.nii” or “.nii-gz” (compressed version)
  • 30. How to work with NIfTI files  Python libraries : NiBabel, SimpleITK.  Image viewer : 3D Slicer (www.slicer.org)  Transform DICOM to NIfTI in Python  dicom2nifti
  • 31. Convert DICOM to NIfTI Convert DICOM to NIfTI using last DICOM data : Generating file 201_t2w_tse.nii.gz in the path_to_nifti.  Creating complete 3D MRI Scan.
  • 32. Read NIfTI files (1)  nibabel to handle nifti files  matplotlib to plot the brain images  load using nib.load(path)
  • 34. Image Shape and Image Pixel Data Obtaining image pixel data  The image pixel data can be extracted using the get_fdata() function of the nifti object.