ctkit 0.1.0__py3-none-any.whl

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.
@@ -0,0 +1,168 @@
1
+ Metadata-Version: 2.4
2
+ Name: ctkit
3
+ Version: 0.1.0
4
+ Summary: A toolkit for reproducible CT image processing for AI and radiomics.
5
+ Author-email: Joseph Rich <josephrich98@gmail.com>
6
+ Maintainer-email: Joseph Rich <josephrich98@gmail.com>
7
+ License: BSD 2-Clause License
8
+
9
+ Copyright (c) 2026, Pachter Lab
10
+
11
+ Redistribution and use in source and binary forms, with or without
12
+ modification, are permitted provided that the following conditions are met:
13
+
14
+ 1. Redistributions of source code must retain the above copyright notice, this
15
+ list of conditions and the following disclaimer.
16
+
17
+ 2. Redistributions in binary form must reproduce the above copyright notice,
18
+ this list of conditions and the following disclaimer in the documentation
19
+ and/or other materials provided with the distribution.
20
+
21
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
22
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
24
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
25
+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
27
+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
28
+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
29
+ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31
+
32
+ Project-URL: Homepage, https://github.com/pachterlab/ctkit
33
+ Project-URL: Source, https://github.com/pachterlab/ctkit
34
+ Project-URL: Issues, https://github.com/pachterlab/ctkit/issues
35
+ Keywords: AI,bioinformatics,deep learning,medicine,radiology,radiomics,CT,DICOM,NIfTI,TCIA,medical imaging
36
+ Classifier: Environment :: Console
37
+ Classifier: Framework :: Jupyter
38
+ Classifier: Intended Audience :: Science/Research
39
+ Classifier: License :: OSI Approved :: BSD License
40
+ Classifier: Operating System :: OS Independent
41
+ Classifier: Programming Language :: Python :: 3.10
42
+ Classifier: Programming Language :: Python :: 3.11
43
+ Classifier: Programming Language :: Python :: 3.12
44
+ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
45
+ Classifier: Topic :: Scientific/Engineering :: Bio-Informatics
46
+ Classifier: Topic :: Scientific/Engineering :: Image Processing
47
+ Classifier: Topic :: Scientific/Engineering :: Medical Science Apps.
48
+ Classifier: Topic :: Utilities
49
+ Requires-Python: >=3.10
50
+ Description-Content-Type: text/markdown
51
+ License-File: LICENSE
52
+ Requires-Dist: numpy
53
+ Requires-Dist: pandas
54
+ Requires-Dist: matplotlib
55
+ Requires-Dist: tqdm
56
+ Requires-Dist: requests
57
+ Requires-Dist: pydicom
58
+ Requires-Dist: highdicom
59
+ Requires-Dist: nibabel
60
+ Requires-Dist: scipy
61
+ Requires-Dist: simpleitk
62
+ Requires-Dist: pyyaml
63
+ Requires-Dist: openpyxl
64
+ Requires-Dist: pydantic>=2
65
+ Provides-Extra: segmentation
66
+ Requires-Dist: TotalSegmentator; extra == "segmentation"
67
+ Provides-Extra: radiomics
68
+ Requires-Dist: pyradiomics; extra == "radiomics"
69
+ Provides-Extra: notebook
70
+ Requires-Dist: ipython; extra == "notebook"
71
+ Requires-Dist: ipykernel; extra == "notebook"
72
+ Requires-Dist: ipywidgets; extra == "notebook"
73
+ Provides-Extra: dicom
74
+ Requires-Dist: dcm2niix; extra == "dicom"
75
+ Provides-Extra: test
76
+ Requires-Dist: pytest; extra == "test"
77
+ Provides-Extra: all
78
+ Requires-Dist: TotalSegmentator; extra == "all"
79
+ Requires-Dist: pyradiomics; extra == "all"
80
+ Requires-Dist: ipython; extra == "all"
81
+ Requires-Dist: ipykernel; extra == "all"
82
+ Requires-Dist: ipywidgets; extra == "all"
83
+ Requires-Dist: dcm2niix; extra == "all"
84
+ Dynamic: license-file
85
+
86
+ # ctkit
87
+
88
+ CT image processing for AI and radiomics. Makes CT processing simple and reproducible.
89
+
90
+ ![pipeline](https://github.com/pachterlab/ctkit/blob/main/figures/Fig1.png?raw=true)
91
+
92
+ ## Installation
93
+
94
+ ```sh
95
+ pip install ctkit
96
+ ```
97
+
98
+ To install pyradiomics and TotalSegmentator:
99
+
100
+ ```sh
101
+ pip install 'ctkit[all]'
102
+ ```
103
+
104
+ ## Quick start
105
+
106
+ ```python
107
+ import ctkit
108
+
109
+ ctkit.download("tcga-kirc", "data/tcga_kirc_raw", limit=20)
110
+
111
+ data = ctkit.Dataset("data/tcga_kirc_raw")
112
+ data.filter(min_slices=25).process("tcga-kirc", out_dir="data/processed")
113
+ # the tcga-kirc protocol segments the kidneys, so this one needs ctkit[all]
114
+ ```
115
+
116
+ ## The pipeline
117
+
118
+ | Step | What it does | Why it matters |
119
+ | --- | --- | --- |
120
+ | `filter` | Drop series that fail quality control, keeping a pass/fail table | Localizers, reformats and 4D series are not the acquisition you meant to analyze, and finding that out after processing wastes the expensive part |
121
+ | `check` | Run the same quality control without dropping anything: a result for one series, the whole table for a cohort | The measurements behind every pass and fail, which is what an exclusion criterion has to cite |
122
+ | `orient` | Reorient to canonical RAS | Archives disagree on storage order, so two scans of the same anatomy can arrive mirrored or transposed |
123
+ | `segment` | TotalSegmentator organ masks, merged with any tumor mask | Gives a region of interest when the collection ships without one |
124
+ | `clip` | Clamp to an intensity window (e.g. −200/300 HU) | Spends the dynamic range on the tissue you care about; caps metal artifacts |
125
+ | `resample` | Resample to a fixed voxel size in mm | Until scans share a voxel grid, a millimeter of anatomy is a different number of voxels in each one |
126
+ | `select_slice` | Keep one axial slice: the one with the most mask, or the one you name (2D mode) | How a 3D series becomes a 2D training example |
127
+ | `apply_mask` | Blank outside the ROI, crop to its bounding box | Removes irrelevant anatomy and makes volumes small enough to hold a cohort in memory |
128
+ | `crop_to_content` | Crop to the voxels above a threshold — air, once intensities are clipped | Trims the air around the body when there is no mask to crop to |
129
+ | `standardize_size` | Center-crop/pad to a common array shape | Fixed-size tensors, without rescaling the anatomy |
130
+ | `normalize` | Z-score, per volume or per dataset | Stops a model keying on per-scan intensity offsets |
131
+ | `save` | Write the processed series to disk | Makes the processed dataset available for training and sharing |
132
+ | `process` | Run the whole pipeline, with a saved configuration | Reproducibility and collaboration |
133
+ | `radiomics` | Extract radiomics features | For radiomic analysis. Does not require many steps above. |
134
+
135
+ ## Reproducibility
136
+
137
+ Every run that writes a cohort to disk writes `processing_config.yaml` next to
138
+ it. To reproduce a dataset, or to hand one to a collaborator:
139
+
140
+ ```python
141
+ ctkit.Dataset("data/raw").process(
142
+ "data/processed/processing_config.yaml", out_dir="rerun"
143
+ )
144
+ ```
145
+
146
+ `process` takes a protocol as a `ProcessingConfig`, a path to a saved one, or
147
+ the name of a collection whose curated protocol to use.
148
+
149
+ ## Notebooks
150
+
151
+ [`notebooks/quickstart.ipynb`](notebooks/quickstart.ipynb) walks through the
152
+ package end to end: pick a collection, download it, filter it, process it, and
153
+ extract features.
154
+
155
+ ## Relationship to tcia-radiology-processing
156
+
157
+ This package grew out of the protocol in
158
+ [pachterlab/tcia-radiology-processing](https://github.com/pachterlab/tcia-radiology-processing),
159
+ which documents the same pipeline as a step-by-step notebook. That repository
160
+ remains the written protocol; `ctkit` is the library implementation of it.
161
+
162
+ ## License
163
+
164
+ BSD 2-Clause. See [LICENSE](LICENSE).
165
+
166
+ ---
167
+
168
+ Issues and pull requests welcome.
@@ -0,0 +1,22 @@
1
+ ctkit/__init__.py,sha256=SxGvD7HOkN4ymiUYUfPK5b_8l_F42VbziRDsnlHAD6Y,4074
2
+ ctkit/api.py,sha256=N-AeGmjHdvRbZQWTnUyKh156cYev9iN0PHBTVMAJABc,11558
3
+ ctkit/cli.py,sha256=XxiIC677Y9xeY894My6bdz9V1h-bB4lbmQ3kYYxSE2E,28028
4
+ ctkit/config.py,sha256=_wfUWI3F_LE9u0OenSLOi8ffIHfHNkeDcfqEWYXk2FA,18202
5
+ ctkit/constants.py,sha256=WlAAA2mC6z5-3y34H377L0hBBE5qxx-xyoC33hx1qZ4,15715
6
+ ctkit/dataset.py,sha256=rgqfLQK5G7xk8R0hn7tXKhgZVEqLchknt0A1-a8If9s,55746
7
+ ctkit/datasets.py,sha256=ooTavA9MUVDsAvX2Ndbft6eAf99eEAGXviRkdI5FjvU,8396
8
+ ctkit/features.py,sha256=ZS9Jzj8rZBfDcomQM1WrZQtgu6G1qY8Ikcuuzsai1Xc,5963
9
+ ctkit/image.py,sha256=zWDO42CkVReJZmzkAzu5kfYktw-rz6-6FkUHLpn0wuA,43653
10
+ ctkit/io.py,sha256=e-gMAsBtt5fYwoekifSj1kRBa9aGga-vg3ifxYjpL1w,14142
11
+ ctkit/metadata.py,sha256=FZgZ3FiawomgKwOeNYTSDlpja4k07zfAFh9pz5RUMPk,8779
12
+ ctkit/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
13
+ ctkit/qc.py,sha256=2AJBJp3od2VbUMXnzAVzROGSQ1X3Ek1D86QqrX4_zGo,17546
14
+ ctkit/segmentation.py,sha256=tTIInqOxtPs_7jNkGxIkgWF8QmAiIWpim2faQe01z14,13096
15
+ ctkit/tcia.py,sha256=dwDlqPat0trC8uXBjm-GpsZ85FLaTlTZPVmZ9qXO8-o,15181
16
+ ctkit/validation.py,sha256=zU2eZolpBMfIfgLYrJTP1d6_HZiEa5eH8u7MFwIC9Jw,6829
17
+ ctkit-0.1.0.dist-info/licenses/LICENSE,sha256=asgwE92hmJCtq-JwreF0G-rfgLe1I7uti3Zh2ubgK70,1300
18
+ ctkit-0.1.0.dist-info/METADATA,sha256=K9Uny9ViKGuXTMHi_Te9v1YNbTDMt6iTl429eelstTw,7579
19
+ ctkit-0.1.0.dist-info/WHEEL,sha256=YVMoNqKzERt-wjUZwJ33xBGAwnFl-4cqbYkTtWa4itE,91
20
+ ctkit-0.1.0.dist-info/entry_points.txt,sha256=UVzgsBmv-vf7mTr7IrW41-gD8cXsTcz-G0jMwd_LEZo,41
21
+ ctkit-0.1.0.dist-info/top_level.txt,sha256=zfWCDtGXvJuEZAnraxqPhXGsd9XNC5MSp_CDlwst8l0,6
22
+ ctkit-0.1.0.dist-info/RECORD,,
@@ -0,0 +1,5 @@
1
+ Wheel-Version: 1.0
2
+ Generator: setuptools (84.0.0)
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
5
+
@@ -0,0 +1,2 @@
1
+ [console_scripts]
2
+ ctkit = ctkit.cli:main
@@ -0,0 +1,24 @@
1
+ BSD 2-Clause License
2
+
3
+ Copyright (c) 2026, Pachter Lab
4
+
5
+ Redistribution and use in source and binary forms, with or without
6
+ modification, are permitted provided that the following conditions are met:
7
+
8
+ 1. Redistributions of source code must retain the above copyright notice, this
9
+ list of conditions and the following disclaimer.
10
+
11
+ 2. Redistributions in binary form must reproduce the above copyright notice,
12
+ this list of conditions and the following disclaimer in the documentation
13
+ and/or other materials provided with the distribution.
14
+
15
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
16
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
18
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
19
+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
21
+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
22
+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
23
+ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
24
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
@@ -0,0 +1 @@
1
+ ctkit