petpal 0.5.5__tar.gz → 0.5.7__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.
Files changed (149) hide show
  1. {petpal-0.5.5 → petpal-0.5.7}/PKG-INFO +13 -4
  2. {petpal-0.5.5 → petpal-0.5.7}/README.md +11 -1
  3. {petpal-0.5.5 → petpal-0.5.7}/petpal/cli/cli_pib_processing.py +2 -3
  4. {petpal-0.5.5 → petpal-0.5.7}/petpal/cli/cli_preproc.py +119 -93
  5. {petpal-0.5.5 → petpal-0.5.7}/petpal/cli/cli_vat_processing.py +3 -2
  6. {petpal-0.5.5 → petpal-0.5.7}/petpal/pipelines/pipelines.py +0 -3
  7. {petpal-0.5.5 → petpal-0.5.7}/petpal/pipelines/preproc_steps.py +8 -7
  8. {petpal-0.5.5 → petpal-0.5.7}/petpal/preproc/__init__.py +2 -0
  9. {petpal-0.5.5 → petpal-0.5.7}/petpal/preproc/image_operations_4d.py +13 -177
  10. {petpal-0.5.5 → petpal-0.5.7}/petpal/preproc/motion_corr.py +31 -112
  11. petpal-0.5.7/petpal/preproc/motion_target.py +90 -0
  12. {petpal-0.5.5 → petpal-0.5.7}/petpal/preproc/regional_tac_extraction.py +3 -3
  13. {petpal-0.5.5 → petpal-0.5.7}/petpal/preproc/register.py +4 -11
  14. {petpal-0.5.5 → petpal-0.5.7}/petpal/preproc/segmentation_tools.py +5 -5
  15. petpal-0.5.7/petpal/preproc/standard_uptake_value.py +159 -0
  16. {petpal-0.5.5 → petpal-0.5.7}/petpal/utils/stats.py +21 -0
  17. {petpal-0.5.5 → petpal-0.5.7}/petpal/utils/useful_functions.py +106 -5
  18. {petpal-0.5.5 → petpal-0.5.7}/pyproject.toml +3 -4
  19. {petpal-0.5.5 → petpal-0.5.7}/.github/ISSUE_TEMPLATE/bug_report.md +0 -0
  20. {petpal-0.5.5 → petpal-0.5.7}/.github/ISSUE_TEMPLATE/feature_request.md +0 -0
  21. {petpal-0.5.5 → petpal-0.5.7}/.github/workflows/publish-to-pypi.yml +0 -0
  22. {petpal-0.5.5 → petpal-0.5.7}/.github/workflows/python-package.yml +0 -0
  23. {petpal-0.5.5 → petpal-0.5.7}/.gitignore +0 -0
  24. {petpal-0.5.5 → petpal-0.5.7}/.readthedocs.yaml +0 -0
  25. {petpal-0.5.5 → petpal-0.5.7}/LICENSE +0 -0
  26. {petpal-0.5.5 → petpal-0.5.7}/data/tcm_tacs/1tcm/gaussian_noise/tac_1tcm_set-00.txt +0 -0
  27. {petpal-0.5.5 → petpal-0.5.7}/data/tcm_tacs/1tcm/gaussian_noise/tac_1tcm_set-01.txt +0 -0
  28. {petpal-0.5.5 → petpal-0.5.7}/data/tcm_tacs/1tcm/gaussian_noise/tac_1tcm_set-02.txt +0 -0
  29. {petpal-0.5.5 → petpal-0.5.7}/data/tcm_tacs/1tcm/gaussian_noise/tacs.pdf +0 -0
  30. {petpal-0.5.5 → petpal-0.5.7}/data/tcm_tacs/1tcm/gaussian_noise/tacs.png +0 -0
  31. {petpal-0.5.5 → petpal-0.5.7}/data/tcm_tacs/1tcm/noise_free/tac_1tcm_set-00.txt +0 -0
  32. {petpal-0.5.5 → petpal-0.5.7}/data/tcm_tacs/1tcm/noise_free/tac_1tcm_set-01.txt +0 -0
  33. {petpal-0.5.5 → petpal-0.5.7}/data/tcm_tacs/1tcm/noise_free/tac_1tcm_set-02.txt +0 -0
  34. {petpal-0.5.5 → petpal-0.5.7}/data/tcm_tacs/1tcm/noise_free/tacs.pdf +0 -0
  35. {petpal-0.5.5 → petpal-0.5.7}/data/tcm_tacs/1tcm/noise_free/tacs.png +0 -0
  36. {petpal-0.5.5 → petpal-0.5.7}/data/tcm_tacs/1tcm/params_1tcm_set-00.json +0 -0
  37. {petpal-0.5.5 → petpal-0.5.7}/data/tcm_tacs/1tcm/params_1tcm_set-01.json +0 -0
  38. {petpal-0.5.5 → petpal-0.5.7}/data/tcm_tacs/1tcm/params_1tcm_set-02.json +0 -0
  39. {petpal-0.5.5 → petpal-0.5.7}/data/tcm_tacs/fdg_plasma_clamp_evenly_resampled.txt +0 -0
  40. {petpal-0.5.5 → petpal-0.5.7}/data/tcm_tacs/fdg_plasma_clamp_evenly_resampled_woMax.txt +0 -0
  41. {petpal-0.5.5 → petpal-0.5.7}/data/tcm_tacs/fdg_plasma_clamp_tacs.pdf +0 -0
  42. {petpal-0.5.5 → petpal-0.5.7}/data/tcm_tacs/fdg_plasma_clamp_tacs.png +0 -0
  43. {petpal-0.5.5 → petpal-0.5.7}/data/tcm_tacs/gen_tcms_data.ipynb +0 -0
  44. {petpal-0.5.5 → petpal-0.5.7}/data/tcm_tacs/readme.md +0 -0
  45. {petpal-0.5.5 → petpal-0.5.7}/data/tcm_tacs/serial_2tcm/gaussian_noise/tac_2tcm_set-00.txt +0 -0
  46. {petpal-0.5.5 → petpal-0.5.7}/data/tcm_tacs/serial_2tcm/gaussian_noise/tac_2tcm_set-01.txt +0 -0
  47. {petpal-0.5.5 → petpal-0.5.7}/data/tcm_tacs/serial_2tcm/gaussian_noise/tac_2tcm_set-02.txt +0 -0
  48. {petpal-0.5.5 → petpal-0.5.7}/data/tcm_tacs/serial_2tcm/gaussian_noise/tacs.pdf +0 -0
  49. {petpal-0.5.5 → petpal-0.5.7}/data/tcm_tacs/serial_2tcm/gaussian_noise/tacs.png +0 -0
  50. {petpal-0.5.5 → petpal-0.5.7}/data/tcm_tacs/serial_2tcm/noise_free/tac_2tcm_set-00.txt +0 -0
  51. {petpal-0.5.5 → petpal-0.5.7}/data/tcm_tacs/serial_2tcm/noise_free/tac_2tcm_set-01.txt +0 -0
  52. {petpal-0.5.5 → petpal-0.5.7}/data/tcm_tacs/serial_2tcm/noise_free/tac_2tcm_set-02.txt +0 -0
  53. {petpal-0.5.5 → petpal-0.5.7}/data/tcm_tacs/serial_2tcm/noise_free/tacs.pdf +0 -0
  54. {petpal-0.5.5 → petpal-0.5.7}/data/tcm_tacs/serial_2tcm/noise_free/tacs.png +0 -0
  55. {petpal-0.5.5 → petpal-0.5.7}/data/tcm_tacs/serial_2tcm/params_serial_2tcm_set-00.json +0 -0
  56. {petpal-0.5.5 → petpal-0.5.7}/data/tcm_tacs/serial_2tcm/params_serial_2tcm_set-01.json +0 -0
  57. {petpal-0.5.5 → petpal-0.5.7}/data/tcm_tacs/serial_2tcm/params_serial_2tcm_set-02.json +0 -0
  58. {petpal-0.5.5 → petpal-0.5.7}/data/tcm_tacs/serial_2tcm_k4zero/gaussian_noise/tac_2tcm_k4zero_set-00.txt +0 -0
  59. {petpal-0.5.5 → petpal-0.5.7}/data/tcm_tacs/serial_2tcm_k4zero/gaussian_noise/tac_2tcm_k4zero_set-01.txt +0 -0
  60. {petpal-0.5.5 → petpal-0.5.7}/data/tcm_tacs/serial_2tcm_k4zero/gaussian_noise/tacs.pdf +0 -0
  61. {petpal-0.5.5 → petpal-0.5.7}/data/tcm_tacs/serial_2tcm_k4zero/gaussian_noise/tacs.png +0 -0
  62. {petpal-0.5.5 → petpal-0.5.7}/data/tcm_tacs/serial_2tcm_k4zero/noise_free/tac_2tcm_k4zero_set-00.txt +0 -0
  63. {petpal-0.5.5 → petpal-0.5.7}/data/tcm_tacs/serial_2tcm_k4zero/noise_free/tac_2tcm_k4zero_set-01.txt +0 -0
  64. {petpal-0.5.5 → petpal-0.5.7}/data/tcm_tacs/serial_2tcm_k4zero/noise_free/tacs.pdf +0 -0
  65. {petpal-0.5.5 → petpal-0.5.7}/data/tcm_tacs/serial_2tcm_k4zero/noise_free/tacs.png +0 -0
  66. {petpal-0.5.5 → petpal-0.5.7}/data/tcm_tacs/serial_2tcm_k4zero/params_serial_2tcm_k4zero_set-00.json +0 -0
  67. {petpal-0.5.5 → petpal-0.5.7}/data/tcm_tacs/serial_2tcm_k4zero/params_serial_2tcm_k4zero_set-01.json +0 -0
  68. {petpal-0.5.5 → petpal-0.5.7}/data/tcm_tacs/turku_pet_center_fdg_plasma_clamp.txt +0 -0
  69. {petpal-0.5.5 → petpal-0.5.7}/docs/Makefile +0 -0
  70. {petpal-0.5.5 → petpal-0.5.7}/docs/PETPAL_Logo.png +0 -0
  71. {petpal-0.5.5 → petpal-0.5.7}/docs/_templates/index.rst +0 -0
  72. {petpal-0.5.5 → petpal-0.5.7}/docs/_templates/python/attribute.rst +0 -0
  73. {petpal-0.5.5 → petpal-0.5.7}/docs/_templates/python/class.rst +0 -0
  74. {petpal-0.5.5 → petpal-0.5.7}/docs/_templates/python/data.rst +0 -0
  75. {petpal-0.5.5 → petpal-0.5.7}/docs/_templates/python/exception.rst +0 -0
  76. {petpal-0.5.5 → petpal-0.5.7}/docs/_templates/python/function.rst +0 -0
  77. {petpal-0.5.5 → petpal-0.5.7}/docs/_templates/python/method.rst +0 -0
  78. {petpal-0.5.5 → petpal-0.5.7}/docs/_templates/python/module.rst +0 -0
  79. {petpal-0.5.5 → petpal-0.5.7}/docs/_templates/python/package.rst +0 -0
  80. {petpal-0.5.5 → petpal-0.5.7}/docs/_templates/python/property.rst +0 -0
  81. {petpal-0.5.5 → petpal-0.5.7}/docs/conf.py +0 -0
  82. {petpal-0.5.5 → petpal-0.5.7}/docs/index.rst +0 -0
  83. {petpal-0.5.5 → petpal-0.5.7}/docs/make.bat +0 -0
  84. {petpal-0.5.5 → petpal-0.5.7}/docs/requirements.txt +0 -0
  85. {petpal-0.5.5 → petpal-0.5.7}/docs/tutorials/index.rst +0 -0
  86. {petpal-0.5.5 → petpal-0.5.7}/docs/tutorials/pib_example.rst +0 -0
  87. {petpal-0.5.5 → petpal-0.5.7}/petpal/__init__.py +0 -0
  88. {petpal-0.5.5 → petpal-0.5.7}/petpal/cli/__init__.py +0 -0
  89. {petpal-0.5.5 → petpal-0.5.7}/petpal/cli/cli_graphical_analysis.py +0 -0
  90. {petpal-0.5.5 → petpal-0.5.7}/petpal/cli/cli_graphical_plots.py +0 -0
  91. {petpal-0.5.5 → petpal-0.5.7}/petpal/cli/cli_idif.py +0 -0
  92. {petpal-0.5.5 → petpal-0.5.7}/petpal/cli/cli_parametric_images.py +0 -0
  93. {petpal-0.5.5 → petpal-0.5.7}/petpal/cli/cli_plot_tacs.py +0 -0
  94. {petpal-0.5.5 → petpal-0.5.7}/petpal/cli/cli_pvc.py +0 -0
  95. {petpal-0.5.5 → petpal-0.5.7}/petpal/cli/cli_reference_tissue_models.py +0 -0
  96. {petpal-0.5.5 → petpal-0.5.7}/petpal/cli/cli_stats.py +0 -0
  97. {petpal-0.5.5 → petpal-0.5.7}/petpal/cli/cli_tac_fitting.py +0 -0
  98. {petpal-0.5.5 → petpal-0.5.7}/petpal/cli/cli_tac_interpolation.py +0 -0
  99. {petpal-0.5.5 → petpal-0.5.7}/petpal/input_function/__init__.py +0 -0
  100. {petpal-0.5.5 → petpal-0.5.7}/petpal/input_function/blood_input.py +0 -0
  101. {petpal-0.5.5 → petpal-0.5.7}/petpal/input_function/idif_necktangle.py +0 -0
  102. {petpal-0.5.5 → petpal-0.5.7}/petpal/input_function/pca_guided_idif.py +0 -0
  103. {petpal-0.5.5 → petpal-0.5.7}/petpal/kinetic_modeling/__init__.py +0 -0
  104. {petpal-0.5.5 → petpal-0.5.7}/petpal/kinetic_modeling/fit_tac_with_rtms.py +0 -0
  105. {petpal-0.5.5 → petpal-0.5.7}/petpal/kinetic_modeling/graphical_analysis.py +0 -0
  106. {petpal-0.5.5 → petpal-0.5.7}/petpal/kinetic_modeling/parametric_images.py +0 -0
  107. {petpal-0.5.5 → petpal-0.5.7}/petpal/kinetic_modeling/reference_tissue_models.py +0 -0
  108. {petpal-0.5.5 → petpal-0.5.7}/petpal/kinetic_modeling/rtm_analysis.py +0 -0
  109. {petpal-0.5.5 → petpal-0.5.7}/petpal/kinetic_modeling/tac_fitting.py +0 -0
  110. {petpal-0.5.5 → petpal-0.5.7}/petpal/kinetic_modeling/tac_interpolation.py +0 -0
  111. {petpal-0.5.5 → petpal-0.5.7}/petpal/kinetic_modeling/tac_uncertainty.py +0 -0
  112. {petpal-0.5.5 → petpal-0.5.7}/petpal/kinetic_modeling/tcms_as_convolutions.py +0 -0
  113. {petpal-0.5.5 → petpal-0.5.7}/petpal/meta/__init__.py +0 -0
  114. {petpal-0.5.5 → petpal-0.5.7}/petpal/meta/label_maps.py +0 -0
  115. {petpal-0.5.5 → petpal-0.5.7}/petpal/pipelines/__init__.py +0 -0
  116. {petpal-0.5.5 → petpal-0.5.7}/petpal/pipelines/kinetic_modeling_steps.py +0 -0
  117. {petpal-0.5.5 → petpal-0.5.7}/petpal/pipelines/pca_guided_idif_steps.py +0 -0
  118. {petpal-0.5.5 → petpal-0.5.7}/petpal/pipelines/steps_base.py +0 -0
  119. {petpal-0.5.5 → petpal-0.5.7}/petpal/pipelines/steps_containers.py +0 -0
  120. {petpal-0.5.5 → petpal-0.5.7}/petpal/preproc/decay_correction.py +0 -0
  121. {petpal-0.5.5 → petpal-0.5.7}/petpal/preproc/partial_volume_corrections.py +0 -0
  122. {petpal-0.5.5 → petpal-0.5.7}/petpal/preproc/symmetric_geometric_transfer_matrix.py +0 -0
  123. {petpal-0.5.5 → petpal-0.5.7}/petpal/utils/__init__.py +0 -0
  124. {petpal-0.5.5 → petpal-0.5.7}/petpal/utils/bids_utils.py +0 -0
  125. {petpal-0.5.5 → petpal-0.5.7}/petpal/utils/constants.py +0 -0
  126. {petpal-0.5.5 → petpal-0.5.7}/petpal/utils/data_driven_image_analyses.py +0 -0
  127. {petpal-0.5.5 → petpal-0.5.7}/petpal/utils/decorators.py +0 -0
  128. {petpal-0.5.5 → petpal-0.5.7}/petpal/utils/image_io.py +0 -0
  129. {petpal-0.5.5 → petpal-0.5.7}/petpal/utils/math_lib.py +0 -0
  130. {petpal-0.5.5 → petpal-0.5.7}/petpal/utils/metadata.py +0 -0
  131. {petpal-0.5.5 → petpal-0.5.7}/petpal/utils/scan_timing.py +0 -0
  132. {petpal-0.5.5 → petpal-0.5.7}/petpal/utils/testing_utils.py +0 -0
  133. {petpal-0.5.5 → petpal-0.5.7}/petpal/utils/time_activity_curve.py +0 -0
  134. {petpal-0.5.5 → petpal-0.5.7}/petpal/visualizations/__init__.py +0 -0
  135. {petpal-0.5.5 → petpal-0.5.7}/petpal/visualizations/graphical_plots.py +0 -0
  136. {petpal-0.5.5 → petpal-0.5.7}/petpal/visualizations/image_visualization.py +0 -0
  137. {petpal-0.5.5 → petpal-0.5.7}/petpal/visualizations/qc_plots.py +0 -0
  138. {petpal-0.5.5 → petpal-0.5.7}/petpal/visualizations/tac_plots.py +0 -0
  139. {petpal-0.5.5 → petpal-0.5.7}/shared/dseg.tsv +0 -0
  140. {petpal-0.5.5 → petpal-0.5.7}/shared/freesurfer_lmap.json +0 -0
  141. {petpal-0.5.5 → petpal-0.5.7}/shared/freesurfer_lmap_lr.json +0 -0
  142. {petpal-0.5.5 → petpal-0.5.7}/shared/perl_cyno_lmap.json +0 -0
  143. {petpal-0.5.5 → petpal-0.5.7}/shared/perl_cyno_lmap_lr.json +0 -0
  144. {petpal-0.5.5 → petpal-0.5.7}/test_notebooks/explicit_tac_fitting/01_fitting_TCMs.ipynb +0 -0
  145. {petpal-0.5.5 → petpal-0.5.7}/test_notebooks/testing_RTMs/01_testing_RTMs.ipynb +0 -0
  146. {petpal-0.5.5 → petpal-0.5.7}/test_notebooks/testing_graphical_analyses/01_testing_on_tcms_database.ipynb +0 -0
  147. {petpal-0.5.5 → petpal-0.5.7}/test_notebooks/testing_graphical_analyses/02_testing_parametric_images.ipynb +0 -0
  148. {petpal-0.5.5 → petpal-0.5.7}/test_notebooks/testing_graphical_analyses/03_plotting_graphical_anlayses_testbed.ipynb +0 -0
  149. {petpal-0.5.5 → petpal-0.5.7}/tests/test_importpetpal.py +0 -0
