MSI Features
Output
msi_features.csv
Definition
Multiregional spatial interaction (MSI) matrix derived from the habitat
label map (intratumor partition map). On the basis of the multiregion map, the
MSI matrix characterizes and quantifies intratumoral spatial heterogeneity
(Wu et al., Radiology 2018). For each voxel in the ROI bounding box (padded
by one zero-voxel border), face-connected neighbors are probed and the
resulting label pair is added to \(M\). Surrounding tissue is included as
one distinct region (row/column 0 = background). Diagonal elements of
\(M\) represent the connected size of individual subregions, whereas
off-diagonal elements relate to the size of borders where different subregions
meet. Matrix size is \((K{+}1)\times(K{+}1)\) where K = n_habitats
from config (not per-map auto count). First-order features are raw or
normalized counts from \(M\); four second-order statistical features
(contrast, homogeneity, correlation, energy) are computed on
the normalized matrix \(P\).
Formula
HABIT uses 6-connectivity (face-adjacent neighbors only). The loop covers every voxel inside the padded bounding box (including background voxels within the box). For each voxel \(\mathbf{x}\) and face-neighbor \(\mathbf{x}'\):
\(M\) has size \((K{+}1)\times(K{+}1)\) (row/column 0 = background). Normalization:
Second-order features on \(P\) (indices \(i,j = 0,\ldots,K\)):
If \(\sigma_x\) or \(\sigma_y\) is zero, correlation is set to 1.0.
If \(D=0\) (no countable pairs after excluding background row/column from the
denominator), \(P\) is all zeros and second-order features are zero.
Output columns
Column pattern |
Description |
|---|---|
|
Raw MSI matrix entry \(M_{ij}\) (diagonal i≥1: connected subregion size; off-diagonal: inter-subregion border size). |
|
Normalized MSI matrix entry \(P_{ij}\). |
|
Four second-order statistical features on \(P\) (Wu et al., Fig. 2c) |
Implementation
habit/core/habitat_analysis/habitat_features/msi_features.py