Skip to content

The project involved image segmentation of MRI brain image to identify and label cancerous tumor regions using binary masking and labeling techniques in Python. I utilised advanced image processing libraries in Python

License

Notifications You must be signed in to change notification settings

Amos77Robert/segmentation-of-brain-cancer-tumors-without-AI

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

38 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Tumor Segmentation in MRI Brain Scans

This project performs image segmentation on MRI brain image to identify and segment tumor regions using binary masking and labeling techniques in Python.


📌 Table of Contents


📖 Project Overview

In this project, I used binary masking technique to segment tumors in MRI brain scan slices. The segmented images highlight tumor boundaries, and distinguish multi-region tumors using intensity differences and region labeling.

This can assist medical practitioners or serve as a proof-of-concept for more advanced models.


Dataset

  • Type: MRI scan brain images

  • Format: .nii (Neuroimaging Informatics Technology Initiative format)

  • Slices: 2D grayscale slices from 3D volumes
    📥 Download Link

  • Full Data Source

  • 📥 Download Link


Objective

  • Detect and visualize tumor regions in brain CT images.
  • Label nested and overlapping tumors with separate colors.
  • Improve visibility by applying masks and filtering borders.
  • Enable easy inspection and interpretation of segmented regions.

Methodology

  1. Data
    • Loaded .nii image using nibabel
  2. Segmentation via binary masking
    • Tumor regions identified by pixel intensities (image > 8000) & (image <= 10500) pixel values
    • Separated high and low intensity tumors using color-mesh
  3. Masking
    • Binary masks created using NumPy
  4. Border Clearing
    • skimage.segmentation.clear_border() used to remove artifacts
  5. Labeling
    • skimage.measure.regionprops() to identify tumor regions and their properties such as area, bounding boxes, center_of_mass
    • scipy.measure.label() to label connected regions and identified region areas
  6. Visualization
    • matplotlib.pyplot.pcolormesh() for color visualization
    • scipy.ndimage.zoom() to reduce axes dimensions
    • plotly.graph_objects() for 3D visualisation of segmented tumors

📊 Results

Example segmented slice (slice index = 110):

Original Segmented
Original Segmented

Nested tumors:

  • Small tumor : Higher intensity
  • Larger tumor: Moderately Lower intensity, re-labeled as a distinct region

▶ How to Run

git clone https://github.com/Amos77Robert/segmentation-of-brain-tumors-without-AI.git
cd segmentation-of-brain-tumors-without-A

## 🧪 Dependencies
- numpy
- matplotlib
- nibabel
- scipy
- scikit-image

Install them via:
```bash
pip install -r requirements.txt

# Run the notebook in VS Code, Colab, Jupyter or any Python environment
python iMAGE sEGMENTATION sCRIPT.ipynb

Challenges

  • Differentiating nested tumors with close intensity ranges
  • Choosing optimal thresholds across variable slices

👤 Contributors

  • Amoss Robert
    • Master of Data Science Candidate | Researcher

About

The project involved image segmentation of MRI brain image to identify and label cancerous tumor regions using binary masking and labeling techniques in Python. I utilised advanced image processing libraries in Python

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published