SOM-Based Brain Image Segmentation with Tumor Detection and Color Labeling

Resource Overview

This implementation provides brain image segmentation using Self-Organizing Maps (SOM) neural networks, featuring tumor region identification and color-coded label visualization. The code processes both T1 and T2 weighted MRI images, automatically detects pathological regions, and generates segmented outputs with distinct color labels for different tissue types. Key functionalities include SOM clustering initialization, feature vector extraction from image pixels, and label-to-color mapping algorithms.

Detailed Documentation

The following code implements brain image segmentation utilizing the Self-Organizing Map (SOM) algorithm, a type of unsupervised neural network particularly effective for cluster analysis in medical imaging. The implementation includes preprocessing stages for MRI data normalization, SOM weight initialization using Principal Component Analysis (PCA), and iterative training through competitive learning. The core algorithm processes input images by converting pixel intensities into feature vectors, which are then clustered through SOM's topological mapping. Tumor regions are identified based on anomaly detection in the feature space, with segmentation results visualized through a color labeling system where each cluster centroid corresponds to a distinct color code. The code supports dual-modality processing for both T1-weighted (anatomical detail) and T2-weighted (pathology emphasis) MRI sequences. Post-processing includes morphological operations to refine tumor boundaries and generate final labeled images with overlayed color masks. Key functions handle SOM grid initialization, neighborhood function computation, and label assignment through Euclidean distance minimization between input vectors and neuron weights.