|
|
1 周之前 | |
|---|---|---|
| .. | ||
| README.md | 1 周之前 | |
| image_io.py | 1 周之前 | |
| metadata.py | 1 周之前 | |
| plotting.py | 1 周之前 | |
| spatial_features.py | 1 周之前 | |
| suv_stats.py | 1 周之前 | |
Utilities for PET SUV NIfTI analysis, with emphasis on spatial properties of high-SUV tail regions.
The code is organized into focused modules instead of one long utils.py file. This keeps the data-management, image-processing, feature-extraction and plotting tasks separate and easier to test.
utils.py -> remove or keep only temporary imports
metadata.py -> dataframe / patient metadata utilities
image_io.py -> NIfTI loading and segmentation application
suv_stats.py -> simple SUV distribution features
spatial_features.py -> tail features and helper functions
plotting.py -> Plotly visualization
In this version, utils.py is kept as a thin compatibility layer that re-exports the functions from the focused modules. New code should import directly from the specific module.
thresholdtail_meantail_mediantail_maxtail_stdtail_cvtail_sumtail_excess_meantail_excess_sumn_roi_voxelsroi_volume_mm3n_tail_voxelstail_volume_mm3tail_fractionNote: if the threshold is defined as a within-ROI percentile, tail_fraction is mostly determined by the chosen percentile. It is included mainly for checking and completeness.
tail_spread_mm2tail_weighted_spread_mm2These measure how spatially dispersed high-SUV voxels are.
tail_local_contrasttail_local_contrast_normtail_local_contrast is a continuous, non-discretized contrast-like measure:
mean over neighboring voxel pairs inside R_q of (SUV_i - SUV_j)^2
tail_local_contrast_norm divides this value by tail_mean ** 2, giving a dimensionless version that is easier to compare across patients.
n_componentslargest_component_voxelslargest_component_volume_mm3largest_component_fractioncomponent_entropyThese describe whether high-SUV voxels form one dominant region or many disconnected foci.
largest_component_sphericityThis is an approximate marching-cubes-based sphericity of the largest connected component.
The connectivity argument controls both connected components and local contrast neighborhoods:
6 -> face neighbors
18 -> face + edge neighbors
26 -> face + edge + corner neighbors
For small or noisy PET regions, connectivity=26 and min_component_voxels=3 is a reasonable starting point.