@@ -1,10 +1,9 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: petpal
3
- Version: 0.5.5
3
+ Version: 0.5.7
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
- Author: Bradley Judge
7
- Author-email: Furqan Dar <dar@wustl.edu>, Noah Goldman <noahg@wustl.edu>, Kenan Oestreich <kenan.oestreich@wustl.edu>
6
+ Author-email: Noah Goldman <noahg@wustl.edu>, Bradley Judge <bjudge@wustl.edu>, Furqan Dar <dar@wustl.edu>, Kenan Oestreich <kenan.oestreich@wustl.edu>
8
7
  License-File: LICENSE
9
8
  Classifier: Development Status :: 2 - Pre-Alpha
10
9
  Classifier: Intended Audience :: Science/Research
@@ -45,7 +44,17 @@ Description-Content-Type: text/markdown
45
44
 
46
45
  ## Installation
47
46
 
48
- Currently, we only support building the package directly from source. Clone the repository using your preferred method. After navigating to the top-level directory (where `pyproject.toml` exists), we run the following command in the terminal:
47
+ ### Using Pip
48
+
49
+ The simplest way to install PETPAL is using pip. First, ensure you are using Python version >=3.12. Then, run the following:
50
+
51
+ ```shell
52
+ pip install petpal
53
+ ```
54
+
55
+ ### Build from source
56
+
57
+ Clone the repository using your preferred method. After navigating to the top-level directory (where `pyproject.toml` exists), we run the following command in the terminal:
49
58
 
