petpal 0.5.10__tar.gz → 0.6.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {petpal-0.5.10 → petpal-0.6.0}/PKG-INFO +1 -1
- {petpal-0.5.10 → petpal-0.6.0}/petpal/cli/cli_preproc.py +34 -2
- {petpal-0.5.10 → petpal-0.6.0}/petpal/preproc/segmentation_tools.py +57 -8
- {petpal-0.5.10 → petpal-0.6.0}/pyproject.toml +1 -1
- {petpal-0.5.10 → petpal-0.6.0}/.github/ISSUE_TEMPLATE/bug_report.md +0 -0
- {petpal-0.5.10 → petpal-0.6.0}/.github/ISSUE_TEMPLATE/feature_request.md +0 -0
- {petpal-0.5.10 → petpal-0.6.0}/.github/workflows/publish-to-pypi.yml +0 -0
- {petpal-0.5.10 → petpal-0.6.0}/.github/workflows/python-package.yml +0 -0
- {petpal-0.5.10 → petpal-0.6.0}/.gitignore +0 -0
- {petpal-0.5.10 → petpal-0.6.0}/.readthedocs.yaml +0 -0
- {petpal-0.5.10 → petpal-0.6.0}/LICENSE +0 -0
- {petpal-0.5.10 → petpal-0.6.0}/README.md +0 -0
- {petpal-0.5.10 → petpal-0.6.0}/data/tcm_tacs/1tcm/gaussian_noise/tac_1tcm_set-00.txt +0 -0
- {petpal-0.5.10 → petpal-0.6.0}/data/tcm_tacs/1tcm/gaussian_noise/tac_1tcm_set-01.txt +0 -0
- {petpal-0.5.10 → petpal-0.6.0}/data/tcm_tacs/1tcm/gaussian_noise/tac_1tcm_set-02.txt +0 -0
- {petpal-0.5.10 → petpal-0.6.0}/data/tcm_tacs/1tcm/gaussian_noise/tacs.pdf +0 -0
- {petpal-0.5.10 → petpal-0.6.0}/data/tcm_tacs/1tcm/gaussian_noise/tacs.png +0 -0
- {petpal-0.5.10 → petpal-0.6.0}/data/tcm_tacs/1tcm/noise_free/tac_1tcm_set-00.txt +0 -0
- {petpal-0.5.10 → petpal-0.6.0}/data/tcm_tacs/1tcm/noise_free/tac_1tcm_set-01.txt +0 -0
- {petpal-0.5.10 → petpal-0.6.0}/data/tcm_tacs/1tcm/noise_free/tac_1tcm_set-02.txt +0 -0
- {petpal-0.5.10 → petpal-0.6.0}/data/tcm_tacs/1tcm/noise_free/tacs.pdf +0 -0
- {petpal-0.5.10 → petpal-0.6.0}/data/tcm_tacs/1tcm/noise_free/tacs.png +0 -0
- {petpal-0.5.10 → petpal-0.6.0}/data/tcm_tacs/1tcm/params_1tcm_set-00.json +0 -0
- {petpal-0.5.10 → petpal-0.6.0}/data/tcm_tacs/1tcm/params_1tcm_set-01.json +0 -0
- {petpal-0.5.10 → petpal-0.6.0}/data/tcm_tacs/1tcm/params_1tcm_set-02.json +0 -0
- {petpal-0.5.10 → petpal-0.6.0}/data/tcm_tacs/fdg_plasma_clamp_evenly_resampled.txt +0 -0
- {petpal-0.5.10 → petpal-0.6.0}/data/tcm_tacs/fdg_plasma_clamp_evenly_resampled_woMax.txt +0 -0
- {petpal-0.5.10 → petpal-0.6.0}/data/tcm_tacs/fdg_plasma_clamp_tacs.pdf +0 -0
- {petpal-0.5.10 → petpal-0.6.0}/data/tcm_tacs/fdg_plasma_clamp_tacs.png +0 -0
- {petpal-0.5.10 → petpal-0.6.0}/data/tcm_tacs/gen_tcms_data.ipynb +0 -0
- {petpal-0.5.10 → petpal-0.6.0}/data/tcm_tacs/readme.md +0 -0
- {petpal-0.5.10 → petpal-0.6.0}/data/tcm_tacs/serial_2tcm/gaussian_noise/tac_2tcm_set-00.txt +0 -0
- {petpal-0.5.10 → petpal-0.6.0}/data/tcm_tacs/serial_2tcm/gaussian_noise/tac_2tcm_set-01.txt +0 -0
- {petpal-0.5.10 → petpal-0.6.0}/data/tcm_tacs/serial_2tcm/gaussian_noise/tac_2tcm_set-02.txt +0 -0
- {petpal-0.5.10 → petpal-0.6.0}/data/tcm_tacs/serial_2tcm/gaussian_noise/tacs.pdf +0 -0
- {petpal-0.5.10 → petpal-0.6.0}/data/tcm_tacs/serial_2tcm/gaussian_noise/tacs.png +0 -0
- {petpal-0.5.10 → petpal-0.6.0}/data/tcm_tacs/serial_2tcm/noise_free/tac_2tcm_set-00.txt +0 -0
- {petpal-0.5.10 → petpal-0.6.0}/data/tcm_tacs/serial_2tcm/noise_free/tac_2tcm_set-01.txt +0 -0
- {petpal-0.5.10 → petpal-0.6.0}/data/tcm_tacs/serial_2tcm/noise_free/tac_2tcm_set-02.txt +0 -0
- {petpal-0.5.10 → petpal-0.6.0}/data/tcm_tacs/serial_2tcm/noise_free/tacs.pdf +0 -0
- {petpal-0.5.10 → petpal-0.6.0}/data/tcm_tacs/serial_2tcm/noise_free/tacs.png +0 -0
- {petpal-0.5.10 → petpal-0.6.0}/data/tcm_tacs/serial_2tcm/params_serial_2tcm_set-00.json +0 -0
- {petpal-0.5.10 → petpal-0.6.0}/data/tcm_tacs/serial_2tcm/params_serial_2tcm_set-01.json +0 -0
- {petpal-0.5.10 → petpal-0.6.0}/data/tcm_tacs/serial_2tcm/params_serial_2tcm_set-02.json +0 -0
- {petpal-0.5.10 → petpal-0.6.0}/data/tcm_tacs/serial_2tcm_k4zero/gaussian_noise/tac_2tcm_k4zero_set-00.txt +0 -0
- {petpal-0.5.10 → petpal-0.6.0}/data/tcm_tacs/serial_2tcm_k4zero/gaussian_noise/tac_2tcm_k4zero_set-01.txt +0 -0
- {petpal-0.5.10 → petpal-0.6.0}/data/tcm_tacs/serial_2tcm_k4zero/gaussian_noise/tacs.pdf +0 -0
- {petpal-0.5.10 → petpal-0.6.0}/data/tcm_tacs/serial_2tcm_k4zero/gaussian_noise/tacs.png +0 -0
- {petpal-0.5.10 → petpal-0.6.0}/data/tcm_tacs/serial_2tcm_k4zero/noise_free/tac_2tcm_k4zero_set-00.txt +0 -0
- {petpal-0.5.10 → petpal-0.6.0}/data/tcm_tacs/serial_2tcm_k4zero/noise_free/tac_2tcm_k4zero_set-01.txt +0 -0
- {petpal-0.5.10 → petpal-0.6.0}/data/tcm_tacs/serial_2tcm_k4zero/noise_free/tacs.pdf +0 -0
- {petpal-0.5.10 → petpal-0.6.0}/data/tcm_tacs/serial_2tcm_k4zero/noise_free/tacs.png +0 -0
- {petpal-0.5.10 → petpal-0.6.0}/data/tcm_tacs/serial_2tcm_k4zero/params_serial_2tcm_k4zero_set-00.json +0 -0
- {petpal-0.5.10 → petpal-0.6.0}/data/tcm_tacs/serial_2tcm_k4zero/params_serial_2tcm_k4zero_set-01.json +0 -0
- {petpal-0.5.10 → petpal-0.6.0}/data/tcm_tacs/turku_pet_center_fdg_plasma_clamp.txt +0 -0
- {petpal-0.5.10 → petpal-0.6.0}/docs/Makefile +0 -0
- {petpal-0.5.10 → petpal-0.6.0}/docs/PETPAL_Logo.png +0 -0
- {petpal-0.5.10 → petpal-0.6.0}/docs/_templates/index.rst +0 -0
- {petpal-0.5.10 → petpal-0.6.0}/docs/_templates/python/attribute.rst +0 -0
- {petpal-0.5.10 → petpal-0.6.0}/docs/_templates/python/class.rst +0 -0
- {petpal-0.5.10 → petpal-0.6.0}/docs/_templates/python/data.rst +0 -0
- {petpal-0.5.10 → petpal-0.6.0}/docs/_templates/python/exception.rst +0 -0
- {petpal-0.5.10 → petpal-0.6.0}/docs/_templates/python/function.rst +0 -0
- {petpal-0.5.10 → petpal-0.6.0}/docs/_templates/python/method.rst +0 -0
- {petpal-0.5.10 → petpal-0.6.0}/docs/_templates/python/module.rst +0 -0
- {petpal-0.5.10 → petpal-0.6.0}/docs/_templates/python/package.rst +0 -0
- {petpal-0.5.10 → petpal-0.6.0}/docs/_templates/python/property.rst +0 -0
- {petpal-0.5.10 → petpal-0.6.0}/docs/conf.py +0 -0
- {petpal-0.5.10 → petpal-0.6.0}/docs/index.rst +0 -0
- {petpal-0.5.10 → petpal-0.6.0}/docs/make.bat +0 -0
- {petpal-0.5.10 → petpal-0.6.0}/docs/requirements.txt +0 -0
- {petpal-0.5.10 → petpal-0.6.0}/docs/tutorials/index.rst +0 -0
- {petpal-0.5.10 → petpal-0.6.0}/docs/tutorials/pib_example.rst +0 -0
- {petpal-0.5.10 → petpal-0.6.0}/petpal/__init__.py +0 -0
- {petpal-0.5.10 → petpal-0.6.0}/petpal/cli/__init__.py +0 -0
- {petpal-0.5.10 → petpal-0.6.0}/petpal/cli/cli_graphical_analysis.py +0 -0
- {petpal-0.5.10 → petpal-0.6.0}/petpal/cli/cli_graphical_plots.py +0 -0
- {petpal-0.5.10 → petpal-0.6.0}/petpal/cli/cli_idif.py +0 -0
- {petpal-0.5.10 → petpal-0.6.0}/petpal/cli/cli_parametric_images.py +0 -0
- {petpal-0.5.10 → petpal-0.6.0}/petpal/cli/cli_pib_processing.py +0 -0
- {petpal-0.5.10 → petpal-0.6.0}/petpal/cli/cli_plot_tacs.py +0 -0
- {petpal-0.5.10 → petpal-0.6.0}/petpal/cli/cli_pvc.py +0 -0
- {petpal-0.5.10 → petpal-0.6.0}/petpal/cli/cli_reference_tissue_models.py +0 -0
- {petpal-0.5.10 → petpal-0.6.0}/petpal/cli/cli_stats.py +0 -0
- {petpal-0.5.10 → petpal-0.6.0}/petpal/cli/cli_tac_fitting.py +0 -0
- {petpal-0.5.10 → petpal-0.6.0}/petpal/cli/cli_tac_interpolation.py +0 -0
- {petpal-0.5.10 → petpal-0.6.0}/petpal/cli/cli_vat_processing.py +0 -0
- {petpal-0.5.10 → petpal-0.6.0}/petpal/input_function/__init__.py +0 -0
- {petpal-0.5.10 → petpal-0.6.0}/petpal/input_function/blood_input.py +0 -0
- {petpal-0.5.10 → petpal-0.6.0}/petpal/input_function/idif_necktangle.py +0 -0
- {petpal-0.5.10 → petpal-0.6.0}/petpal/input_function/pca_guided_idif.py +0 -0
- {petpal-0.5.10 → petpal-0.6.0}/petpal/kinetic_modeling/__init__.py +0 -0
- {petpal-0.5.10 → petpal-0.6.0}/petpal/kinetic_modeling/fit_tac_with_rtms.py +0 -0
- {petpal-0.5.10 → petpal-0.6.0}/petpal/kinetic_modeling/graphical_analysis.py +0 -0
- {petpal-0.5.10 → petpal-0.6.0}/petpal/kinetic_modeling/parametric_images.py +0 -0
- {petpal-0.5.10 → petpal-0.6.0}/petpal/kinetic_modeling/reference_tissue_models.py +0 -0
- {petpal-0.5.10 → petpal-0.6.0}/petpal/kinetic_modeling/rtm_analysis.py +0 -0
- {petpal-0.5.10 → petpal-0.6.0}/petpal/kinetic_modeling/tac_fitting.py +0 -0
- {petpal-0.5.10 → petpal-0.6.0}/petpal/kinetic_modeling/tac_interpolation.py +0 -0
- {petpal-0.5.10 → petpal-0.6.0}/petpal/kinetic_modeling/tac_uncertainty.py +0 -0
- {petpal-0.5.10 → petpal-0.6.0}/petpal/kinetic_modeling/tcms_as_convolutions.py +0 -0
- {petpal-0.5.10 → petpal-0.6.0}/petpal/meta/__init__.py +0 -0
- {petpal-0.5.10 → petpal-0.6.0}/petpal/meta/label_maps.py +0 -0
- {petpal-0.5.10 → petpal-0.6.0}/petpal/pipelines/__init__.py +0 -0
- {petpal-0.5.10 → petpal-0.6.0}/petpal/pipelines/kinetic_modeling_steps.py +0 -0
- {petpal-0.5.10 → petpal-0.6.0}/petpal/pipelines/pca_guided_idif_steps.py +0 -0
- {petpal-0.5.10 → petpal-0.6.0}/petpal/pipelines/pipelines.py +0 -0
- {petpal-0.5.10 → petpal-0.6.0}/petpal/pipelines/preproc_steps.py +0 -0
- {petpal-0.5.10 → petpal-0.6.0}/petpal/pipelines/steps_base.py +0 -0
- {petpal-0.5.10 → petpal-0.6.0}/petpal/pipelines/steps_containers.py +0 -0
- {petpal-0.5.10 → petpal-0.6.0}/petpal/preproc/__init__.py +0 -0
- {petpal-0.5.10 → petpal-0.6.0}/petpal/preproc/decay_correction.py +0 -0
- {petpal-0.5.10 → petpal-0.6.0}/petpal/preproc/image_operations_4d.py +0 -0
- {petpal-0.5.10 → petpal-0.6.0}/petpal/preproc/motion_corr.py +0 -0
- {petpal-0.5.10 → petpal-0.6.0}/petpal/preproc/motion_target.py +0 -0
- {petpal-0.5.10 → petpal-0.6.0}/petpal/preproc/partial_volume_corrections.py +0 -0
- {petpal-0.5.10 → petpal-0.6.0}/petpal/preproc/regional_tac_extraction.py +0 -0
- {petpal-0.5.10 → petpal-0.6.0}/petpal/preproc/register.py +0 -0
- {petpal-0.5.10 → petpal-0.6.0}/petpal/preproc/standard_uptake_value.py +0 -0
- {petpal-0.5.10 → petpal-0.6.0}/petpal/preproc/symmetric_geometric_transfer_matrix.py +0 -0
- {petpal-0.5.10 → petpal-0.6.0}/petpal/utils/__init__.py +0 -0
- {petpal-0.5.10 → petpal-0.6.0}/petpal/utils/bids_utils.py +0 -0
- {petpal-0.5.10 → petpal-0.6.0}/petpal/utils/constants.py +0 -0
- {petpal-0.5.10 → petpal-0.6.0}/petpal/utils/data_driven_image_analyses.py +0 -0
- {petpal-0.5.10 → petpal-0.6.0}/petpal/utils/decorators.py +0 -0
- {petpal-0.5.10 → petpal-0.6.0}/petpal/utils/image_io.py +0 -0
- {petpal-0.5.10 → petpal-0.6.0}/petpal/utils/math_lib.py +0 -0
- {petpal-0.5.10 → petpal-0.6.0}/petpal/utils/metadata.py +0 -0
- {petpal-0.5.10 → petpal-0.6.0}/petpal/utils/scan_timing.py +0 -0
- {petpal-0.5.10 → petpal-0.6.0}/petpal/utils/stats.py +0 -0
- {petpal-0.5.10 → petpal-0.6.0}/petpal/utils/testing_utils.py +0 -0
- {petpal-0.5.10 → petpal-0.6.0}/petpal/utils/time_activity_curve.py +0 -0
- {petpal-0.5.10 → petpal-0.6.0}/petpal/utils/useful_functions.py +0 -0
- {petpal-0.5.10 → petpal-0.6.0}/petpal/visualizations/__init__.py +0 -0
- {petpal-0.5.10 → petpal-0.6.0}/petpal/visualizations/graphical_plots.py +0 -0
- {petpal-0.5.10 → petpal-0.6.0}/petpal/visualizations/image_visualization.py +0 -0
- {petpal-0.5.10 → petpal-0.6.0}/petpal/visualizations/qc_plots.py +0 -0
- {petpal-0.5.10 → petpal-0.6.0}/petpal/visualizations/tac_plots.py +0 -0
- {petpal-0.5.10 → petpal-0.6.0}/shared/dseg.tsv +0 -0
- {petpal-0.5.10 → petpal-0.6.0}/shared/freesurfer_lmap.json +0 -0
- {petpal-0.5.10 → petpal-0.6.0}/shared/freesurfer_lmap_lr.json +0 -0
- {petpal-0.5.10 → petpal-0.6.0}/shared/perl_cyno_lmap.json +0 -0
- {petpal-0.5.10 → petpal-0.6.0}/shared/perl_cyno_lmap_lr.json +0 -0
- {petpal-0.5.10 → petpal-0.6.0}/test_notebooks/explicit_tac_fitting/01_fitting_TCMs.ipynb +0 -0
- {petpal-0.5.10 → petpal-0.6.0}/test_notebooks/testing_RTMs/01_testing_RTMs.ipynb +0 -0
- {petpal-0.5.10 → petpal-0.6.0}/test_notebooks/testing_graphical_analyses/01_testing_on_tcms_database.ipynb +0 -0
- {petpal-0.5.10 → petpal-0.6.0}/test_notebooks/testing_graphical_analyses/02_testing_parametric_images.ipynb +0 -0
- {petpal-0.5.10 → petpal-0.6.0}/test_notebooks/testing_graphical_analyses/03_plotting_graphical_anlayses_testbed.ipynb +0 -0
- {petpal-0.5.10 → petpal-0.6.0}/tests/test_graphical_analysis.py +0 -0
- {petpal-0.5.10 → petpal-0.6.0}/tests/test_importpetpal.py +0 -0
- {petpal-0.5.10 → petpal-0.6.0}/tests/test_register.py +0 -0
- {petpal-0.5.10 → petpal-0.6.0}/tests/test_scan_timing_decay.py +0 -0
- {petpal-0.5.10 → petpal-0.6.0}/tests/test_sgtm.py +0 -0
- {petpal-0.5.10 → petpal-0.6.0}/tests/test_time_activity_curve.py +0 -0
- {petpal-0.5.10 → petpal-0.6.0}/tests/test_weighted_sum.py +0 -0
- {petpal-0.5.10 → petpal-0.6.0}/tests/test_write_tacs.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: petpal
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.6.0
|
|
4
4
|
Summary: PET-PAL (Positron Emission Tomography Processing and Analysis Library)
|
|
5
5
|
Project-URL: Repository, https://github.com/PETPAL-WUSM/PETPAL.git
|
|
6
6
|
Author-email: Noah Goldman <noahg@wustl.edu>, Bradley Judge <bjudge@wustl.edu>, Furqan Dar <dar@wustl.edu>, Kenan Oestreich <kenan.oestreich@wustl.edu>
|
|
@@ -83,7 +83,12 @@ Examples:
|
|
|
83
83
|
.. code-block:: bash
|
|
84
84
|
|
|
85
85
|
petpal-preproc warp-pet-atlas -i /path/to/input_img.nii.gz -o petpal_reg-atlas.nii.gz --anatomical /path/to/anat.nii.gz --reference-atlas /path/to/atlas.nii.gz
|
|
86
|
-
|
|
86
|
+
|
|
87
|
+
* Crop segmentation to PET FOV:
|
|
88
|
+
|
|
89
|
+
.. code-block:: bash
|
|
90
|
+
|
|
91
|
+
petpal-preproc seg-crop -i /path/to/input_img.nii.gz -o petpal_cropped_seg.nii.gz --segmentation /path/to/segmentation.nii.gz
|
|
87
92
|
|
|
88
93
|
See Also:
|
|
89
94
|
* :mod:`~petpal.preproc.image_operations_4d` - module used for operations on 4D images.
|
|
@@ -99,7 +104,8 @@ from ..preproc import (image_operations_4d,
|
|
|
99
104
|
motion_corr,
|
|
100
105
|
register,
|
|
101
106
|
regional_tac_extraction,
|
|
102
|
-
standard_uptake_value
|
|
107
|
+
standard_uptake_value,
|
|
108
|
+
segmentation_tools)
|
|
103
109
|
|
|
104
110
|
|
|
105
111
|
_PREPROC_EXAMPLES_ = r"""
|
|
@@ -126,6 +132,10 @@ Examples:
|
|
|
126
132
|
petpal-preproc warp-pet-atlas -i /path/to/input_img.nii.gz -o petpal_reg-atlas.nii.gz --anatomical /path/to/anat.nii.gz --reference-atlas /path/to/atlas.nii.gz
|
|
127
133
|
- SUV:
|
|
128
134
|
petpal-preproc suv -i /path/to/input_img.nii.gz -o petpal_suv.nii.gz --weight 75 --dose 250 --start-time 1200 --end-time 3600
|
|
135
|
+
- Crop segmentation image to PET FOV:
|
|
136
|
+
petpal-preproc seg-crop -i /path/to/input_img.nii.gz -o petpal_cropped_seg.nii.gz --segmentation /path/to/segmentation.nii.gz
|
|
137
|
+
- Add eroded white matter region to segmentation image:
|
|
138
|
+
petpal-preproc eroded-wm -i /path/to/input_segmentation.nii.gz -o petpal_seg_with_eroded_wm.nii.gz
|
|
129
139
|
"""
|
|
130
140
|
|
|
131
141
|
|
|
@@ -357,6 +367,19 @@ def _generate_args() -> argparse.ArgumentParser:
|
|
|
357
367
|
required=True,
|
|
358
368
|
help='End time for SUV calculation in seconds from scan start',
|
|
359
369
|
type=float)
|
|
370
|
+
|
|
371
|
+
parser_seg_crop = subparsers.add_parser('seg-crop',help='Crop segmentation image to PET FOV')
|
|
372
|
+
_add_common_args(parser_seg_crop)
|
|
373
|
+
parser_seg_crop.add_argument('-s',
|
|
374
|
+
'--segmentation',
|
|
375
|
+
required=True,
|
|
376
|
+
help='Path to segmentation image',
|
|
377
|
+
type=str)
|
|
378
|
+
|
|
379
|
+
parser_eroded_wm = subparsers.add_parser('eroded-wm',
|
|
380
|
+
help='Add eroded white matter region to segmentation image')
|
|
381
|
+
_add_common_args(parser_eroded_wm)
|
|
382
|
+
|
|
360
383
|
return parser
|
|
361
384
|
|
|
362
385
|
|
|
@@ -454,6 +477,15 @@ def main():
|
|
|
454
477
|
end_time=args.end_time,
|
|
455
478
|
weight=args.weight,
|
|
456
479
|
dose=args.dose)
|
|
480
|
+
case 'seg_crop':
|
|
481
|
+
input_img = ants.image_read(filename=args.input_img)
|
|
482
|
+
seg_img = ants.image_read(filename=args.segmentation)
|
|
483
|
+
seg_cropped = segmentation_tools.seg_crop_to_pet_fov(pet_img=input_img,
|
|
484
|
+
segmentation_img=seg_img)
|
|
485
|
+
ants.image_write(seg_cropped,args.out_img)
|
|
486
|
+
case 'eroded_wm':
|
|
487
|
+
segmentation_tools.eroded_wm_segmentation(input_segmentation_path=args.input_img,
|
|
488
|
+
out_segmentation_path=args.out_img)
|
|
457
489
|
|
|
458
490
|
if __name__ == "__main__":
|
|
459
491
|
main()
|
|
@@ -84,7 +84,9 @@ def segmentations_merge(segmentation_primary: np.ndarray,
|
|
|
84
84
|
regions added.
|
|
85
85
|
"""
|
|
86
86
|
for region in regions:
|
|
87
|
-
|
|
87
|
+
condition_above = segmentation_secondary > region - 0.1
|
|
88
|
+
condition_below = segmentation_secondary < region + 0.1
|
|
89
|
+
region_mask = condition_above & condition_below
|
|
88
90
|
segmentation_primary[region_mask] = region
|
|
89
91
|
return segmentation_primary
|
|
90
92
|
|
|
@@ -229,8 +231,9 @@ def resample_segmentation(input_image_path: str,
|
|
|
229
231
|
seg_image = nibabel.load(segmentation_image_path)
|
|
230
232
|
pet_series = pet_image.get_fdata()
|
|
231
233
|
image_first_frame = pet_series[:, :, :, 0]
|
|
234
|
+
to_vox_map_tuple = (image_first_frame.shape, pet_image.affine)
|
|
232
235
|
seg_resampled = processing.resample_from_to(from_img=seg_image,
|
|
233
|
-
to_vox_map=
|
|
236
|
+
to_vox_map=to_vox_map_tuple,
|
|
234
237
|
order=0)
|
|
235
238
|
nibabel.save(seg_resampled, out_seg_path)
|
|
236
239
|
if verbose:
|
|
@@ -238,23 +241,30 @@ def resample_segmentation(input_image_path: str,
|
|
|
238
241
|
|
|
239
242
|
|
|
240
243
|
def vat_wm_ref_region(input_segmentation_path: str,
|
|
241
|
-
out_segmentation_path: str):
|
|
244
|
+
out_segmentation_path: str | None) -> ants.ANTsImage:
|
|
242
245
|
"""
|
|
243
246
|
Generates the cortical white matter reference region described in O'Donnell
|
|
244
|
-
JL et al. (2024)
|
|
247
|
+
JL et al. (2024).
|
|
248
|
+
|
|
249
|
+
Reference: O'Donnell JL et al. (2024). PET Quantification of [18F]VAT in Human Brain and Its
|
|
245
250
|
Test-Retest Reproducibility and Age Dependence. J Nucl Med. 2024 Jun
|
|
246
251
|
3;65(6):956-961. doi: 10.2967/jnumed.123.266860. PMID: 38604762; PMCID:
|
|
247
|
-
PMC11149597.
|
|
252
|
+
PMC11149597.
|
|
253
|
+
|
|
254
|
+
Requires FreeSurfer segmentation with original label mappings.
|
|
248
255
|
|
|
249
256
|
Args:
|
|
250
257
|
input_segmentation_path (str): Path to segmentation on which white
|
|
251
258
|
matter reference region is computed.
|
|
252
259
|
out_segmentation_path (str): Path to which white matter reference
|
|
253
260
|
region mask image is saved.
|
|
261
|
+
|
|
262
|
+
Returns:
|
|
263
|
+
wm_erode (ants.ANTsImage): Eroded white matter reference region mask image.
|
|
254
264
|
"""
|
|
255
265
|
wm_regions = [2,41,251,252,253,254,255,77,3000,3001,3002,3003,3004,3005,
|
|
256
266
|
3006,3007,3008,3009,3010,3011,3012,3013,3014,3015,3016,3017,
|
|
257
|
-
3018,3019,3020,3021,3022,3023,3024,3025,3026,3027,
|
|
267
|
+
3018,3019,3020,3021,3022,3023,3024,3025,3026,3027,3028,3029,
|
|
258
268
|
3030,3031,3032,3033,3034,3035,4000,4001,4002,4003,4004,4005,
|
|
259
269
|
4006,4007,4008,4009,4010,4011,4012,4013,4014,4015,4016,4017,
|
|
260
270
|
4018,4019,4020,4021,4022,4023,4024,4025,4026,4027,4028,4029,
|
|
@@ -277,7 +287,45 @@ def vat_wm_ref_region(input_segmentation_path: str,
|
|
|
277
287
|
wm_csf_eroded = ants.threshold_image(image=wm_csf_blurred, low_thresh=0.95, binary=True)
|
|
278
288
|
wm_erode = ants.mask_image(image=wm_merged, mask=wm_csf_eroded)
|
|
279
289
|
|
|
280
|
-
|
|
290
|
+
if out_segmentation_path is not None:
|
|
291
|
+
ants.image_write(image=wm_erode, filename=out_segmentation_path)
|
|
292
|
+
|
|
293
|
+
return wm_erode
|
|
294
|
+
|
|
295
|
+
|
|
296
|
+
def eroded_wm_segmentation(input_segmentation_path: str,
|
|
297
|
+
out_segmentation_path: str | None,
|
|
298
|
+
eroded_wm_region_mapping: int = 1) -> ants.ANTsImage:
|
|
299
|
+
"""
|
|
300
|
+
Generates eroded white matter region on a segmentation image and merges it into the image,
|
|
301
|
+
saving result as a new segmentation image.
|
|
302
|
+
|
|
303
|
+
Requires FreeSurfer segmentation with original label mappings.
|
|
304
|
+
|
|
305
|
+
Args:
|
|
306
|
+
input_segmentation_path (str): Path to input freesurfer segmentation, such as aparc+aseg or
|
|
307
|
+
wmparc.
|
|
308
|
+
out_segmentation_path (str): Path to output segmentation image with replaced values in
|
|
309
|
+
eroded whited matter region.
|
|
310
|
+
eroded_wm_region_mapping (int): Segmentation mapping for the eroded white matter region in
|
|
311
|
+
the output image. Default "1".
|
|
312
|
+
|
|
313
|
+
Returns:
|
|
314
|
+
seg_img (ants.ANTsImage): Input segmentation image with values in eroded white matter
|
|
315
|
+
replaced with `eroded_wm_region_mapping`.
|
|
316
|
+
|
|
317
|
+
See also:
|
|
318
|
+
:meth:`~petpal.preproc.segmentation_tools.vat_wm_ref_region` - function that generates the
|
|
319
|
+
eroded white matter region.
|
|
320
|
+
"""
|
|
321
|
+
wm_erode = vat_wm_ref_region(input_segmentation_path=input_segmentation_path,
|
|
322
|
+
out_segmentation_path=None)
|
|
323
|
+
seg_img = ants.image_read(input_segmentation_path)
|
|
324
|
+
seg_img[wm_erode==1] = int(eroded_wm_region_mapping)
|
|
325
|
+
if out_segmentation_path is not None:
|
|
326
|
+
ants.image_write(image=seg_img, filename=out_segmentation_path)
|
|
327
|
+
|
|
328
|
+
return seg_img
|
|
281
329
|
|
|
282
330
|
|
|
283
331
|
def vat_wm_region_merge(wmparc_segmentation_path: str,
|
|
@@ -500,7 +548,8 @@ def calc_vesselness_mask_from_quantiled_vesselness(input_image: ants.core.ANTsIm
|
|
|
500
548
|
morph_dil_radius: int = 0,
|
|
501
549
|
z_crop: int = 3) -> ants.core.ANTsImage:
|
|
502
550
|
"""
|
|
503
|
-
Generates a binary vesselness mask from a given vesselness image using quantile-based
|
|
551
|
+
Generates a binary vesselness mask from a given vesselness image using quantile-based
|
|
552
|
+
thresholding.
|
|
504
553
|
|
|
505
554
|
This function creates a binary mask by thresholding a vesselness image at a specified
|
|
506
555
|
quantile of non-zero voxel values. Additionally, it allows for optional z-axis cropping
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|