Medical Image Processing & Tumour Segmentation
Objective
Isolate a brain tumour with classical computer vision
Before any learned model can segment a lesion, a clinician or engineer needs to understand what the pixels are doing. This experiment applies the core toolbox of medical image processing to a contrast-enhanced axial brain MRI with a visible tumour, building up from basic intensity operations to a working segmentation of the lesion and the skull boundary.
Every step is implemented with OpenCV and NumPy and visualised side by side with its input.
Tools & Data
Processing Pipeline
From raw intensities to a segmented lesion
-
Intensity operations
Colour-to-grayscale conversion, complement (negative) image, and gray-to-binary / binary-to-gray conversion by thresholding.
-
Geometric transforms
Rotation about the image centre (45°), horizontal flip and region-of-interest cropping around the lesion.
-
Contrast & frequency
Histogram equalisation with before/after histograms, and the centred 2D Fourier magnitude spectrum.
-
Edge detection
Sobel, Prewitt (custom kernels), Roberts (2×2 diagonal kernels) and Canny compared on the same slice.
-
Segmentation
Global thresholding, morphological opening and closing to clean the mask, then Otsu + distance transform + watershed to separate touching regions.
Tumour and Skull Segmentation
Techniques Implemented
Redistributes intensities to expose low-contrast tissue boundaries around the lesion.
Spatial-to-frequency transform to inspect the image's frequency content.
First-order (Sobel, Prewitt, Roberts) versus multi-stage Canny with hysteresis thresholding.
Two-class foreground/background separation isolating the enhancing tumour.
Opening removes small bright noise; closing fills small dark holes in the mask.
Otsu binarisation, distance transform and marker-based watershed to split connected regions.
Figures
Every stage of the pipeline, as produced in the notebook
Why It Matters
The baseline every learned model must beat
Classical pipelines like this remain the pre-processing stage of most medical AI systems — contrast normalisation, masking and morphology clean the data a neural network learns from — and they are the baseline a segmentation model has to outperform to justify itself.
Coursework for the Medical Imaging Laboratory (BME-3202), B.Sc. Biomedical Engineering, Islamic University.