50
59
  ```shell
51
60
  pip install . # Installs the package
@@ -9,7 +9,17 @@
9
9
 
10
10
  ## Installation
11
11
 
12
- Currently, we only support building the package directly from source. Clone the repository using your preferred method. After navigating to the top-level directory (where `pyproject.toml` exists), we run the following command in the terminal:
12
+ ### Using Pip
13
+
14
+ The simplest way to install PETPAL is using pip. First, ensure you are using Python version >=3.12. Then, run the following:
15
+
16
+ ```shell
17
+ pip install petpal
18
+ ```
19
+
20
+ ### Build from source
21
+
22
+ Clone the repository using your preferred method. After navigating to the top-level directory (where `pyproject.toml` exists), we run the following command in the terminal:
13
23
 
14
24
  ```shell
15
25
  pip install . # Installs the package
@@ -94,12 +94,11 @@ def main():
94
94
 
95
95
  # Configure steps for kinetic modeling container
96
96
  suvr_step = ImageToImageStep(name='suvr',
97
- function=petpal.preproc.image_operations_4d.suvr,
97
+ function=petpal.preproc.standard_uptake_value.suvr,
98
98
  input_image_path='',
99
99
  output_image_path='',
100
100
  ref_region=ref_region_label,
101
- segmentation_image_path=seg_path,
102
- verbose=False)
101
+ segmentation_image_path=seg_path)
103
102
 
