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_{i,j} \mathrel{+}= 1 \quad \text{when } L(\mathbf{x})=i,\ L(\mathbf{x}')=j\]

\(M\) has size \((K{+}1)\times(K{+}1)\) (row/column 0 = background). Normalization:

\[D = \sum_{i \ge 1} \sum_{j \le i} M_{ij}, \quad P = M / D\]

Second-order features on \(P\) (indices \(i,j = 0,\ldots,K\)):

\[\begin{split}\mathrm{contrast} &= \sum_{i,j} (i-j)^2 P_{ij} \\ \mathrm{homogeneity} &= \sum_{i,j} \frac{P_{ij}}{1+(i-j)^2} \\ \mathrm{energy} &= \sum_{i,j} P_{ij}^2 \\ \mathrm{correlation} &= \frac{\sum_{i,j} i j P_{ij} - \mu_x \mu_y}{\sigma_x \sigma_y}\end{split}\]

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

firstorder_{i}_and_{j} (i < j, or i = j ≥ 1)

Raw MSI matrix entry \(M_{ij}\) (diagonal i≥1: connected subregion size; off-diagonal: inter-subregion border size). firstorder_0_and_0 is not exported.

firstorder_normalized_{i}_and_{j} (same index rule)

Normalized MSI matrix entry \(P_{ij}\). firstorder_normalized_0_and_0 is not exported.

contrast, homogeneity, energy, correlation

Four second-order statistical features on \(P\) (Wu et al., Fig. 2c)

Implementation

habit/core/habitat_analysis/habitat_features/msi_features.py

References

Wu J et al., Radiology 2018 (PubMed · DOI).