https://github.com/asvcode/medicalimaging
Tutorials that take an in depth look at how to view and manipulate DICOM images and how to get them ready for machine learning
https://github.com/asvcode/medicalimaging
dicom dicom-images health medical-images medical-imaging
Last synced: 3 months ago
JSON representation
Tutorials that take an in depth look at how to view and manipulate DICOM images and how to get them ready for machine learning
- Host: GitHub
- URL: https://github.com/asvcode/medicalimaging
- Owner: asvcode
- License: apache-2.0
- Created: 2020-05-20T17:48:02.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2023-04-12T06:10:54.000Z (about 2 years ago)
- Last Synced: 2025-04-09T16:04:06.971Z (3 months ago)
- Topics: dicom, dicom-images, health, medical-images, medical-imaging
- Language: Jupyter Notebook
- Homepage: https://asvcode.github.io/MedicalImaging/
- Size: 81.9 MB
- Stars: 26
- Watchers: 2
- Forks: 6
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[//]: # (BADGES SECTION: change `fastai` with your GitHub username and `fastpages` with the name of your repo)

[](https://asvcode.github.io/MedicalImaging/)
[//]: # (END OF BADGES SECTION)
Click on the link above to go to the tutorials
# Medical Imaging
These tutorials take an in depth look at how to view DICOM images and what information is contained within the `head` of the DICOM. These tutorials also look at what considerations should be taken when evaluating models for medical diagnosis such as Positive and Negative Predictive values, Specificity, Sensitivity, what `RescaleSlope` and `RescaleIntercept` are and how to view diffent tissues densities, Windowing and how to normalize images using `bins`.These tutorials are based on the lastest release of `fastai` which was officially released in August 2020 and `Medical Imaging using Fastai` provides an in depth look at the `fastai's` `medical.imaging.module`.
Currently 3 easily accessible `datasets` are used for the tutorials. These can be found in the `Getting to know DICOMS` tutorial
### What are DICOMs?
**DICOM**(**D**igital **I**maging and **CO**mmunications in **M**edicine) is the de-facto standard that establishes rules that allow medical images(X-Ray, MRI, CT) and associated information to be exchanged between imaging equipment from different vendors, computers, and hospitals. The DICOM format provides a suitable means that meets [health infomation exchange](https://www.himss.org/interoperability-and-health-information-exchange) (HIE) standards for transmission of health related data among facilities and HL7 standards which is the messaging standard that enables clinical applications to exchange data.
![]()
DICOM files typically have a .dcm extension and provides a means of storing data in seperate **'tags'** such as patient information as well as image/pixel data. A DICOM file consists of a header and image data sets packed into a single file. The information within the header is organized as a constant and standardized series of tags. By extracting data from these tags one can access important information regarding the patient demographics, study parameters, etc
16 bit DICOM images have values ranging from -32768 to 32768 while 8-bit greyscale images store values from 0 to 255. The value ranges in DICOM images are useful as they correlate with the [Hounsfield Scale](https://en.wikipedia.org/wiki/Hounsfield_scale) which is a quantitative scale for describing radiodensity
Parts of a DICOM
![]()
### Requirements
Requires the most recent version of `fastai`, installation instructions can be viewed at [fastai](https://github.com/fastai/fastai)
Also requires installing `pydicom`
- `pip install pydicom`
and `scikit-image`
- `pip install scikit-image`
and `kornia`
- `pip install kornia===0.2.0`
(there is a current incompatability with the lastest version of `kornia`. Installing version `0.2.0` solves this issue
### Using with Google Colab:
Click on the link below for an example of loading the dependancies on `Colab`
[](https://colab.research.google.com/drive/12yzCUieRREEb535XVbPzSzjv_7YUuTeb?usp=sharing)
Fastai provides an easy to access slim dicom dataset (250 DICOM files, ~30MB) from the [SIIM-ACR Pneumothorax Segmentation dataset](https://doi.org/10.1007/s10278-019-00299-9) for us to experiment with dicom images. The file structure of the dataset is as follows:
![]()
### Images from the notebooks
#### >hist_scaled(in Part1)
`hist_scaled` provides a way to scale a tensor of pixels evenly using `freqhist_bins` to values between 0 and 1. This is the histogram of image pixel values scaled from 0 to 255. As explained in this [notebook](https://www.kaggle.com/jhoward/don-t-see-like-a-radiologist-fastai)
![]()
Scaled histogram now has pixel values ranging from 0 to 1
![]()