104
103
  # Add steps to kinetic modeling container
105
104
  kinetic_modeling_container.add_step(step=suvr_step)
@@ -33,7 +33,7 @@ Examples:
33
33
 
34
34
  .. code-block:: bash
35
35
 
36
- petpal-preproc register-pet -i /path/to/input_img.nii.gz -o petpal_reg.nii.gz --motion-target 0 600 --anatomical /path/to/anat.nii.gz --half-life 6584
36
+ petpal-preproc register-pet -i /path/to/input_img.nii.gz -o petpal_reg.nii.gz --motion-target 0 600 --anatomical /path/to/anat.nii.gz
37
37
 
38
38
 
39
39
  * Write regional tacs:
@@ -54,7 +54,7 @@ Examples:
54
54
 
55
55
  .. code-block:: bash
56
56
 
57
- petpal-preproc weighted-series-sum -i /path/to/input_img.nii.gz -o petpal_wss.nii.gz --half-life 6584 --start-time 1800 --end-time 7200
57
+ petpal-preproc weighted-series-sum -i /path/to/input_img.nii.gz -o petpal_wss.nii.gz --start-time 1800 --end-time 7200
58
58
 
59
59
 
60
60
  * SUVR Image:
@@ -95,8 +95,11 @@ import argparse
95
95
  import ants
