PyNutil.interpolate_volume#
- PyNutil.interpolate_volume(*, image_series, registration, atlas, scale=1.0, missing_fill=nan, do_interpolation=True, k=5, batch_size=200000, use_atlas_mask=True, value_mode='pixel_count', segmentation_mode=True, intensity_channel='grayscale', min_intensity=None, max_intensity=None, return_orientation='asr')[source]#
Project section data into atlas-space volumes.
- Parameters:
image_series (
ImageSeries) –ImageSeriescontaining the sections to project. Build one withread_segmentation_dir()orread_image_dir().registration (
RegistrationData) –RegistrationDataloaded withread_alignment().atlas (
object) – Atlas definition used to determine the target volume shape. This may be a BrainGlobe atlas object orAtlasData.scale (
float) – Isotropic scaling factor applied to the atlas output shape.missing_fill (
float) – Fill value assigned to voxels with no sampled data when interpolation is disabled or when uncovered voxels remain after processing.do_interpolation (
bool) – IfTrue, fill uncovered voxels using k-nearest-neighbor interpolation.k (
int) – Number of neighbors to use during interpolation.batch_size (
int) – Number of query voxels processed per interpolation batch.use_atlas_mask (
bool) – IfTrue, restrict interpolation to voxels inside the atlas mask.value_mode (
str) – Output volume mode. Supported values are"pixel_count","mean", and"object_count".segmentation_mode (
bool) – IfTrue, treat input files as segmentation outputs. IfFalse, treat them as source images and derive intensities fromintensity_channel.intensity_channel (
str) – Image channel to convert to intensity values whensegmentation_mode=False.min_intensity (
Optional[int]) – Optional lower threshold for intensity-mode inputs.max_intensity (
Optional[int]) – Optional upper threshold for intensity-mode inputs.
- Returns:
A
VolumeResultwithvalue(the requested metric volume),frequency(per-voxel sample count), anddamage(binary damage mask).- Return type:
Examples
Build atlas-space volumes from segmentation images:
>>> image_series = pnt.read_segmentation_dir( ... "path/to/segmentations/", ... pixel_id=[0, 0, 0], ... ) >>> registration = pnt.read_alignment("path/to/alignment.json") >>> result = pnt.interpolate_volume( ... image_series=image_series, ... registration=registration, ... atlas=atlas, ... ) >>> gv = result.value >>> fv = result.frequency >>> dv = result.damage