96
96
 
97
97
 
98
- from ..utils import useful_functions
99
- from ..preproc import image_operations_4d, motion_corr, register, regional_tac_extraction
98
+ from ..preproc import (image_operations_4d,
99
+ motion_corr,
100
+ register,
101
+ regional_tac_extraction,
102
+ standard_uptake_value)
100
103
 
101
104
 
102
105
  _PREPROC_EXAMPLES_ = r"""
@@ -106,13 +109,13 @@ Examples:
106
109
  - Windowed moco:
107
110
  petpal-preproc windowed-motion-corr -i /path/to/input_img.nii.gz -o petpal_moco.nii.gz --window-size 120 --transform-type QuickRigid
108
111
  - Register to anatomical:
109
- petpal-preproc register-pet -i /path/to/input_img.nii.gz -o petpal_reg.nii.gz --motion-target 0 600 --anatomical /path/to/anat.nii.gz --half-life 6584
112
+ petpal-preproc register-pet -i /path/to/input_img.nii.gz -o petpal_reg.nii.gz --motion-target 0 600 --anatomical /path/to/anat.nii.gz
110
113
  - Write regional tacs:
111
114
  petpal-preproc write-tacs -i /path/to/input_img.nii.gz -p sub-001 -o /tmp/petpal_tacs -s /path/to/segmentation.nii.gz -l perlcyno -x
112
115
  - Write tacs, deprecated:
113
116
  petpal-preproc write-tacs-old -i /path/to/input_img.nii.gz -o /tmp/petpal_tacs --segmentation /path/to/segmentation.nii.gz --label-map-path /path/to/dseg.tsv
114
117
  - Half life weighted sum of series:
115
- petpal-preproc weighted-series-sum -i /path/to/input_img.nii.gz -o petpal_wss.nii.gz --half-life 6584 --start-time 1800 --end-time 7200
118
+ petpal-preproc weighted-series-sum -i /path/to/input_img.nii.gz -o petpal_wss.nii.gz --start-time 1800 --end-time 7200
116
119
  - SUVR:
117
120
  petpal-preproc suvr -i /path/to/input_img.nii.gz -o petpal_suvr.nii.gz --segmentation /path/to/segmentation.nii.gz --ref-region 1
118
121
  - Gauss blur:
@@ -121,6 +124,8 @@ Examples:
121
124
  petpal-preproc rescale-image -i /path/to/input_img.nii.gz -o petpal_rescale.nii.gz --scale-factor 1000
122
125
  - Warp to atlas:
123
126
  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
+ - SUV:
128
+ 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
124
129
  """
125
130
 
126
131
 
@@ -159,7 +164,7 @@ def _add_common_args(parser: argparse.ArgumentParser) -> None:
159
164
  """
160
165
  parser.add_argument('-o',
161
166
  '--out-img',
162
- default='petpal_wss_output.nii.gz',
167
+ default='petpal_preproc_output.nii.gz',
163
168
  help='Output image filename')
164
169
  parser.add_argument('-i', '--input-img',required=True,help='Path to input image.',type=str)
165
170
 
@@ -183,10 +188,6 @@ def _generate_args() -> argparse.ArgumentParser:
183
188
  parser_wss = subparsers.add_parser('weighted-series-sum',
184
189
  help='Half-life weighted sum of 4D PET series.')
185
190
  _add_common_args(parser_wss)
186
- parser_wss.add_argument('--half-life',
187
- required=True,
188
- help='Half life of radioisotope in seconds.',
189
- type=float)
190
191
  parser_wss.add_argument('--start-time',
191
192
  required=False,
192
193
  help='Start time of sum in seconds.',
@@ -215,9 +216,6 @@ def _generate_args() -> argparse.ArgumentParser:
215
216
  required=True)
216
217
  parser_moco.add_argument('--transform-type', required=False,default='Rigid',
217
218
  help='Transformation type (Rigid or Affine).',type=str)
218
- parser_moco.add_argument('--half-life', required=False,
219
- help='Half life of radioisotope in seconds.'
220
- 'Required for some motion targets.',type=float)
221
219
 
222
220
  parser_tac = subparsers.add_parser('write-tacs',
223
221
  help='Write ROI TACs from 4D PET using segmentation masks.')
@@ -279,9 +277,19 @@ def _generate_args() -> argparse.ArgumentParser:
279
277
  help='Path to segmentation image in anatomical space.')
280
278
  parser_suvr.add_argument('-r',
281
279
  '--ref-region',
282
- help='Reference region to normalize SUVR to.',
280
+ help='Reference region to normalize SUVR to. List multiple regions to '
281
+ 'combine as one reference.',
283
282
  required=True,
284
- type=int)
283
+ type=int,
284
+ nargs='+')
285
+ parser_suvr.add_argument('--start-time',
286
+ required=True,
287
+ help='Start time for SUVR calculation in seconds from scan start',
288
+ type=float)
289
+ parser_suvr.add_argument('--end-time',
290
+ required=True,
291
+ help='End time for SUVR calculation in seconds from scan start',
292
+ type=float)
285
293
 
286
294
  parser_blur = subparsers.add_parser('gauss-blur',help='Perform 3D gaussian blurring.')
287
295
  _add_common_args(parser_blur)
@@ -328,9 +336,27 @@ def _generate_args() -> argparse.ArgumentParser:
328
336
  help="Motion target option. Can be an image path, "
329
337
  "'weighted_series_sum' or a tuple (i.e. '-t 0 600' for first "
330
338
  "ten minutes).")
331
- parser_reg.add_argument('-l', '--half-life', help='Half life of radioisotope in seconds.',
332
- type=float)
333
339
 
340
+ parser_suv = subparsers.add_parser('suv',help='Standard Uptake Value (SUV) calculation')
341
+ _add_common_args(parser_suv)
342
+ parser_suv.add_argument('-w',
343
+ '--weight',
344
+ required=True,
345
+ help='Weight of the participant in kg',
346
+ type=float)
347
+ parser_suv.add_argument('-d',
348
+ '--dose',
349
+ required=True,
350
+ help='Dose of radiotracer injected in MBq',
351
+ type=float)
352
+ parser_suv.add_argument('--start-time',
353
+ required=True,
354
+ help='Start time for SUV calculation in seconds from scan start',
355
+ type=float)
356
+ parser_suv.add_argument('--end-time',
357
+ required=True,
358
+ help='End time for SUV calculation in seconds from scan start',
359
+ type=float)
334
360
  return parser
335
361
 
336
362
 
@@ -345,89 +371,89 @@ def main():
345
371
  preproc_parser.print_help()
346
372
  raise SystemExit('Exiting without command')
347
373
 
348
- if len(args.motion_target)==1:
349
- motion_target = args.motion_target[0]
374
+ if 'motion_target' in dir(args):
375
+ if len(args.motion_target)==1:
376
+ motion_target = args.motion_target[0]
377
+ else:
378
+ motion_target = args.motion_target
350
379
  else:
351
- motion_target = args.motion_target
380
+ motion_target = None
352
381
 
353
382
  command = str(args.command).replace('-','_')
354
383
 
355
- if command=='weighted_series_sum':
356
- useful_functions.weighted_series_sum(input_image_4d_path=args.input_img,
357
- out_image_path=args.out_img,
358
- half_life=args.half_life,
359
- start_time=args.start_time,
360
- end_time=args.end_time,
361
- verbose=True)
362
-
363
- if command=='auto_crop':
364
- image_operations_4d.SimpleAutoImageCropper(input_image_path=args.input_img,
365
- out_image_path=args.out_img,
366
- thresh_val=args.thresh_val,
367
- verbose=True)
368
-
369
- if command=='motion_correction':
370
- motion_corr.motion_corr(input_image_4d_path=args.input_img,
384
+ match command:
385
+ case 'weighted_series_sum':
386
+ standard_uptake_value.weighted_sum_for_suv(input_image_path=args.input_img,
387
+ output_image_path=args.out_img,
388
+ start_time=args.start_time,
389
+ end_time=args.end_time)
390
+ case 'auto_crop':
391
+ image_operations_4d.SimpleAutoImageCropper(input_image_path=args.input_img,
392
+ out_image_path=args.out_img,
393
+ thresh_val=args.thresh_val,
394
+ verbose=True)
395
+ case 'motion_correction':
396
+ motion_corr.motion_corr(input_image_path=args.input_img,
397
+ out_image_path=args.out_img,
398
+ motion_target_option=motion_target,
399
+ verbose=True,
400
+ type_of_transform=args.transform_type)
401
+ case 'register_pet':
402
+ register.register_pet(input_reg_image_path=args.input_img,
371
403
  out_image_path=args.out_img,
404
+ reference_image_path=args.anatomical,
372
405
  motion_target_option=motion_target,
373
- verbose=True,
374
- type_of_transform=args.transform_type,
375
- half_life=args.half_life)
376
- if command=='register_pet':
377
- register.register_pet(input_reg_image_path=args.input_img,
378
- out_image_path=args.out_img,
379
- reference_image_path=args.anatomical,
380
- motion_target_option=motion_target,
381
- verbose=True,
382
- half_life=args.half_life)
383
-
384
- if command=='write_tacs_old':
385
- regional_tac_extraction.write_tacs(input_image_path=args.input_img,
386
- out_tac_dir=args.out_tac_dir,
387
- segmentation_image_path=args.segmentation,
388
- label_map_path=args.label_map_path,
389
- verbose=True)
390
-
391
- if command=='write_tacs':
392
- tac_obj = regional_tac_extraction.WriteRegionalTacs(input_image_path=args.input_img,
393
- segmentation_path=args.segmentation,
394
- label_map=args.label_map)
395
- tac_obj(out_tac_prefix=args.patid,
396
- out_tac_dir=args.out_tac_dir,
397
- one_tsv_per_region=not args.excel)
398
-
399
- if command=='warp_pet_atlas':
400
- register.warp_pet_atlas(input_image_path=args.input_img,
401
- anat_image_path=args.anatomical,
402
- atlas_image_path=args.reference_atlas,
403
- out_image_path=args.out_img,
404
406
  verbose=True)
405
-
406
- if command=='gauss_blur':
407
- image_operations_4d.gauss_blur(input_image_path=args.input_img,
408
- blur_size_mm=args.blur_size_mm,
407
+ case 'write_tacs_old':
408
+ regional_tac_extraction.write_tacs(input_image_path=args.input_img,
409
+ out_tac_dir=args.out_tac_dir,
410
+ segmentation_image_path=args.segmentation,
411
+ label_map_path=args.label_map_path,
412
+ verbose=True)
413
+ case 'write_tacs':
414
+ tac_obj = regional_tac_extraction.WriteRegionalTacs(input_image_path=args.input_img,
415
+ segmentation_path=args.segmentation,
416
+ label_map=args.label_map)
417
+ tac_obj(out_tac_prefix=args.patid,
418
+ out_tac_dir=args.out_tac_dir,
419
+ one_tsv_per_region=not args.excel)
420
+ case 'warp_pet_atlas':
421
+ register.warp_pet_to_atlas(input_image_path=args.input_img,
422
+ anat_image_path=args.anatomical,
423
+ atlas_image_path=args.reference_atlas,
409
424
  out_image_path=args.out_img,
410
- verbose=True,
411
- use_fwhm=True)
412
-
413
- if command=='suvr':
414
- image_operations_4d.suvr(input_image_path=args.input_img,
415
- out_image_path=args.out_img,
416
- segmentation_image_path=args.segmentation,
417
- ref_region=args.ref_region)
418
-
419
- if command=='windowed_motion_corr':
420
- motion_corr.windowed_motion_corr_to_target(input_image_path=args.input_img,
421
- out_image_path=args.out_img,
422
- motion_target_option=motion_target,
423
- w_size=args.window_size,
424
- type_of_transform=args.transform_type)
425
-
426
- if command=='rescale_image':
427
- input_img = ants.image_read(filename=args.input_img)
428
- out_img = image_operations_4d.rescale_image(input_image=input_img,
429
- rescale_constant=args.scale_factor)
430
- ants.image_write(image=out_img, filename=args.out_img)
425
+ verbose=True)
426
+ case 'gauss_blur':
427
+ image_operations_4d.gauss_blur(input_image_path=args.input_img,
428
+ blur_size_mm=args.blur_size_mm,
429
+ out_image_path=args.out_img,
430
+ verbose=True,
431
+ use_fwhm=True)
432
+ case 'suvr':
433
+ standard_uptake_value.suvr(input_image_path=args.input_img,
434
+ output_image_path=args.out_img,
435
+ segmentation_image_path=args.segmentation,
436
+ ref_region=args.ref_region,
437
+ start_time=args.start_time,
438
+ end_time=args.end_time)
439
+ case 'windowed_motion_corr':
440
+ motion_corr.windowed_motion_corr_to_target(input_image_path=args.input_img,
441
+ out_image_path=args.out_img,
442
+ motion_target_option=motion_target,
443
+ w_size=args.window_size,
444
+ type_of_transform=args.transform_type)
445
+ case 'rescale_image':
446
+ input_img = ants.image_read(filename=args.input_img)
447
+ out_img = image_operations_4d.rescale_image(input_image=input_img,
448
+ rescale_constant=args.scale_factor)
449
+ ants.image_write(image=out_img, filename=args.out_img)
450
+ case 'suv':
451
+ standard_uptake_value.suv(input_image_path=args.input_img,
452
+ output_image_path=args.out_img,
453
+ start_time=args.start_time,
454
+ end_time=args.end_time,
455
+ weight=args.weight,
456
+ dose=args.dose)
431
457
 
432
458
  if __name__ == "__main__":
433
459
  main()
@@ -7,6 +7,7 @@ from petpal.kinetic_modeling import graphical_analysis,rtm_analysis
7
7
  from petpal.preproc import image_operations_4d, motion_corr, register, segmentation_tools
8
8
  from petpal.preproc import symmetric_geometric_transfer_matrix as sgtm
9
9
  import petpal.preproc.regional_tac_extraction
10
+ import petpal.preproc.standard_uptake_value
10
11
  from petpal.utils.bids_utils import gen_bids_like_dir_path, gen_bids_like_filename, gen_bids_like_filepath
11
12
  from petpal.utils.image_io import km_regional_fits_to_tsv
12
13
  from petpal.utils import useful_functions
@@ -199,13 +200,13 @@ def vat_protocol(subjstring: str,
199
200
  wss_file_path = vat_bids_filepath(suffix='pet',folder='pet',space='mpr',desc='WSS')
200
201
  suvr_file_path = vat_bids_filepath(suffix='pet',folder='pet',space='mpr',desc='SUVR')
201
202
  if 'suvr' not in skip:
202
- useful_functions.weighted_series_sum(input_image_4d_path=pet_reg_anat_file,
203
+ useful_functions.weighted_series_sum(input_image_path=pet_reg_anat_file,
203
204
  half_life=half_life,
204
205
  verbose=True,
205
206
  start_time=suvr_start,
206
207
  end_time=suvr_end,
207
208
  out_image_path=wss_file_path)
208
- image_operations_4d.suvr(input_image_path=wss_file_path,
209
+ petpal.preproc.standard_uptake_value.suvr(input_image_path=wss_file_path,
209
210
  out_image_path=suvr_file_path,
210
211
  segmentation_image_path=vat_wm_ref_segmentation_file,
211
212
  ref_region=1,
@@ -4,7 +4,6 @@ import copy
4
4
  from typing import Union
5
5
  from .steps_base import *
6
6
  from .steps_containers import StepsContainer, StepsPipeline
7
- from ..utils.image_io import get_half_life_from_nifti
8
7
  from ..utils.bids_utils import gen_bids_like_dir_path, gen_bids_like_filepath
9
8
 
10
9
 
@@ -805,9 +804,7 @@ class BIDS_Pipeline(BIDSyPathsForPipelines, StepsPipeline):
805
804
  containers = obj.step_containers
806
805
 
807
806
  containers["preproc"][0].input_image_path = obj.pet_path
808
- containers["preproc"][1].kwargs['half_life'] = get_half_life_from_nifti(obj.pet_path)
809
807
  containers["preproc"][2].kwargs['reference_image_path'] = obj.anat_path
810
- containers["preproc"][2].kwargs['half_life'] = get_half_life_from_nifti(obj.pet_path)
811
808
  containers["preproc"][3].segmentation_label_map_path = obj.seg_table
812
809
  containers["preproc"][3].segmentation_image_path = obj.seg_img
813
810
  containers["preproc"][4].raw_blood_tac_path = obj.blood_path
@@ -612,9 +612,12 @@ class ImageToImageStep(FunctionBasedStep):
612
612
  Returns:
613
613
  ImageToImageStep: A new instance for motion correction frames above mean value.
614
614
  """
615
- defaults = dict(name=name, function=motion_corr_frames_above_mean_value,
616
- input_image_path='', output_image_path='', motion_target_option='mean_image', verbose=verbose,
617
- half_life=None, )
615
+ defaults = dict(name=name,
616
+ function=motion_corr_frames_above_mean_value,
617
+ input_image_path='',
618
+ output_image_path='',
619
+ motion_target_option='mean_image',
620
+ verbose=verbose)
618
621
  override_dict = defaults | overrides
619
622
  try:
620
623
  return cls(**override_dict)
@@ -649,7 +652,7 @@ class ImageToImageStep(FunctionBasedStep):
649
652
  return cls(**defaults)
650
653
 
651
654
  @classmethod
652
- def default_register_pet_to_t1(cls, name:str = 'register_pet_to_t1', reference_image_path='', half_life:float=None, verbose=False, **overrides):
655
+ def default_register_pet_to_t1(cls, name:str = 'register_pet_to_t1', reference_image_path='', verbose=False, **overrides):
653
656
  """
654
657
  Creates a default instance for registering PET to T1 image using :func:`register_pet<petpal.preproc.register.register_pet>`.
655
658
  All paths are empty-strings.
@@ -657,8 +660,6 @@ class ImageToImageStep(FunctionBasedStep):
657
660
  Args:
658
661
  name (str): Name of the step. Defaults to 'register_pet_to_t1'
659
662
  reference_image_path (str): Path to the reference image.
660
- half_life (float): Half-life value, in seconds, for the radiotracer. Used to
661
- generate a weighted_series_sum image.
662
663
  verbose (bool): Whether to run in verbose mode.
663
664
  **overrides: Override default parameters.
664
665
 
@@ -668,7 +669,7 @@ class ImageToImageStep(FunctionBasedStep):
668
669
  """
669
670
  defaults = dict(name=name, function=register_pet, input_image_path='', output_image_path='',
670
671
  reference_image_path=reference_image_path, motion_target_option='weighted_series_sum',
671
- verbose=verbose, half_life=half_life)
672
+ verbose=verbose)
672
673
  override_dict = defaults | overrides
673
674
  try:
674
675
  return cls(**override_dict)
@@ -1,8 +1,10 @@
1
1
  """Tools for preparing PET data for kinetic modeling and visualization"""
2
+ from . import motion_target
2
3
  from . import image_operations_4d
3
4
  from . import motion_corr
4
5
  from . import partial_volume_corrections
5
6
  from . import register
7
+ from . import standard_uptake_value
6
8
  from . import symmetric_geometric_transfer_matrix
7
9
  from . import segmentation_tools
8
10
  from . import decay_correction