kanydao commited on
Commit
4fb0165
·
verified ·
1 Parent(s): ed3c5ec

Resume hlip backup excluding two local secret files

Browse files
This view is limited to 50 files because it contains too many changes.   See raw diff
Files changed (50) hide show
  1. .gitattributes +9 -0
  2. hlip/data/ct_rate/valid/valid_997/valid_997_a/valid_997_a_2.pt +3 -0
  3. hlip/data/ct_rate/valid/valid_998/valid_998_a/valid_998_a_1.pt +3 -0
  4. hlip/data/ct_rate/valid/valid_998/valid_998_a/valid_998_a_2.pt +3 -0
  5. hlip/data/ct_rate/valid/valid_999/valid_999_a/valid_999_a_1.pt +3 -0
  6. hlip/data/ct_rate/valid/valid_999/valid_999_a/valid_999_a_2.pt +3 -0
  7. hlip/hlip/.gitignore +154 -0
  8. hlip/hlip/LICENSE +21 -0
  9. hlip/hlip/README.md +163 -0
  10. hlip/hlip/data/README.md +138 -0
  11. hlip/hlip/data/ct_rate/annotation.ipynb +149 -0
  12. hlip/hlip/data/ct_rate/download_train.py +50 -0
  13. hlip/hlip/data/ct_rate/files/qwen_organ_annotation.json +3 -0
  14. hlip/hlip/data/ct_rate/files/raw_annotation.json +3 -0
  15. hlip/hlip/data/ct_rate/files/raw_annotation_old.json +3 -0
  16. hlip/hlip/data/ct_rate/files/remove_raw_annotation_fail.py +69 -0
  17. hlip/hlip/data/ct_rate/files/remove_train_info_fail.py +43 -0
  18. hlip/hlip/data/ct_rate/files/train_info_0_50000.json +0 -0
  19. hlip/hlip/data/ct_rate/files/train_info_0_50000_old.json +0 -0
  20. hlip/hlip/data/ct_rate/files/valid_info_0_50000.json +0 -0
  21. hlip/hlip/data/ct_rate/metafiles/conc_info.json +3 -0
  22. hlip/hlip/data/ct_rate/metafiles/desc_info.json +3 -0
  23. hlip/hlip/data/ct_rate/metafiles/train_labels.csv +0 -0
  24. hlip/hlip/data/ct_rate/metafiles/train_metadata.csv +3 -0
  25. hlip/hlip/data/ct_rate/metafiles/train_reports.csv +3 -0
  26. hlip/hlip/data/ct_rate/metafiles/valid_labels.csv +0 -0
  27. hlip/hlip/data/ct_rate/metafiles/valid_metadata.csv +0 -0
  28. hlip/hlip/data/ct_rate/metafiles/valid_reports.csv +0 -0
  29. hlip/hlip/data/ct_rate/process.py +98 -0
  30. hlip/hlip/data/ct_rate/process.sh +3 -0
  31. hlip/hlip/data/pub_brain_5/brats23/download.py +9 -0
  32. hlip/hlip/data/pub_brain_5/brats23/process.py +131 -0
  33. hlip/hlip/data/pub_brain_5/brats23/unzip.py +34 -0
  34. hlip/hlip/data/pub_brain_5/ground_truth.csv +0 -0
  35. hlip/hlip/data/pub_brain_5/nyu_mets/process.log +0 -0
  36. hlip/hlip/data/pub_brain_5/nyu_mets/process.py +154 -0
  37. hlip/hlip/data/pub_brain_5/open_bhb/process.log +0 -0
  38. hlip/hlip/data/pub_brain_5/open_bhb/process.py +145 -0
  39. hlip/hlip/data/pub_brain_5/pub_brain_5.csv +0 -0
  40. hlip/hlip/data/pub_brain_5/pub_brain_5_gt.csv +0 -0
  41. hlip/hlip/data/pub_brain_5/stroke/process.log +0 -0
  42. hlip/hlip/data/pub_brain_5/stroke/process.py +223 -0
  43. hlip/hlip/data/pub_brain_5/ucsf_mets/process.log +0 -0
  44. hlip/hlip/data/pub_brain_5/ucsf_mets/process.py +145 -0
  45. hlip/hlip/data/rad_chestct/download.py +22 -0
  46. hlip/hlip/data/rad_chestct/files/imgtest.csv +0 -0
  47. hlip/hlip/data/rad_chestct/files/imgtest_16.csv +361 -0
  48. hlip/hlip/data/rad_chestct/files/imgtrain.csv +0 -0
  49. hlip/hlip/data/rad_chestct/files/imgtrain_16.csv +0 -0
  50. hlip/hlip/data/rad_chestct/files/imgvalid.csv +0 -0
.gitattributes CHANGED
@@ -58,3 +58,12 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
58
  # Video files - compressed
59
  *.mp4 filter=lfs diff=lfs merge=lfs -text
60
  *.webm filter=lfs diff=lfs merge=lfs -text
 
 
 
 
 
 
 
 
 
 
58
  # Video files - compressed
59
  *.mp4 filter=lfs diff=lfs merge=lfs -text
60
  *.webm filter=lfs diff=lfs merge=lfs -text
61
+ hlip/hlip/data/ct_rate/files/qwen_organ_annotation.json filter=lfs diff=lfs merge=lfs -text
62
+ hlip/hlip/data/ct_rate/files/raw_annotation.json filter=lfs diff=lfs merge=lfs -text
63
+ hlip/hlip/data/ct_rate/files/raw_annotation_old.json filter=lfs diff=lfs merge=lfs -text
64
+ hlip/hlip/data/ct_rate/metafiles/conc_info.json filter=lfs diff=lfs merge=lfs -text
65
+ hlip/hlip/data/ct_rate/metafiles/desc_info.json filter=lfs diff=lfs merge=lfs -text
66
+ hlip/hlip/data/ct_rate/metafiles/train_metadata.csv filter=lfs diff=lfs merge=lfs -text
67
+ hlip/hlip/data/ct_rate/metafiles/train_reports.csv filter=lfs diff=lfs merge=lfs -text
68
+ hlip/hlip/data/rad_chestct/metafiles/imgtrain_Abnormality_and_Location_Labels.csv filter=lfs diff=lfs merge=lfs -text
69
+ hlip/hlip/data/rad_chestct/metafiles/imgvalid_Abnormality_and_Location_Labels.csv filter=lfs diff=lfs merge=lfs -text
hlip/data/ct_rate/valid/valid_997/valid_997_a/valid_997_a_2.pt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:5696cec1806999ae1834d9fe8316b5e921e5d16a0d62c7e63b5ef1d383212e84
3
+ size 56351162
hlip/data/ct_rate/valid/valid_998/valid_998_a/valid_998_a_1.pt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:8963c153409e2915201f664811e2071f2e81ceeb96fe93f97c94f3bb2242a24b
3
+ size 64126202
hlip/data/ct_rate/valid/valid_998/valid_998_a/valid_998_a_2.pt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:d547f7c77a7dcbe993a2be899b7ca4326e644e1a0f4e9238b4662c7428fae0c6
3
+ size 64126202
hlip/data/ct_rate/valid/valid_999/valid_999_a/valid_999_a_1.pt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:e998052b5e97eab501db15707fe6a57efc1780570133d5dc4f8120b055e20888
3
+ size 56351162
hlip/data/ct_rate/valid/valid_999/valid_999_a/valid_999_a_2.pt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:792404a3dc7e32a17a78bff8cf5801a257177122434a9da9bbc2457ec523ac7f
3
+ size 56351162
hlip/hlip/.gitignore ADDED
@@ -0,0 +1,154 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Byte-compiled / optimized / DLL files
2
+ __pycache__/
3
+ *.py[cod]
4
+ *$py.class
5
+
6
+ # C extensions
7
+ *.so
8
+
9
+ # Distribution / packaging
10
+ .Python
11
+ build/
12
+ develop-eggs/
13
+ dist/
14
+ downloads/
15
+ eggs/
16
+ .eggs/
17
+ lib/
18
+ lib64/
19
+ parts/
20
+ sdist/
21
+ var/
22
+ wheels/
23
+ pip-wheel-metadata/
24
+ share/python-wheels/
25
+ *.egg-info/
26
+ .installed.cfg
27
+ *.egg
28
+ MANIFEST
29
+
30
+ # PyInstaller
31
+ # Usually these files are written by a python script from a template
32
+ # before PyInstaller builds the exe, so as to inject date/other infos into it.
33
+ *.manifest
34
+ *.spec
35
+
36
+ # Installer logs
37
+ pip-log.txt
38
+ pip-delete-this-directory.txt
39
+
40
+ # Unit test / coverage reports
41
+ htmlcov/
42
+ .tox/
43
+ .nox/
44
+ .coverage
45
+ .coverage.*
46
+ .cache
47
+ nosetests.xml
48
+ coverage.xml
49
+ *.cover
50
+ *.py,cover
51
+ .hypothesis/
52
+ .pytest_cache/
53
+
54
+ # Translations
55
+ *.mo
56
+ *.pot
57
+
58
+ # Django stuff:
59
+ *.log
60
+ !process.log
61
+ local_settings.py
62
+ db.sqlite3
63
+ db.sqlite3-journal
64
+
65
+ # Flask stuff:
66
+ instance/
67
+ .webassets-cache
68
+
69
+ # Scrapy stuff:
70
+ .scrapy
71
+
72
+ # Sphinx documentation
73
+ docs/_build/
74
+
75
+ # PyBuilder
76
+ target/
77
+
78
+ # Jupyter Notebook
79
+ .ipynb_checkpoints
80
+
81
+ # IPython
82
+ profile_default/
83
+ ipython_config.py
84
+
85
+ # pyenv
86
+ .python-version
87
+
88
+ # pipenv
89
+ # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
90
+ # However, in case of collaboration, if having platform-specific dependencies or dependencies
91
+ # having no cross-platform support, pipenv may install dependencies that don't work, or not
92
+ # install all needed dependencies.
93
+ #Pipfile.lock
94
+
95
+ # PEP 582; used by e.g. github.com/David-OConnor/pyflow
96
+ __pypackages__/
97
+
98
+ # Celery stuff
99
+ celerybeat-schedule
100
+ celerybeat.pid
101
+
102
+ # SageMath parsed files
103
+ *.sage.py
104
+
105
+ # Environments
106
+ .env
107
+ .venv
108
+ env/
109
+ venv/
110
+ ENV/
111
+ env.bak/
112
+ venv.bak/
113
+
114
+ # Spyder project settings
115
+ .spyderproject
116
+ .spyproject
117
+
118
+ # Rope project settings
119
+ .ropeproject
120
+
121
+ # mkdocs documentation
122
+ /site
123
+
124
+ # mypy
125
+ .mypy_cache/
126
+ .dmypy.json
127
+ dmypy.json
128
+
129
+ # Pyre type checker
130
+ .pyre/
131
+ sync.sh
132
+ gpu1sync.sh
133
+ .idea
134
+ *.pdf
135
+ **/._*
136
+ **/*DS_*
137
+ **.jsonl
138
+ src/sbatch
139
+ src/misc
140
+ .vscode
141
+ src/debug
142
+ core.*
143
+
144
+ # Allow
145
+ !src/evaluation/misc/results_dbs/*
146
+
147
+ # custom
148
+ results/
149
+ wandb/
150
+ logs/
151
+ hf_staging/
152
+ COMMAND.md
153
+ ct.csv
154
+ mri.csv
hlip/hlip/LICENSE ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Zach
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
hlip/hlip/README.md ADDED
@@ -0,0 +1,163 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # HLIP
2
+ > Official PyTorch implementation of the following paper:\
3
+ > Towards Scalable Language-Image Pre-training for 3D Medical Imaging\
4
+ > University of Michigan\
5
+ > [![arXiv](https://img.shields.io/badge/arXiv%20paper-2505.21862-b31b1b.svg)](https://arxiv.org/abs/2505.21862) 
6
+
7
+
8
+ ## Overview
9
+ <p align="center">
10
+ <img
11
+ src="docs/github.png"
12
+ alt="HLIP overview"
13
+ style="width:96%; max-width:800px; height:auto;"
14
+ />
15
+ </p>
16
+
17
+ Directly leveraging uncurated clinical studies enables scalable language-image pre-training in 3D medical imaging, as the scale is no longer constrained by the manual effort required from clinicians to select a single representative scan or slice from each study. This paradigm could be more effective when equipped with a hierarchical attention mechanism inspired by the natural structure of the data: slice, scan, and study. We name this framework **H**ierarchical attention for **L**anguage-**I**mage **P**re-training (**HLIP**). For real-world clinical use, HLIP can be applied to studies containing either a single scan (e.g., chest CT) or multiple scans (e.g., brain MRI).
18
+
19
+ ## Updates
20
+ - **(2025-11)** We release our updated model [![huggingface weights](https://img.shields.io/badge/%F0%9F%A4%97%20Weights-yellow)](https://huggingface.co/Zch0414/hlip-2025-10-08), along with a new [code branch](https://github.com/Zch0414/hlip/tree/hlip-ablation) focused on uncurated 3D medical datasets. The technical details are described in this [blog](https://zch0414.github.io/hlip-ablation/).
21
+ - **(2025-06)** Complete the initiation of HLIP repository.
22
+ - **(2025-05)** Release HLIP models trained on chest CT and brain MRI, feel free to try our demos.
23
+
24
+ ## Getting Started
25
+
26
+ ### Install
27
+ [open-clip](https://github.com/mlfoundations/open_clip/tree/main)
28
+ ```bash
29
+ python3 -m venv env
30
+ source env/bin/activate
31
+ pip install -U pip
32
+ pip install torch==2.5.1 torchvision==0.20.1 torchaudio==2.5.1 --index-url https://download.pytorch.org/whl/cu121
33
+ git clone git@github.com:mlfoundations/open_clip.git
34
+ cd open_clip
35
+ make install
36
+ make install-training
37
+ ```
38
+
39
+ ### Model Card
40
+ | Data | Objective | Patch Size | Attention | Model | Performance |
41
+ | :--------: | :--------: | :--------: | :--------: | :--------: | :--------: |
42
+ | CT-RATE (20K) | SigLIP | <code>8, 24, 24</code> | <code>slice</code> + <code>scan</code> | ViT Base | -/- |
43
+ | CT-RATE (20K) | CLIP | <code>8, 24, 24</code> | <code>slice</code> + <code>scan</code> | [ViT Base](https://drive.google.com/file/d/1muu7L9H3KaL3nq3fNtN8kKF1eDK3R5Z4/view?usp=drive_link) | -/- |
44
+ | BrainMRI (220K) | CLIP | <code>16, 16, 16</code> | <code>scan</code> + <code>study</code> | [ViT Base](https://drive.google.com/file/d/1uUdcE0TYx3K2YU7FQMfwb2FsFQjQcGil/view?usp=drive_link) | -/- |
45
+ | BrainMRI (220K) | CLIP | <code>8, 16, 16</code> |<code>scan</code> + <code>study</code> | [ViT Base](https://drive.google.com/file/d/12BwJvd6IEZynXM8jkled0ND7t11iuySj/view?usp=drive_link) | -/- |
46
+ | BrainMRI (220K) | CLIP | <code>8, 16, 16</code> | <code>slice</code> + <code>scan</code> + <code>study</code> | [ViT Base](https://drive.google.com/file/d/1FgOS3W6LhnhH4gJlbASPopUEXChcjeqy/view?usp=drive_link) | -/- |
47
+ | HeadCT (240K) | CLIP | <code>8, 16, 16</code> | <code>scan</code> + <code>study</code> | [ViT Base](https://drive.google.com/file/d/1rfoz-kzF0iwaMQ-4MuR7F4NlTjtPIZa7/view?usp=drive_link) | -/- |
48
+
49
+ ### Demo
50
+ Chest CT: an example from the external Rad-ChestCT dataset.
51
+ ```bash
52
+ python inference_rad_chestct.py \
53
+ --model clip_vit_base_singlescan_h2_token1176 \
54
+ --use-cxr-bert \
55
+ --resume /path/to/chestct_clip_vit_base_singlescan_h2_token1176.pt \
56
+ --data ../../docs/tst32751/tst32751.pt
57
+ ```
58
+
59
+ Brain MRI: an example from the external BraTS23 dataset.
60
+ ```bash
61
+ python inference_pub_brain_5.py \
62
+ --model clip_vit_base_multiscan_h2_token1176 \
63
+ --resume /path/to/brainmri_clip_vit_base_multiscan_h2_token1176.pt \
64
+ --patch-size 8 16 16 \
65
+ --num-slices 72 \
66
+ --data ../../docs/BraTS-GLI-00459-000
67
+ ```
68
+ Visualizing the activation with <code>--interpret</code>.
69
+
70
+ ### Evaluation
71
+ CT-RATE
72
+ ```bash
73
+ python zeroshot_ct_rate.py \
74
+ --model clip_vit_base_singlescan_h2_token2744 \
75
+ --use-cxr-bert \
76
+ --resume /path/to/chestct_clip_vit_base_singlescan_h2_token2744.pt \
77
+ --data-root /data/ct_rate/ \
78
+ --zeroshot-template volume
79
+ ```
80
+
81
+ Rad-ChestCT
82
+ ```bash
83
+ python zeroshot_rad_chestct.py \
84
+ --model clip_vit_base_singlescan_h2_token2744 \
85
+ --use-cxr-bert \
86
+ --resume /path/to/chestct_clip_vit_base_singlescan_h2_token2744.pt \
87
+ --data-root /data/rad_chestct/ \
88
+ --zeroshot-template volume
89
+ ```
90
+
91
+ Brain MRI
92
+ ```bash
93
+ python pub_brain_5_embed.py \
94
+ --model clip_vit_base_multiscan_h2_token1176 \
95
+ --resume /path/to/brainmri_clip_vit_base_multiscan_h2_token1176.pt \
96
+ --data-root /path/to/pub_brain_5
97
+ --num-slices 144 \
98
+ --embed-root /path/to/pub_brain_5_embed
99
+ ```
100
+ ```bash
101
+ python zeroshot_pub_brain_5.py \
102
+ --model clip_vit_base_multiscan_h2_token1176 \
103
+ --resume /path/to/brainmri_clip_vit_base_multiscan_h2_token1176.pt \
104
+ --embed-root /path/to/pub_brain_5_embed \
105
+ --num-slices 144 \
106
+ --zeroshot_prompt prompt \
107
+ --zeroshot_template template
108
+ ```
109
+ As there are ~18K studies in the Pub-Brain-5 dataset, evaluation may take ~30 minutes. We first extract the embedding for each study, followed by zero-shot classification. This procedure supports researchers interested in prompt engineering.
110
+
111
+ <code>--num-slices</code> is set to 144 during evaluation, though we use a fixed input size of <code>48, 224, 224</code>. We found that HLIP can directly transfer and benefit from higher-resolution inputs at test time.
112
+
113
+ ### Training
114
+
115
+ Our training implementation is closely aligned with [open-clip](https://github.com/mlfoundations/open_clip/tree/main), allowing us to leverage features such as <code>patch dropout</code> and <code>siglip</code>. Below, we provide a training code demo for chest CT. Training on CT-RATE for 20 epochs takes ~6 hours using a node with 4 A40 GPUs.
116
+
117
+ ```bash
118
+ torchrun --rdzv_endpoint=localhost:29500 --nproc_per_node 4 main.py \
119
+ --logs_dir /path/to/logs/ \
120
+ --json-root ../../data/ct_rate/files/ --data-root /path/to/data/ct_rate/ \
121
+ --train-data raw_annotation --input-info -1150 350 crop \
122
+ --zeroshot-ct-rate ../../data/ct_rate/metafiles/valid_labels.csv --zeroshot-template volume \
123
+ --zeroshot-frequency 1 \
124
+ --save-frequency 1 \
125
+ --report-to wandb \
126
+ --wandb-project-name chest_ct \
127
+ --warmup 377 \
128
+ --batch-size 16 \
129
+ --accum-batch 1 \
130
+ --lr=1e-5 \
131
+ --wd=0.2 \
132
+ --epochs=20 \
133
+ --precision amp \
134
+ --workers 4 \
135
+ --grad-checkpointing \
136
+ --model clip_vit_base_singlescan_h2_token2744 \
137
+ --use-cxr-bert \
138
+ --lock-text
139
+ ```
140
+
141
+ Use the following commands for <code>patch dropout</code>:
142
+ ```bash
143
+ --force-patch-dropout 0.5 \
144
+ --beta2 0.95
145
+ ```
146
+
147
+ Use the following commands for <code>siglip</code>:
148
+ ```bash
149
+ --model siglip_vit_base_singlescan_h2_token2744 \
150
+ --beta2 0.95 \
151
+ --siglip
152
+ ```
153
+
154
+ ## Citation
155
+ If you find this repository helpful, please consider citing:
156
+ ```bib
157
+ @article{zhao2025towards,
158
+ title={Towards Scalable Language-Image Pre-training for 3D Medical Imaging},
159
+ author={Zhao, Chenhui and Lyu, Yiwei and Chowdury, Asadur and Harake, Edward and Kondepudi, Akhil and Rao, Akshay and Hou, Xinhai and Lee, Honglak and Hollon, Todd},
160
+ journal={arXiv preprint arXiv:2505.21862},
161
+ year={2025}
162
+ }
163
+ ```
hlip/hlip/data/README.md ADDED
@@ -0,0 +1,138 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ## CT-RATE
2
+
3
+ Downloading the CT-RATE dataset with:
4
+ ```bash
5
+ python download_valid.py
6
+ python download_train.py
7
+ ```
8
+ Downloading the training split may take ~2 days. Once complete, process the dataset with:
9
+ ```bash
10
+ python process.py --num-cpus 8 --data 'valid' --root-dir '/download/ct_rate/dataset/' --save-dir '/data/ct_rate/'
11
+ python process.py --num-cpus 8 --data 'train' --root-dir '/download/ct_rate/dataset/' --save-dir '/data/ct_rate/'
12
+ ```
13
+ Based on our analysis, data type and spacing should not be critical concerns. One may consider the following commands to reduce the dataset size:
14
+ <code>--save-astype</code> and <code>--spacing</code>.
15
+
16
+ All necessary files have already been provided, some of which are provided by [fVLM](https://github.com/alibaba-damo-academy/fvlm).
17
+ There is no need to run the other code; it is included solely as a reference to illustrate how the files were generated.
18
+
19
+ **reference:**
20
+ ```bib
21
+ @misc{hamamci2024foundation,
22
+ title={Developing Generalist Foundation Models from a Multimodal Dataset for 3D Computed Tomography},
23
+ author={Ibrahim Ethem Hamamci and Sezgin Er and Furkan Almas and Ayse Gulnihan Simsek and Sevval Nil Esirgun and Irem Dogan and Muhammed Furkan Dasdelen and Omer Faruk Durugol and Bastian Wittmann and Tamaz Amiranashvili and Enis Simsar and Mehmet Simsar and Emine Bensu Erdemir and Abdullah Alanbay and Anjany Sekuboyina and Berkan Lafci and Christian Bluethgen and Mehmet Kemal Ozdemir and Bjoern Menze},
24
+ year={2024},
25
+ eprint={2403.17834},
26
+ archivePrefix={arXiv},
27
+ primaryClass={cs.CV},
28
+ url={https://arxiv.org/abs/2403.17834},
29
+ }
30
+ ```
31
+
32
+ ## Rad-ChestCT
33
+
34
+ Downloading the Rad-ChestCT dataset with:
35
+ ```bash
36
+ python download.py
37
+ ```
38
+ Once complete, process the dataset with:
39
+ ```bash
40
+ python process.py --num-cpus 8 --root-dir '/download/rad_chestct/' --save-dir '/data/rad_chestct/'
41
+ ```
42
+ All necessary files have already been provided. There is no need to run the other code; it is included solely as a reference to illustrate how the files were generated.
43
+
44
+ **reference:**
45
+ ```bib
46
+ @article{draelos2021machine,
47
+ title={Machine-learning-based multiple abnormality prediction with large-scale chest computed tomography volumes},
48
+ author={Draelos, Rachel Lea and Dov, David and Mazurowski, Maciej A and Lo, Joseph Y and Henao, Ricardo and Rubin, Geoffrey D and Carin, Lawrence},
49
+ journal={Medical image analysis},
50
+ volume={67},
51
+ pages={101857},
52
+ year={2021},
53
+ publisher={Elsevier}
54
+ }
55
+ ```
56
+
57
+ ## Pub-Brain-5
58
+
59
+ We provide the <code>uid</code> of [Open-BHB](https://baobablab.github.io/bhb/dataset), [Stroke](https://www.icpsr.umich.edu/web/ICPSR/studies/38464), [BraTS23](https://www.synapse.org/Synapse:syn51156910/wiki/627000), [NYUMets](https://nyumets.org/docs/brainapi/), and [UCSFMets](https://imagingdatasets.ucsf.edu/dataset/1). All of these datasets are publicly available. Due to licensing restrictions, Pub-Brain-5 can only be reconstructed using the provided <code>uid</code>. Reference code and process logs are included for convenience.
60
+
61
+ **reference:**
62
+ ```bib
63
+ @article{dufumier2022openbhb,
64
+ title={Openbhb: a large-scale multi-site brain mri data-set for age prediction and debiasing},
65
+ author={Dufumier, Benoit and Grigis, Antoine and Victor, Julie and Ambroise, Corentin and Frouin, Vincent and Duchesnay, Edouard},
66
+ journal={NeuroImage},
67
+ volume={263},
68
+ pages={119637},
69
+ year={2022},
70
+ publisher={Elsevier}
71
+ }
72
+
73
+ @article{liu2023large,
74
+ title={A large public dataset of annotated clinical MRIs and metadata of patients with acute stroke},
75
+ author={Liu, Chin-Fu and Leigh, Richard and Johnson, Brenda and Urrutia, Victor and Hsu, Johnny and Xu, Xin and Li, Xin and Mori, Susumu and Hillis, Argye E and Faria, Andreia V},
76
+ journal={Scientific Data},
77
+ volume={10},
78
+ number={1},
79
+ pages={548},
80
+ year={2023},
81
+ publisher={Nature Publishing Group UK London}
82
+ }
83
+
84
+ @article{baid2021rsna,
85
+ title={The rsna-asnr-miccai brats 2021 benchmark on brain tumor segmentation and radiogenomic classification},
86
+ author={Baid, Ujjwal and Ghodasara, Satyam and Mohan, Suyash and Bilello, Michel and Calabrese, Evan and Colak, Errol and Farahani, Keyvan and Kalpathy-Cramer, Jayashree and Kitamura, Felipe C and Pati, Sarthak and others},
87
+ journal={arXiv preprint arXiv:2107.02314},
88
+ year={2021}
89
+ }
90
+
91
+ @misc{labella2023asnrmiccai,
92
+ title={The ASNR-MICCAI Brain Tumor Segmentation (BraTS) Challenge 2023: Intracranial Meningioma},
93
+ author={Dominic LaBella and Maruf Adewole and Michelle Alonso-Basanta and Talissa Altes and Syed Muhammad Anwar and Ujjwal Baid and Timothy Bergquist and Radhika Bhalerao and Sully Chen and Verena Chung and Gian-Marco Conte and Farouk Dako and James Eddy and Ivan Ezhov and Devon Godfrey and Fathi Hilal and Ariana Familiar and Keyvan Farahani and Juan Eugenio Iglesias and Zhifan Jiang and Elaine Johanson and Anahita Fathi Kazerooni and Collin Kent and John Kirkpatrick and Florian Kofler and Koen Van Leemput and Hongwei Bran Li and Xinyang Liu and Aria Mahtabfar and Shan McBurney-Lin and Ryan McLean and Zeke Meier and Ahmed W Moawad and John Mongan and Pierre Nedelec and Maxence Pajot and Marie Piraud and Arif Rashid and Zachary Reitman and Russell Takeshi Shinohara and Yury Velichko and Chunhao Wang and Pranav Warman and Walter Wiggins and Mariam Aboian and Jake Albrecht and Udunna Anazodo and Spyridon Bakas and Adam Flanders and Anastasia Janas and Goldey Khanna and Marius George Linguraru and Bjoern Menze and Ayman Nada and Andreas M Rauschecker and Jeff Rudie and Nourel Hoda Tahon and Javier Villanueva-Meyer and Benedikt Wiestler and Evan Calabrese},
94
+ year={2023},
95
+ eprint={2305.07642},
96
+ archivePrefix={arXiv},
97
+ primaryClass={cs.CV}
98
+ }
99
+
100
+ @article{moawad2024brain,
101
+ title={The Brain Tumor Segmentation-Metastases (BraTS-METS) Challenge 2023: Brain Metastasis Segmentation on Pre-treatment MRI},
102
+ author={Moawad, Ahmed W and Janas, Anastasia and Baid, Ujjwal and Ramakrishnan, Divya and Saluja, Rachit and Ashraf, Nader and Maleki, Nazanin and Jekel, Leon and Yordanov, Nikolay and Fehringer, Pascal and others},
103
+ journal={ArXiv},
104
+ pages={arXiv--2306},
105
+ year={2024}
106
+ }
107
+
108
+ @article{kazerooni2024brain,
109
+ title={The brain tumor segmentation (BraTS) challenge 2023: focus on pediatrics (CBTN-CONNECT-DIPGR-ASNR-MICCAI BraTS-PEDs)},
110
+ author={Kazerooni, Anahita Fathi and Khalili, Nastaran and Liu, Xinyang and Haldar, Debanjan and Jiang, Zhifan and Anwar, Syed Muhammed and Albrecht, Jake and Adewole, Maruf and Anazodo, Udunna and Anderson, Hannah and others},
111
+ journal={ArXiv},
112
+ pages={arXiv--2305},
113
+ year={2024}
114
+ }
115
+
116
+ @article{link2024longitudinal,
117
+ title={Longitudinal deep neural networks for assessing metastatic brain cancer on a large open benchmark},
118
+ author={Link, Katherine E and Schnurman, Zane and Liu, Chris and Kwon, Young Joon and Jiang, Lavender Yao and Nasir-Moin, Mustafa and Neifert, Sean and Alzate, Juan Diego and Bernstein, Kenneth and Qu, Tanxia and others},
119
+ journal={Nature Communications},
120
+ volume={15},
121
+ number={1},
122
+ pages={8170},
123
+ year={2024},
124
+ publisher={Nature Publishing Group UK London}
125
+ }
126
+
127
+ @article{rudie2024university,
128
+ title={The University of California San Francisco Brain Metastases Stereotactic Radiosurgery (UCSF-BMSR) MRI Dataset},
129
+ author={Rudie, Jeffrey D and Saluja, Rachit and Weiss, David A and Nedelec, Pierre and Calabrese, Evan and Colby, John B and Laguna, Benjamin and Mongan, John and Braunstein, Steve and Hess, Christopher P and others},
130
+ journal={Radiology: Artificial Intelligence},
131
+ volume={6},
132
+ number={2},
133
+ pages={e230126},
134
+ year={2024},
135
+ publisher={Radiological Society of North America}
136
+ }
137
+ ```
138
+
hlip/hlip/data/ct_rate/annotation.ipynb ADDED
@@ -0,0 +1,149 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "cells": [
3
+ {
4
+ "cell_type": "code",
5
+ "execution_count": 5,
6
+ "metadata": {},
7
+ "outputs": [],
8
+ "source": [
9
+ "import os\n",
10
+ "import json\n",
11
+ "import pandas as pd"
12
+ ]
13
+ },
14
+ {
15
+ "cell_type": "code",
16
+ "execution_count": null,
17
+ "metadata": {},
18
+ "outputs": [],
19
+ "source": [
20
+ "def qwen_organ_annotate(root_path='/download/ct_rate/dataset/train/'):\n",
21
+ " desc_info = json.load(open('./metafiles/desc_info.json'))\n",
22
+ " conc_info = json.load(open('./metafiles/conc_info.json'))\n",
23
+ " organs = ['lung', 'heart', 'esophagus', 'aorta']\n",
24
+ "\n",
25
+ " annotation = {}\n",
26
+ " patient_ids = sorted(os.listdir(root_path))\n",
27
+ "\n",
28
+ " for patient_id in patient_ids:\n",
29
+ " sessions = sorted(os.listdir(os.path.join(root_path, patient_id)))\n",
30
+ " \n",
31
+ " for session in sessions:\n",
32
+ " session_info = {}\n",
33
+ " recons = sorted(os.listdir(os.path.join(root_path, patient_id, session)))\n",
34
+ " session_info['recons'] = recons\n",
35
+ " report_list = []\n",
36
+ " \n",
37
+ " for organ in organs:\n",
38
+ " desc = ''\n",
39
+ " if organ in desc_info.get(session, {}):\n",
40
+ " desc += desc_info[session][organ]\n",
41
+ " if not desc.endswith('.'):\n",
42
+ " desc += '.'\n",
43
+ " if not desc:\n",
44
+ " desc = 'No significant abnormalities.'\n",
45
+ " \n",
46
+ " conc = ''\n",
47
+ " if organ in conc_info.get(session, {}):\n",
48
+ " conc += conc_info[session][organ]\n",
49
+ " if not conc.endswith('.'):\n",
50
+ " conc += '.'\n",
51
+ " if not conc:\n",
52
+ " conc = 'No significant abnormalities.'\n",
53
+ "\n",
54
+ " report = f'The {organ} shows: {conc} The {organ} looks like: {desc}'\n",
55
+ " report = report.replace('\"', '')\n",
56
+ " report = report.replace('\\'', '') \n",
57
+ " report = report.replace('(', '') \n",
58
+ " report = report.replace(')', '')\n",
59
+ "\n",
60
+ " report_list.append(report)\n",
61
+ "\n",
62
+ " session_info['report'] = report_list\n",
63
+ " annotation[session] = session_info\n",
64
+ " \n",
65
+ " os.makedirs('./files/', exist_ok=True)\n",
66
+ " with open(os.path.join('./files/', 'qwen_organ_annotation.json'), 'w') as file:\n",
67
+ " json.dump(annotation, file, indent=4)\n",
68
+ " return \n",
69
+ "\n",
70
+ "\n",
71
+ "def raw_annotate(csv_file='./metafiles/train_reports.csv'):\n",
72
+ " df = pd.read_csv(csv_file)\n",
73
+ " \n",
74
+ " annotation = {}\n",
75
+ " \n",
76
+ " for index, row in df.iterrows():\n",
77
+ " name = str(row['VolumeName'])\n",
78
+ " session = name.rsplit('_', 1)[0]\n",
79
+ " if session in annotation.keys():\n",
80
+ " annotation[session]['recons'].append(name)\n",
81
+ " else:\n",
82
+ " session_info = {}\n",
83
+ " session_info['recons'] = [name]\n",
84
+ " impression = str(row['Impressions_EN'])\n",
85
+ " if not impression.endswith('.'):\n",
86
+ " impression += '.'\n",
87
+ " findings = str(row['Findings_EN'])\n",
88
+ " if not findings.endswith('.'):\n",
89
+ " findings += '.'\n",
90
+ "\n",
91
+ " report = f'The volume shows: {impression} The volume looks like: {findings}'\n",
92
+ " report = report.replace('\"', '')\n",
93
+ " report = report.replace('\\'', '') \n",
94
+ " report = report.replace('(', '') \n",
95
+ " report = report.replace(')', '')\n",
96
+ " \n",
97
+ " report_list = [report]\n",
98
+ " session_info['report'] = report_list\n",
99
+ " annotation[session] = session_info\n",
100
+ " \n",
101
+ " os.makedirs('./files/', exist_ok=True)\n",
102
+ " with open(os.path.join('./files/', 'raw_annotation.json'), 'w') as file:\n",
103
+ " json.dump(annotation, file, indent=4)\n",
104
+ " \n",
105
+ " return\n",
106
+ " \n"
107
+ ]
108
+ },
109
+ {
110
+ "cell_type": "code",
111
+ "execution_count": 15,
112
+ "metadata": {},
113
+ "outputs": [],
114
+ "source": [
115
+ "qwen_organ_annotate()"
116
+ ]
117
+ },
118
+ {
119
+ "cell_type": "code",
120
+ "execution_count": 23,
121
+ "metadata": {},
122
+ "outputs": [],
123
+ "source": [
124
+ "raw_annotate()"
125
+ ]
126
+ }
127
+ ],
128
+ "metadata": {
129
+ "kernelspec": {
130
+ "display_name": "env",
131
+ "language": "python",
132
+ "name": "python3"
133
+ },
134
+ "language_info": {
135
+ "codemirror_mode": {
136
+ "name": "ipython",
137
+ "version": 3
138
+ },
139
+ "file_extension": ".py",
140
+ "mimetype": "text/x-python",
141
+ "name": "python",
142
+ "nbconvert_exporter": "python",
143
+ "pygments_lexer": "ipython3",
144
+ "version": "3.10.15"
145
+ }
146
+ },
147
+ "nbformat": 4,
148
+ "nbformat_minor": 4
149
+ }
hlip/hlip/data/ct_rate/download_train.py ADDED
@@ -0,0 +1,50 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import os
2
+ import time
3
+ import shutil
4
+ import pandas as pd
5
+ from tqdm import tqdm
6
+
7
+ from huggingface_hub import hf_hub_download
8
+
9
+
10
+ # huggingface
11
+ hf_token = '' # your token
12
+ repo_id = 'ibrahimhamamci/CT-RATE'
13
+ directory_name = 'dataset/train/'
14
+ # save directory
15
+ local_dir = '/download/ct_rate/'
16
+ os.makedirs(local_dir, exist_ok=True)
17
+ # resume
18
+ start_at = 0
19
+ batch_size = 100
20
+
21
+ data = pd.read_csv(f'./metafiles/train_labels.csv')
22
+ for i in tqdm(range(start_at, len(data), batch_size)):
23
+ data_batched = data[i:i+batch_size]
24
+
25
+ for name in data_batched['VolumeName']:
26
+ folder1 = name.split('_')[0]
27
+ folder2 = name.split('_')[1]
28
+ folder = folder1 + '_' + folder2
29
+ folder3 = name.split('_')[2]
30
+ subfolder = folder + '_' + folder3
31
+ subfolder = directory_name + folder + '/' + subfolder
32
+
33
+ for j in range(1000):
34
+ try:
35
+ hf_hub_download(repo_id=repo_id,
36
+ repo_type='dataset',
37
+ token=hf_token,
38
+ subfolder=subfolder,
39
+ filename=name,
40
+ local_dir=local_dir,
41
+ etag_timeout=60,
42
+ )
43
+ break
44
+ except Exception as e:
45
+ print(f"Attempt {j+1} failed: {e}\nCurrent batch: {i//100}.")
46
+ time.sleep(5)
47
+
48
+ shutil.rmtree(f'/download/ct_rate/.cache/huggingface/download/dataset/train/')
49
+
50
+
hlip/hlip/data/ct_rate/files/qwen_organ_annotation.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:50ea74c9f7800d369d1e7e75ed45cd13212e261d98376aafdc8113a2fe00ef89
3
+ size 30772726
hlip/hlip/data/ct_rate/files/raw_annotation.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:dfffdd2d3b5cba7d73e0026f4a010a5a69909583309bbb8af04205212338060a
3
+ size 12491578
hlip/hlip/data/ct_rate/files/raw_annotation_old.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:8e5829842dc6ba3b1dee38ceaac59465c03b4d6ec48f48b3fa22b03c20fd29bc
3
+ size 42685535
hlip/hlip/data/ct_rate/files/remove_raw_annotation_fail.py ADDED
@@ -0,0 +1,69 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import json
2
+ import os
3
+
4
+ # 定义文件路径
5
+ raw_annotation_path = "/mnt/cvlab/scratch/cvlab/home/hantzhan/code/hlip/hlip/data/ct_rate/files/raw_annotation_old.json"
6
+ train_info_path = "/mnt/cvlab/scratch/cvlab/home/hantzhan/code/hlip/hlip/data/ct_rate/files/train_info_0_50000_old.json"
7
+ output_path = "/mnt/cvlab/scratch/cvlab/home/hantzhan/code/hlip/hlip/data/ct_rate/files/raw_annotation.json"
8
+
9
+ def process_annotations():
10
+ print("正在加载 train_info 文件...")
11
+ with open(train_info_path, 'r', encoding='utf-8') as f:
12
+ train_info = json.load(f)
13
+
14
+ # 1. 创建一个包含所有 'fail' ID 的集合,用于快速查找
15
+ # 假设 train_info 的键是像 "train_8045_b_2" 这样不带后缀的字符串
16
+ failed_ids = set(k for k, v in train_info.items() if v == "fail")
17
+ print(f"共找到 {len(failed_ids)} 个标记为 fail 的 ID。")
18
+
19
+ print("正在加载 raw_annotation 文件...")
20
+ with open(raw_annotation_path, 'r', encoding='utf-8') as f:
21
+ raw_data = json.load(f)
22
+
23
+ cleaned_data = {}
24
+ removed_recon_count = 0 # 统计删除了多少个单独的 nii.gz 文件
25
+ removed_entry_count = 0 # 统计删除了多少个因为 recons 为空而被整条删除的 entry
26
+
27
+ print("正在处理数据...")
28
+
29
+ # 2. 遍历原始数据
30
+ for key, value in raw_data.items():
31
+ original_recons = value.get("recons", [])
32
+ clean_recons = []
33
+
34
+ # 3. 检查 recons 列表中的每一个文件
35
+ for recon_file in original_recons:
36
+ # 去掉 .nii.gz 后缀以匹配 train_info 中的键
37
+ # 例如: "train_4529_b_1.nii.gz" -> "train_4529_b_1"
38
+ file_id = recon_file.replace(".nii.gz", "")
39
+
40
+ # 同时也检查一下带后缀的情况,以防 train_info 里写的是全名,做一个双重保险
41
+ if file_id in failed_ids or recon_file in failed_ids:
42
+ removed_recon_count += 1
43
+ # 如果在 fail 列表中,则跳过(不添加到 clean_recons)
44
+ continue
45
+ else:
46
+ clean_recons.append(recon_file)
47
+
48
+ # 4. 决定是否保留该条目
49
+ if len(clean_recons) > 0:
50
+ # 如果还有剩余的 recon 文件,更新列表并保存
51
+ value["recons"] = clean_recons
52
+ cleaned_data[key] = value
53
+ else:
54
+ # 如果 recons 为空,则整条删除(不添加到 cleaned_data)
55
+ removed_entry_count += 1
56
+
57
+ # 5. 保存结果
58
+ print(f"处理完成。")
59
+ print(f" - 移除了 {removed_recon_count} 个具体的 recon 文件。")
60
+ print(f" - 移除了 {removed_entry_count} 个整条数据(因为 recons 变空)。")
61
+ print(f" - 剩余总数据条数: {len(cleaned_data)}")
62
+
63
+ with open(output_path, 'w', encoding='utf-8') as f:
64
+ json.dump(cleaned_data, f, indent=4, ensure_ascii=False)
65
+
66
+ print(f"新文件已保存至: {output_path}")
67
+
68
+ if __name__ == "__main__":
69
+ process_annotations()
hlip/hlip/data/ct_rate/files/remove_train_info_fail.py ADDED
@@ -0,0 +1,43 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import json
2
+ import os
3
+
4
+ # 定义文件路径
5
+ input_path = "/mnt/cvlab/scratch/cvlab/home/hantzhan/code/hlip/hlip/data/ct_rate/files/train_info_0_50000_old.json"
6
+ output_path = "/mnt/cvlab/scratch/cvlab/home/hantzhan/code/hlip/hlip/data/ct_rate/files/train_info_0_50000.json"
7
+
8
+ def clean_json():
9
+ print(f"正在读取文件: {input_path}")
10
+
11
+ try:
12
+ with open(input_path, 'r', encoding='utf-8') as f:
13
+ data = json.load(f)
14
+
15
+ # 记录原始数量
16
+ original_count = len(data)
17
+
18
+ # 使用字典推导式过滤掉值为 "fail" 的键值对
19
+ # 假设 JSON 结构是 {"key": "value", ...} 的扁平结构
20
+ new_data = {k: v for k, v in data.items() if v != "fail"}
21
+
22
+ # 记录新数量
23
+ new_count = len(new_data)
24
+ removed_count = original_count - new_count
25
+
26
+ print(f"原始条目数: {original_count}")
27
+ print(f"移除条目数: {removed_count}")
28
+ print(f"剩余条目数: {new_count}")
29
+
30
+ # 写入新文件
31
+ with open(output_path, 'w', encoding='utf-8') as f:
32
+ # indent=4 让文件更具可读性,如果想减小体积可以去掉 indent
33
+ json.dump(new_data, f, indent=4, ensure_ascii=False)
34
+
35
+ print(f"成功保存至: {output_path}")
36
+
37
+ except FileNotFoundError:
38
+ print(f"错误: 找不到文件 {input_path}")
39
+ except Exception as e:
40
+ print(f"发生错误: {e}")
41
+
42
+ if __name__ == "__main__":
43
+ clean_json()
hlip/hlip/data/ct_rate/files/train_info_0_50000.json ADDED
The diff for this file is too large to render. See raw diff
 
hlip/hlip/data/ct_rate/files/train_info_0_50000_old.json ADDED
The diff for this file is too large to render. See raw diff
 
hlip/hlip/data/ct_rate/files/valid_info_0_50000.json ADDED
The diff for this file is too large to render. See raw diff
 
hlip/hlip/data/ct_rate/metafiles/conc_info.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:3832e4b955e1d9e4f5b4d493f87124d5aba581f1fdbf5c201e3c9a896b4cc89d
3
+ size 11341777
hlip/hlip/data/ct_rate/metafiles/desc_info.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:4272f7188990c704d4a84d2a55dcddec0b11d3dff3d2defc3580ef78f1ccb640
3
+ size 50092553
hlip/hlip/data/ct_rate/metafiles/train_labels.csv ADDED
The diff for this file is too large to render. See raw diff
 
hlip/hlip/data/ct_rate/metafiles/train_metadata.csv ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:575cff9e5dcefba21cda10b6e54f685370b1f00347c68a28eac55ff9544c082c
3
+ size 14922140
hlip/hlip/data/ct_rate/metafiles/train_reports.csv ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:e885df178fab09dfe7a0f2bdba121d5a4efe0c89d13db6f341a3bb3f8105ada7
3
+ size 79667286
hlip/hlip/data/ct_rate/metafiles/valid_labels.csv ADDED
The diff for this file is too large to render. See raw diff
 
hlip/hlip/data/ct_rate/metafiles/valid_metadata.csv ADDED
The diff for this file is too large to render. See raw diff
 
hlip/hlip/data/ct_rate/metafiles/valid_reports.csv ADDED
The diff for this file is too large to render. See raw diff
 
hlip/hlip/data/ct_rate/process.py ADDED
@@ -0,0 +1,98 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import os
2
+ import ast
3
+ import json
4
+ import argparse
5
+ import pandas as pd
6
+ import SimpleITK as sitk
7
+ import multiprocessing as mp
8
+
9
+ import torch
10
+
11
+
12
+ def get_args_parser():
13
+ parser = argparse.ArgumentParser('Process', add_help=False)
14
+ # Device
15
+ parser.add_argument('--num-cpus', default=1, type=int)
16
+ # Data
17
+ parser.add_argument('--data', default='train', type=str)
18
+ parser.add_argument('--root-dir', default='/download/ct_rate/dataset/')
19
+ parser.add_argument('--save-dir', default='/data/ct_rate/', type=str)
20
+ parser.add_argument('--save-astype', default='float32', type=str)
21
+ # Process
22
+ parser.add_argument('--start-index', default=0, type=int)
23
+ parser.add_argument('--end-index', default=50000, type=int)
24
+ parser.add_argument('--spacing', nargs='+', default=[3, 1, 1], type=int)
25
+ return parser
26
+
27
+
28
+ def load_nifti_file(data, args):
29
+ name = data["VolumeName"]
30
+ try:
31
+ # load in img
32
+ path = os.path.join(args.root_dir, args.data, name.rsplit('_', 2)[0], name.rsplit('_', 1)[0], name)
33
+ img = sitk.ReadImage(path)
34
+
35
+ # scale
36
+ img = img * data["RescaleSlope"] + data["RescaleIntercept"]
37
+
38
+ # compute spacing
39
+ (x, y), z = map(float, ast.literal_eval(data["XYSpacing"])), data["ZSpacing"]
40
+
41
+ # array
42
+ img = sitk.GetArrayFromImage(img) # d, h, w (z, y, x)
43
+
44
+ # resize
45
+ target_size = (int(img.shape[0] * z / args.spacing[0]), int(img.shape[1] * y / args.spacing[1]), int(img.shape[2] * x / args.spacing[2]))
46
+ img = torch.nn.functional.interpolate(torch.from_numpy(img).float()[None, None, ...], size=target_size, mode='trilinear').squeeze().numpy()
47
+
48
+ # rescale (here we maintain the original HU value, will do rescale during training and testing.)
49
+ return img, name.rsplit('.', 2)[0]
50
+
51
+ except Exception:
52
+ return None, name.rsplit('.', 2)[0]
53
+
54
+
55
+ def single_worker(rows, args):
56
+ results = {}
57
+
58
+ for row in rows:
59
+ img, name = load_nifti_file(row, args)
60
+ if img is None:
61
+ results[name] = 'fail'
62
+ continue
63
+ if args.save_astype == 'float32':
64
+ img = torch.from_numpy(img).to(torch.float32)
65
+ elif args.save_astype == 'float16':
66
+ img = torch.from_numpy(img).to(torch.float16)
67
+
68
+ img_save_dir = os.path.join(args.save_dir, args.data, name.rsplit('_', 2)[0], name.rsplit('_', 1)[0])
69
+ os.makedirs(img_save_dir, exist_ok=True)
70
+ torch.save(img, os.path.join(img_save_dir, name+'.pt'))
71
+
72
+ results[name] = {'shape': img.shape, 'spacing': args.spacing}
73
+ return results
74
+
75
+
76
+ def main(args):
77
+ csv_file = pd.read_csv(f'./metafiles/{args.data}_metadata.csv')
78
+ rows = [row[1] for row in csv_file.iterrows()][args.start_index: args.end_index]
79
+ num_rows = len(rows)
80
+ num_chunks = args.num_cpus
81
+ chunk_size = (num_rows + num_chunks - 1) // num_chunks
82
+ rows_chunks = [rows[i:i + chunk_size] for i in range(0, num_rows, chunk_size)]
83
+ input_chunks = [(rows_chunk, args) for rows_chunk in rows_chunks]
84
+
85
+ with mp.Pool(processes=args.num_cpus) as pool:
86
+ results_multi_workers = pool.starmap(single_worker, input_chunks)
87
+
88
+ results = {}
89
+ for results_one_worker in results_multi_workers:
90
+ results.update(results_one_worker)
91
+ with open(f'./files/{args.data}_info_{args.start_index}_{args.end_index}.json', 'w') as f:
92
+ json.dump(results, f, indent=4)
93
+
94
+
95
+ if __name__ == '__main__':
96
+ parser = argparse.ArgumentParser('Process', parents=[get_args_parser()])
97
+ args = parser.parse_args()
98
+ main(args)
hlip/hlip/data/ct_rate/process.sh ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ python process.py --num-cpus 8 --data 'valid' \
2
+ --root-dir '/mnt/cvlab/scratch/cvlab/home/hantzhan/code/hlip/ct_rate/dataset' \
3
+ --save-dir '/mnt/cvlab/scratch/cvlab/home/hantzhan/code/hlip/data/ct_rate/'
hlip/hlip/data/pub_brain_5/brats23/download.py ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
 
1
+ import synapseclient
2
+ import synapseutils
3
+
4
+
5
+ if __name__ == "__main__":
6
+ target_path = '/path/to/brats23'
7
+ syn = synapseclient.Synapse()
8
+ syn.login(authToken='') # your token
9
+ files = synapseutils.syncFromSynapse(syn, 'syn51156910', path=target_path)
hlip/hlip/data/pub_brain_5/brats23/process.py ADDED
@@ -0,0 +1,131 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ BraTS is a standard dataset in which every scan has a
3
+ fixed spacing of (1 mm, 1 mm, 1 mm) and a fixed shape of (155, 240, 240).
4
+ Therefore, no further statistical analysis is necessary for this dataset.
5
+ """
6
+
7
+ import os
8
+ import logging
9
+ import argparse
10
+ import numpy as np
11
+ import SimpleITK as sitk
12
+ import multiprocessing as mp
13
+
14
+ import torch
15
+
16
+
17
+ def get_args_parser():
18
+ parser = argparse.ArgumentParser('BraTS23', add_help=False)
19
+ parser.add_argument('--num-cpus', default=1, type=int)
20
+ parser.add_argument('--dataset', default='BraTS-GLI', type=str)
21
+ parser.add_argument('--uint8', default=False, action='store_true')
22
+ parser.add_argument('--root-path', default='/path/to/brats23', type=str)
23
+ parser.add_argument('--save-path', default='/path/to/pub_brain_5/brats23/', type=str)
24
+ return parser
25
+
26
+
27
+ def reorient(img_sitk, tgt='RPI'):
28
+ """
29
+ Reorientation from src -> tgt for the input img.
30
+ Although this function is flexible enough for tgt,
31
+ it is important to follow the standard orientation order as:
32
+ 'RPI' for Python; 'LPS' for 3D Slicer.
33
+ Parameters:
34
+ img: An sitk image of shape [x, y, z].
35
+ tgt: A string of target orentations.
36
+ Returns:
37
+ img: An sitk image after transposing.
38
+ """
39
+ orienter = sitk.DICOMOrientImageFilter()
40
+ orienter.SetDesiredCoordinateOrientation(tgt)
41
+ return orienter.Execute(img_sitk)
42
+
43
+
44
+ def clip_by_percentile(img, min, max):
45
+ """ Percentile Clip
46
+ """
47
+ lower = np.percentile(img, min)
48
+ upper = np.percentile(img, max)
49
+ img = np.clip(img, lower, upper)
50
+ img = (img - img.min()) / (img.max() - img.min() + 1e-8)
51
+ return img
52
+
53
+
54
+ def load_nifti_file(path):
55
+ img_sitk = sitk.ReadImage(path)
56
+ img_sitk = reorient(img_sitk, tgt='RPI')
57
+ img_arr = sitk.GetArrayFromImage(img_sitk) # x, y, z -> z, y, x (d, h, w)
58
+ img_arr = clip_by_percentile(img_arr, 0.5, 99.5)
59
+ return img_arr
60
+
61
+
62
+ def single_worker(patient_ids, set_dir, save_dir):
63
+ for patient_id in patient_ids:
64
+ patient_dir = os.path.join(set_dir, patient_id)
65
+
66
+ patient_save_dir = os.path.join(save_dir, patient_id)
67
+ os.makedirs(patient_save_dir, exist_ok=True)
68
+
69
+ for series in sorted([p for p in os.listdir(patient_dir) if os.path.isfile(os.path.join(patient_dir, p)) and p.endswith('.nii.gz') and not p.startswith('.') and 'seg' not in p.lower() and 'mask' not in p.lower()]):
70
+ series_path = os.path.join(patient_dir, series)
71
+ series_save_path = os.path.join(patient_save_dir, series.split('.')[0] + '.pt')
72
+
73
+ img = load_nifti_file(series_path)
74
+
75
+ if args.uint8:
76
+ img = torch.from_numpy((img * 255)).to(torch.uint8)
77
+ else:
78
+ img = torch.from_numpy(img)
79
+
80
+ torch.save(img, series_save_path)
81
+
82
+ logging.info(f'study-{patient_id}')
83
+
84
+
85
+ def main(args):
86
+ for dir in ['train', 'test']:
87
+ os.makedirs(os.path.join(args.save_path, dir), exist_ok=True)
88
+
89
+ if args.dataset == 'BraTS-GLI':
90
+ tumor_type = 'adult_glioma'
91
+ elif args.dataset == 'BraTS-MEN':
92
+ tumor_type = 'adult_meningioma'
93
+ elif args.dataset == 'BraTS-MET':
94
+ tumor_type = 'adult_metastasis'
95
+ elif args.dataset == 'BraTS-PED':
96
+ tumor_type = 'pediatric_glioma'
97
+
98
+ data_dir = os.path.join(args.root_path, args.dataset)
99
+ for dir in sorted([d for d in os.listdir(data_dir) if os.path.isdir(os.path.join(data_dir, d))]):
100
+ if 'Train' in dir:
101
+ save_dir = os.path.join(args.save_path, 'train', tumor_type)
102
+ os.makedirs(save_dir, exist_ok=True)
103
+ elif 'Validation' in dir:
104
+ save_dir = os.path.join(args.save_path, 'test', tumor_type)
105
+ os.makedirs(save_dir, exist_ok=True)
106
+ else:
107
+ continue
108
+
109
+ set_dir = os.path.join(data_dir, dir)
110
+ patient_ids = sorted([d for d in os.listdir(set_dir) if os.path.isdir(os.path.join(set_dir, d))])
111
+ patient_ids_chunks = np.array_split(patient_ids, args.num_cpus)
112
+ input_chunks = [(patient_ids_chunk, set_dir, save_dir) for patient_ids_chunk in patient_ids_chunks]
113
+ with mp.Pool(processes=args.num_cpus) as pool:
114
+ pool.starmap(single_worker, input_chunks)
115
+ return
116
+
117
+
118
+ if __name__ == '__main__':
119
+ parser = argparse.ArgumentParser('BraTS23', parents=[get_args_parser()])
120
+ args = parser.parse_args()
121
+
122
+ # set logging format
123
+ logging.basicConfig(
124
+ filename=f'./logs/process_dataset/{args.dataset}.log',
125
+ filemode='w',
126
+ level=logging.INFO,
127
+ format='%(asctime)s - %(levelname)s - %(message)s'
128
+ )
129
+ logging.info(f'{args}\n')
130
+
131
+ main(args)
hlip/hlip/data/pub_brain_5/brats23/unzip.py ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import os
2
+ import zipfile
3
+ import logging
4
+
5
+ from tqdm import tqdm
6
+ from pathlib import Path
7
+
8
+
9
+ def unzip_file(zip_path, extract_to):
10
+ os.makedirs(extract_to, exist_ok=True)
11
+
12
+ with zipfile.ZipFile(zip_path, 'r') as zip_ref:
13
+ zip_items = zip_ref.namelist()
14
+ for item in zip_items:
15
+ try:
16
+ zip_ref.extract(item, extract_to)
17
+ logging.info(f"Extracted: {item}")
18
+ except zipfile.BadZipFile:
19
+ logging.warning(f"Bad zip file: {item}")
20
+ except zipfile.LargeZipFile:
21
+ logging.warning(f"File too large: {item}")
22
+ except Exception as e:
23
+ logging.warning(f"Failed to extract {item}: {e}")
24
+
25
+
26
+ if __name__ == "__main__":
27
+ logging.basicConfig(filename='unzip.log', filemode='w', format='%(name)s - %(levelname)s - %(message)s', level=logging.INFO)
28
+ root_path = '/path/to/brats23'
29
+ files = sorted([p for p in Path(root_path).rglob("*.zip")])
30
+ for file in files:
31
+ logging.info(f"unzip {str(file).split('/')[-2]}: {str(file).split('/')[-1]} ...")
32
+ extract_to = '/'.join(str(file).split('.')[0].split('/')[:-1])
33
+ unzip_file(file, extract_to)
34
+ logging.info("Done!")
hlip/hlip/data/pub_brain_5/ground_truth.csv ADDED
The diff for this file is too large to render. See raw diff
 
hlip/hlip/data/pub_brain_5/nyu_mets/process.log ADDED
The diff for this file is too large to render. See raw diff
 
hlip/hlip/data/pub_brain_5/nyu_mets/process.py ADDED
@@ -0,0 +1,154 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import os
2
+ import logging
3
+ import argparse
4
+ import numpy as np
5
+ import SimpleITK as sitk
6
+ import multiprocessing as mp
7
+
8
+ import torch
9
+
10
+
11
+ def get_args_parser():
12
+ parser = argparse.ArgumentParser('NYU Mets', add_help=False)
13
+ parser.add_argument('--num-cpus', default=1, type=int)
14
+ parser.add_argument('--uint8', default=False, action='store_true')
15
+ parser.add_argument('--statistic', default=False, action='store_true')
16
+ parser.add_argument('--root-path', default='/path/to/nyu_mets', type=str)
17
+ parser.add_argument('--save-path', default='/path/to/pub_brain_5/nyu_mets/', type=str)
18
+ return parser
19
+
20
+
21
+ def reorient(img_sitk, tgt='RPI'):
22
+ """
23
+ Reorientation from src -> tgt for the input img.
24
+ Although this function is flexible enough for tgt,
25
+ it is important to follow the standard orientation order as:
26
+ 'RPI' for Python; 'LPS' for 3D Slicer.
27
+ Parameters:
28
+ img: An sitk image of shape [x, y, z].
29
+ tgt: A string of target orentations.
30
+ Returns:
31
+ img: An sitk image after transposing.
32
+ """
33
+ orienter = sitk.DICOMOrientImageFilter()
34
+ orienter.SetDesiredCoordinateOrientation(tgt)
35
+ return orienter.Execute(img_sitk)
36
+
37
+
38
+ def clip_by_percentile(img, min, max):
39
+ """ Percentile Clip
40
+ """
41
+ lower = np.percentile(img, min)
42
+ upper = np.percentile(img, max)
43
+ img = np.clip(img, lower, upper)
44
+ img = (img - img.min()) / (img.max() - img.min() + 1e-8)
45
+ return img
46
+
47
+
48
+ def compute_spacing(img_sitk):
49
+ """Returns the spacing of the given SimpleITK image.
50
+ """
51
+ spacing_sitk = img_sitk.GetSpacing()
52
+ return np.array(spacing_sitk, dtype=float)
53
+
54
+
55
+ def transpose2dhw(img_arr, spacing_sitk):
56
+ """
57
+ Transpose img as:
58
+ - D: Through-plane (with the lowest resolution / largest spacing)
59
+ - H and W: In-plane (with higher resolution)
60
+ Parameters:
61
+ img: An axial-like numpy array of shape [z, y, x].
62
+ spacing: A sitk spacing for [x, y, z].
63
+ Return:
64
+ img: A numpy array after transposing axes.
65
+ view: A string indicate different views.
66
+ """
67
+ spacing_array = spacing_sitk[::-1] # x,y,z -> z,y,x
68
+
69
+ # Identify the dimension with the largest spacing -> that axis becomes D (through-plane)
70
+ _max_spacing_side = np.argmax(spacing_array)
71
+ if _max_spacing_side == 0:
72
+ # z-axis has largest spacing -> axial
73
+ # (keep img_arr unchanged)
74
+ view = 'axial'
75
+ elif _max_spacing_side == 1:
76
+ # y-axis has largest spacing -> coronal
77
+ img_arr = np.transpose(img_arr, (1, 0, 2)) # (y, z, x)
78
+ view = 'coronal'
79
+ else:
80
+ # x-axis has largest spacing -> sagittal
81
+ img_arr = np.transpose(img_arr, (2, 0, 1)) # (x, z, y)
82
+ view = 'sagittal'
83
+ return img_arr, view
84
+
85
+
86
+ def clip_by_percentile(img, min, max):
87
+ """ Percentile Clip
88
+ """
89
+ lower = np.percentile(img, min)
90
+ upper = np.percentile(img, max)
91
+ img = np.clip(img, lower, upper)
92
+ img = (img - img.min()) / (img.max() - img.min() + 1e-8)
93
+ return img
94
+
95
+
96
+ def load_nifti_file(path):
97
+ img_sitk = sitk.ReadImage(path)
98
+ img_sitk = reorient(img_sitk, tgt='RPI')
99
+ spacing_sitk = compute_spacing(img_sitk)
100
+ img_arr = sitk.GetArrayFromImage(img_sitk) # x, y, z -> z, y, x (d, h, w)
101
+ img_arr, view = transpose2dhw(img_arr, spacing_sitk)
102
+ img_arr = clip_by_percentile(img_arr, 0.5, 99.5)
103
+ return img_arr, view
104
+
105
+
106
+ def single_worker(patient_ids, root_dir, save_dir):
107
+ for patient_id in patient_ids:
108
+ patient_dir = os.path.join(root_dir, patient_id)
109
+ patient_save_dir = os.path.join(save_dir, patient_id)
110
+ os.makedirs(patient_save_dir, exist_ok=True)
111
+
112
+ for series in sorted([p for p in os.listdir(patient_dir) if os.path.isdir(os.path.join(patient_dir, p)) and not p.startswith('.') and 'seg' not in p.lower() and 'mask' not in p.lower()]):
113
+ series_path = os.path.join(patient_dir, series, 'nifti', 'SERIES.nii.gz')
114
+ series_save_path = os.path.join(patient_save_dir, series + '.pt')
115
+
116
+ img, view = load_nifti_file(series_path)
117
+
118
+ if args.uint8:
119
+ img = torch.from_numpy((img * 255)).to(torch.uint8)
120
+ else:
121
+ img = torch.from_numpy(img)
122
+
123
+ logging.info(f"study-{patient_id}_series-{series}_view-{view}_shape-{[*img.shape]}")
124
+
125
+ if args.statistic:
126
+ continue
127
+ else:
128
+ torch.save(img, series_save_path)
129
+
130
+ def main(args):
131
+ os.makedirs(os.path.join(args.save_path), exist_ok=True)
132
+
133
+ patient_ids = np.array(os.listdir(args.root_path))
134
+ patient_ids_chunks = np.array_split(patient_ids, args.num_cpus)
135
+ input_chunks = [(patient_ids_chunk, args.root_path, args.save_path) for patient_ids_chunk in patient_ids_chunks]
136
+ with mp.Pool(processes=args.num_cpus) as pool:
137
+ pool.starmap(single_worker, input_chunks)
138
+ return
139
+
140
+
141
+ if __name__ == '__main__':
142
+ parser = argparse.ArgumentParser('NYU Mets', parents=[get_args_parser()])
143
+ args = parser.parse_args()
144
+
145
+ # set logging format
146
+ logging.basicConfig(
147
+ filename=f'./process.log',
148
+ filemode='w',
149
+ level=logging.INFO,
150
+ format='%(asctime)s - %(levelname)s - %(message)s'
151
+ )
152
+ logging.info(f'{args}\n')
153
+
154
+ main(args)
hlip/hlip/data/pub_brain_5/open_bhb/process.log ADDED
The diff for this file is too large to render. See raw diff
 
hlip/hlip/data/pub_brain_5/open_bhb/process.py ADDED
@@ -0,0 +1,145 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import os
2
+ import logging
3
+ import argparse
4
+ import numpy as np
5
+ import SimpleITK as sitk
6
+ import multiprocessing as mp
7
+
8
+ import torch
9
+
10
+
11
+ def get_args_parser():
12
+ parser = argparse.ArgumentParser('Open BHB', add_help=False)
13
+ parser.add_argument('--num-cpus', default=1, type=int)
14
+ parser.add_argument('--uint8', default=False, action='store_true')
15
+ parser.add_argument('--statistic', default=False, action='store_true')
16
+ parser.add_argument('--root-path', default='/path/to/open_bhb', type=str)
17
+ parser.add_argument('--save-path', default='/path/to/pub_brain_5/open_bhb/', type=str)
18
+ return parser
19
+
20
+
21
+ def reorient(img_sitk, tgt='RPI'):
22
+ """
23
+ Reorientation from src -> tgt for the input img.
24
+ Although this function is flexible enough for tgt,
25
+ it is important to follow the standard orientation order as:
26
+ 'RPI' for Python; 'LPS' for 3D Slicer.
27
+ Parameters:
28
+ img: An sitk image of shape [x, y, z].
29
+ tgt: A string of target orentations.
30
+ Returns:
31
+ img: An sitk image after transposing.
32
+ """
33
+ orienter = sitk.DICOMOrientImageFilter()
34
+ orienter.SetDesiredCoordinateOrientation(tgt)
35
+ return orienter.Execute(img_sitk)
36
+
37
+
38
+ def clip_by_percentile(img, min, max):
39
+ """ Percentile Clip
40
+ """
41
+ lower = np.percentile(img, min)
42
+ upper = np.percentile(img, max)
43
+ img = np.clip(img, lower, upper)
44
+ img = (img - img.min()) / (img.max() - img.min() + 1e-8)
45
+ return img
46
+
47
+
48
+ def compute_spacing(img_sitk):
49
+ """Returns the spacing of the given SimpleITK image.
50
+ """
51
+ spacing_sitk = img_sitk.GetSpacing()
52
+ return np.array(spacing_sitk, dtype=float)
53
+
54
+
55
+ def transpose2dhw(img_arr, spacing_sitk):
56
+ """
57
+ Transpose img as:
58
+ - D: Through-plane (with the lowest resolution / largest spacing)
59
+ - H and W: In-plane (with higher resolution)
60
+ Parameters:
61
+ img: An axial-like numpy array of shape [z, y, x].
62
+ spacing: A sitk spacing for [x, y, z].
63
+ Return:
64
+ img: A numpy array after transposing axes.
65
+ view: A string indicate different views.
66
+ """
67
+ spacing_array = spacing_sitk[::-1] # x,y,z -> z,y,x
68
+
69
+ # Identify the dimension with the largest spacing -> that axis becomes D (through-plane)
70
+ _max_spacing_side = np.argmax(spacing_array)
71
+ if _max_spacing_side == 0:
72
+ # z-axis has largest spacing -> axial
73
+ # (keep img_arr unchanged)
74
+ view = 'axial'
75
+ elif _max_spacing_side == 1:
76
+ # y-axis has largest spacing -> coronal
77
+ img_arr = np.transpose(img_arr, (1, 0, 2)) # (y, z, x)
78
+ view = 'coronal'
79
+ else:
80
+ # x-axis has largest spacing -> sagittal
81
+ img_arr = np.transpose(img_arr, (2, 0, 1)) # (x, z, y)
82
+ view = 'sagittal'
83
+ return img_arr, view
84
+
85
+
86
+ def load_nifti_file(path):
87
+ img_sitk = sitk.ReadImage(path)
88
+ img_sitk = reorient(img_sitk, tgt='RPI')
89
+ spacing_sitk = compute_spacing(img_sitk)
90
+ img_arr = sitk.GetArrayFromImage(img_sitk) # x, y, z -> z, y, x (d, h, w)
91
+ img_arr, view = transpose2dhw(img_arr, spacing_sitk)
92
+ img_arr = clip_by_percentile(img_arr, 0.5, 99.5)
93
+ return img_arr, view
94
+
95
+
96
+ def single_worker(patient_ids, root_dir, save_dir):
97
+ for patient_id in patient_ids:
98
+ patient_dir = os.path.join(root_dir, patient_id)
99
+ patient_save_dir = os.path.join(save_dir, patient_id)
100
+ os.makedirs(patient_save_dir, exist_ok=True)
101
+
102
+ for series in sorted([p for p in os.listdir(patient_dir) if os.path.isdir(os.path.join(patient_dir, p)) and not p.startswith('.') and 'seg' not in p.lower() and 'mask' not in p.lower()]):
103
+ series_path = os.path.join(patient_dir, series, 'nifti', 'SERIES.nii.gz')
104
+ series_save_path = os.path.join(patient_save_dir, series + '.pt')
105
+
106
+ img, view = load_nifti_file(series_path)
107
+
108
+ if args.uint8:
109
+ img = torch.from_numpy((img * 255)).to(torch.uint8)
110
+ else:
111
+ img = torch.from_numpy(img)
112
+
113
+ logging.info(f"study-{patient_id}_series-{series}_view-{view}_shape-{[*img.shape]}")
114
+
115
+ if args.statistic:
116
+ continue
117
+ else:
118
+ torch.save(img, series_save_path)
119
+
120
+
121
+ def main(args):
122
+ os.makedirs(os.path.join(args.save_path), exist_ok=True)
123
+
124
+ patient_ids = np.array([p for p in os.listdir(args.root_path) if os.path.isdir(os.path.join(args.root_path, p)) and not p.startswith('.')])
125
+ patient_ids_chunks = np.array_split(patient_ids, args.num_cpus)
126
+ input_chunks = [(patient_ids_chunk, args.root_path, args.save_path) for patient_ids_chunk in patient_ids_chunks]
127
+ with mp.Pool(processes=args.num_cpus) as pool:
128
+ pool.starmap(single_worker, input_chunks)
129
+ return
130
+
131
+
132
+ if __name__ == '__main__':
133
+ parser = argparse.ArgumentParser('Open BHB', parents=[get_args_parser()])
134
+ args = parser.parse_args()
135
+
136
+ # set logging format
137
+ logging.basicConfig(
138
+ filename=f'./process.log',
139
+ filemode='w',
140
+ level=logging.INFO,
141
+ format='%(asctime)s - %(levelname)s - %(message)s'
142
+ )
143
+ logging.info(f'{args}\n')
144
+
145
+ main(args)
hlip/hlip/data/pub_brain_5/pub_brain_5.csv ADDED
The diff for this file is too large to render. See raw diff
 
hlip/hlip/data/pub_brain_5/pub_brain_5_gt.csv ADDED
The diff for this file is too large to render. See raw diff
 
hlip/hlip/data/pub_brain_5/stroke/process.log ADDED
The diff for this file is too large to render. See raw diff
 
hlip/hlip/data/pub_brain_5/stroke/process.py ADDED
@@ -0,0 +1,223 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import os
2
+ import logging
3
+ import argparse
4
+ import numpy as np
5
+ import nibabel as nib
6
+ import SimpleITK as sitk
7
+ import multiprocessing as mp
8
+
9
+ import torch
10
+
11
+
12
+ def get_args_parser():
13
+ parser = argparse.ArgumentParser('Stroke', add_help=False)
14
+ parser.add_argument('--num-cpus', default=1, type=int)
15
+ parser.add_argument('--uint8', default=False, action='store_true')
16
+ parser.add_argument('--statistic', default=False, action='store_true')
17
+ parser.add_argument('--root-path', default='/path/to/stroke/', type=str)
18
+ parser.add_argument('--save-path', default='/path/to/pub_brain_5/stroke/', type=str)
19
+ return parser
20
+
21
+
22
+ def reorient(img_sitk, tgt='RPI'):
23
+ """
24
+ Reorientation from src -> tgt for the input img.
25
+ Although this function is flexible enough for tgt,
26
+ it is important to follow the standard orientation order as:
27
+ 'RPI' for Python; 'LPS' for 3D Slicer.
28
+ Parameters:
29
+ img: An sitk image of shape [x, y, z].
30
+ tgt: A string of target orentations.
31
+ Returns:
32
+ img: An sitk image after transposing.
33
+ """
34
+ orienter = sitk.DICOMOrientImageFilter()
35
+ orienter.SetDesiredCoordinateOrientation(tgt)
36
+ return orienter.Execute(img_sitk)
37
+
38
+
39
+ def clip_by_percentile(img, min, max):
40
+ """ Percentile Clip
41
+ """
42
+ lower = np.percentile(img, min)
43
+ upper = np.percentile(img, max)
44
+ img = np.clip(img, lower, upper)
45
+ img = (img - img.min()) / (img.max() - img.min() + 1e-8)
46
+ return img
47
+
48
+
49
+ def compute_spacing(img_sitk):
50
+ """Returns the spacing of the given SimpleITK image.
51
+ """
52
+ spacing_sitk = img_sitk.GetSpacing()
53
+ return np.array(spacing_sitk, dtype=float)
54
+
55
+
56
+ def transpose2dhw(img_arr, spacing_sitk):
57
+ """
58
+ Transpose img as:
59
+ - D: Through-plane (with the lowest resolution / largest spacing)
60
+ - H and W: In-plane (with higher resolution)
61
+ Parameters:
62
+ img: An axial-like numpy array of shape [z, y, x].
63
+ spacing: A sitk spacing for [x, y, z].
64
+ Return:
65
+ img: A numpy array after transposing axes.
66
+ view: A string indicate different views.
67
+ """
68
+ spacing_array = spacing_sitk[::-1] # x,y,z -> z,y,x
69
+
70
+ # Identify the dimension with the largest spacing -> that axis becomes D (through-plane)
71
+ _max_spacing_side = np.argmax(spacing_array)
72
+ if _max_spacing_side == 0:
73
+ # z-axis has largest spacing -> axial
74
+ # (keep img_arr unchanged)
75
+ view = 'axial'
76
+ elif _max_spacing_side == 1:
77
+ # y-axis has largest spacing -> coronal
78
+ img_arr = np.transpose(img_arr, (1, 0, 2)) # (y, z, x)
79
+ view = 'coronal'
80
+ else:
81
+ # x-axis has largest spacing -> sagittal
82
+ img_arr = np.transpose(img_arr, (2, 0, 1)) # (x, z, y)
83
+ view = 'sagittal'
84
+ return img_arr, view
85
+
86
+
87
+ def load_nifti_file(path):
88
+ try:
89
+ img_sitk = sitk.ReadImage(path)
90
+ img_sitk = reorient(img_sitk, tgt='RPI')
91
+ spacing_sitk = compute_spacing(img_sitk)
92
+ img_arr = sitk.GetArrayFromImage(img_sitk) # x, y, z -> z, y, x (d, h, w)
93
+ img_arr, view = transpose2dhw(img_arr, spacing_sitk)
94
+ img_arr = clip_by_percentile(img_arr, 0.5, 99.5)
95
+ return img_arr, view
96
+ except Exception:
97
+ return None
98
+
99
+
100
+ def load_dwi(path):
101
+ # load scans with nibable-style code
102
+
103
+ def transpose_raw2rpi(img, orientation):
104
+ orientation_transpose = []
105
+ try:
106
+ orientation_transpose.append(orientation.index('R'))
107
+ except ValueError:
108
+ orientation_transpose.append(orientation.index('L'))
109
+ try:
110
+ orientation_transpose.append(orientation.index('P'))
111
+ except ValueError:
112
+ orientation_transpose.append(orientation.index('A'))
113
+ try:
114
+ orientation_transpose.append(orientation.index('I'))
115
+ except ValueError:
116
+ orientation_transpose.append(orientation.index('S'))
117
+ img = np.transpose(img, orientation_transpose)
118
+ if 'L' in orientation:
119
+ img = img[::-1, :, :]
120
+ if 'A' in orientation:
121
+ img = img[:, ::-1, :]
122
+ if 'S' in orientation:
123
+ img = img[:, :, ::-1]
124
+ return img, orientation_transpose
125
+
126
+
127
+ def compute_spacing(affine, orientation_transpose):
128
+ spacing = np.sqrt(np.sum(affine[:3, :3] ** 2, axis=0))
129
+ spacing = spacing[orientation_transpose]
130
+ return spacing
131
+
132
+
133
+ def transpose_lps2dhw(img, spacing):
134
+ # 'lps' or 'rpi' does not matter, the order of them matters.
135
+
136
+ if np.unique(spacing).size == 1:
137
+ img = np.transpose(img, (2, 1, 0)) # axial
138
+ else:
139
+ _max_spacing_side = np.argmax(spacing, axis=-1)
140
+ if _max_spacing_side == 0: # sagittal
141
+ img = np.transpose(img, (0, 2, 1))
142
+ if _max_spacing_side == 1: # coronal
143
+ img = np.transpose(img, (1, 2, 0))
144
+ if _max_spacing_side == 2: # axial
145
+ img = np.transpose(img, (2, 1, 0))
146
+ return img
147
+
148
+ try:
149
+ nifti_file = nib.load(path)
150
+ img = nifti_file.get_fdata()
151
+ affine = nifti_file.affine
152
+ orientation = nib.orientations.aff2axcodes(affine)
153
+ img0, orientation_transpose = transpose_raw2rpi(img[:, :, :, 0], orientation)
154
+ img1, orientation_transpose = transpose_raw2rpi(img[:, :, :, 1], orientation)
155
+ spacing = compute_spacing(affine, orientation_transpose)
156
+ img0 = transpose_lps2dhw(img0, spacing)
157
+ img1 = transpose_lps2dhw(img1, spacing)
158
+ img = np.concatenate([img0, img1], axis=0)
159
+ img = clip_by_percentile(img, 0.5, 99.5)
160
+ return img
161
+ except Exception:
162
+ return None
163
+
164
+
165
+ def single_worker(patient_ids, root_dir, save_dir):
166
+ for patient_id in patient_ids:
167
+ patient_dir = os.path.join(root_dir, patient_id)
168
+ patient_save_dir = os.path.join(save_dir, patient_id)
169
+ os.makedirs(patient_save_dir, exist_ok=True)
170
+
171
+ for series in sorted([p for p in os.listdir(patient_dir) if os.path.isdir(os.path.join(patient_dir, p)) and not p.startswith('.') and 'seg' not in p.lower() and 'mask' not in p.lower()]):
172
+ series_path = os.path.join(patient_dir, series, 'nifti', 'SERIES.nii.gz')
173
+ series_save_path = os.path.join(patient_save_dir, series + '.pt')
174
+
175
+ output = load_nifti_file(series_path)
176
+ if output is None:
177
+ img = load_dwi(series_path)
178
+ view = 'dwi'
179
+ else:
180
+ img, view = output
181
+
182
+ if img is None:
183
+ logging.warning(f'study-{patient_id}_series-{series}')
184
+ continue
185
+
186
+ if args.uint8:
187
+ img = torch.from_numpy((img * 255)).to(torch.uint8)
188
+ else:
189
+ img = torch.from_numpy(img)
190
+
191
+ logging.info(f"study-{patient_id}_series-{series}_view-{view}_shape-{[*img.shape]}")
192
+
193
+ if args.statistic:
194
+ continue
195
+ else:
196
+ torch.save(img, series_save_path)
197
+
198
+
199
+ def main(args):
200
+ os.makedirs(os.path.join(args.save_path), exist_ok=True)
201
+
202
+ patient_ids = np.array([p for p in os.listdir(args.root_path) if os.path.isdir(os.path.join(args.root_path, p)) and not p.startswith('.')])
203
+ patient_ids_chunks = np.array_split(patient_ids, args.num_cpus)
204
+ input_chunks = [(patient_ids_chunk, args.root_path, args.save_path) for patient_ids_chunk in patient_ids_chunks]
205
+ with mp.Pool(processes=args.num_cpus) as pool:
206
+ pool.starmap(single_worker, input_chunks)
207
+ return
208
+
209
+
210
+ if __name__ == '__main__':
211
+ parser = argparse.ArgumentParser('Stroke', parents=[get_args_parser()])
212
+ args = parser.parse_args()
213
+
214
+ # set logging format
215
+ logging.basicConfig(
216
+ filename=f'./process.log',
217
+ filemode='w',
218
+ level=logging.INFO,
219
+ format='%(asctime)s - %(levelname)s - %(message)s'
220
+ )
221
+ logging.info(f'{args}\n')
222
+
223
+ main(args)
hlip/hlip/data/pub_brain_5/ucsf_mets/process.log ADDED
The diff for this file is too large to render. See raw diff
 
hlip/hlip/data/pub_brain_5/ucsf_mets/process.py ADDED
@@ -0,0 +1,145 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import os
2
+ import logging
3
+ import argparse
4
+ import numpy as np
5
+ import SimpleITK as sitk
6
+ import multiprocessing as mp
7
+
8
+ import torch
9
+
10
+
11
+ def get_args_parser():
12
+ parser = argparse.ArgumentParser('UCSF Mets', add_help=False)
13
+ parser.add_argument('--num-cpus', default=1, type=int)
14
+ parser.add_argument('--uint8', default=False, action='store_true')
15
+ parser.add_argument('--statistic', default=False, action='store_true')
16
+ parser.add_argument('--root-path', default='/path/to/ucsf_mets/', type=str)
17
+ parser.add_argument('--save-path', default='/path/to/pub_brain_5/ucsf_mets/', type=str)
18
+ return parser
19
+
20
+
21
+ def reorient(img_sitk, tgt='RPI'):
22
+ """
23
+ Reorientation from src -> tgt for the input img.
24
+ Although this function is flexible enough for tgt,
25
+ it is important to follow the standard orientation order as:
26
+ 'RPI' for Python; 'LPS' for 3D Slicer.
27
+ Parameters:
28
+ img: An sitk image of shape [x, y, z].
29
+ tgt: A string of target orentations.
30
+ Returns:
31
+ img: An sitk image after transposing.
32
+ """
33
+ orienter = sitk.DICOMOrientImageFilter()
34
+ orienter.SetDesiredCoordinateOrientation(tgt)
35
+ return orienter.Execute(img_sitk)
36
+
37
+
38
+ def clip_by_percentile(img, min, max):
39
+ """ Percentile Clip
40
+ """
41
+ lower = np.percentile(img, min)
42
+ upper = np.percentile(img, max)
43
+ img = np.clip(img, lower, upper)
44
+ img = (img - img.min()) / (img.max() - img.min() + 1e-8)
45
+ return img
46
+
47
+
48
+ def compute_spacing(img_sitk):
49
+ """Returns the spacing of the given SimpleITK image.
50
+ """
51
+ spacing_sitk = img_sitk.GetSpacing()
52
+ return np.array(spacing_sitk, dtype=float)
53
+
54
+
55
+ def transpose2dhw(img_arr, spacing_sitk):
56
+ """
57
+ Transpose img as:
58
+ - D: Through-plane (with the lowest resolution / largest spacing)
59
+ - H and W: In-plane (with higher resolution)
60
+ Parameters:
61
+ img: An axial-like numpy array of shape [z, y, x].
62
+ spacing: A sitk spacing for [x, y, z].
63
+ Return:
64
+ img: A numpy array after transposing axes.
65
+ view: A string indicate different views.
66
+ """
67
+ spacing_array = spacing_sitk[::-1] # x,y,z -> z,y,x
68
+
69
+ # Identify the dimension with the largest spacing -> that axis becomes D (through-plane)
70
+ _max_spacing_side = np.argmax(spacing_array)
71
+ if _max_spacing_side == 0:
72
+ # z-axis has largest spacing -> axial
73
+ # (keep img_arr unchanged)
74
+ view = 'axial'
75
+ elif _max_spacing_side == 1:
76
+ # y-axis has largest spacing -> coronal
77
+ img_arr = np.transpose(img_arr, (1, 0, 2)) # (y, z, x)
78
+ view = 'coronal'
79
+ else:
80
+ # x-axis has largest spacing -> sagittal
81
+ img_arr = np.transpose(img_arr, (2, 0, 1)) # (x, z, y)
82
+ view = 'sagittal'
83
+ return img_arr, view
84
+
85
+
86
+ def load_nifti_file(path):
87
+ img_sitk = sitk.ReadImage(path)
88
+ img_sitk = reorient(img_sitk, tgt='RPI')
89
+ spacing_sitk = compute_spacing(img_sitk)
90
+ img_arr = sitk.GetArrayFromImage(img_sitk) # x, y, z -> z, y, x (d, h, w)
91
+ img_arr, view = transpose2dhw(img_arr, spacing_sitk)
92
+ img_arr = clip_by_percentile(img_arr, 0.5, 99.5)
93
+ return img_arr, view
94
+
95
+
96
+ def single_worker(patient_ids, root_dir, save_dir):
97
+ for patient_id in patient_ids:
98
+ patient_dir = os.path.join(root_dir, patient_id)
99
+ patient_save_dir = os.path.join(save_dir, patient_id)
100
+ os.makedirs(patient_save_dir, exist_ok=True)
101
+
102
+ for series in sorted([p for p in os.listdir(patient_dir) if os.path.isdir(os.path.join(patient_dir, p)) and not p.startswith('.') and 'seg' not in p.lower() and 'mask' not in p.lower()]):
103
+ series_path = os.path.join(patient_dir, series, 'nifti', 'SERIES.nii.gz')
104
+ series_save_path = os.path.join(patient_save_dir, series + '.pt')
105
+
106
+ img, view = load_nifti_file(series_path)
107
+
108
+ if args.uint8:
109
+ img = torch.from_numpy((img * 255)).to(torch.uint8)
110
+ else:
111
+ img = torch.from_numpy(img)
112
+
113
+ logging.info(f"study-{patient_id}_series-{series}_view-{view}_shape-{[*img.shape]}")
114
+
115
+ if args.statistic:
116
+ continue
117
+ else:
118
+ torch.save(img, series_save_path)
119
+
120
+
121
+ def main(args):
122
+ os.makedirs(os.path.join(args.save_path), exist_ok=True)
123
+
124
+ patient_ids = np.array([p for p in os.listdir(args.root_path) if os.path.isdir(os.path.join(args.root_path, p)) and not p.startswith('.')])
125
+ patient_ids_chunks = np.array_split(patient_ids, args.num_cpus)
126
+ input_chunks = [(patient_ids_chunk, args.root_path, args.save_path) for patient_ids_chunk in patient_ids_chunks]
127
+ with mp.Pool(processes=args.num_cpus) as pool:
128
+ pool.starmap(single_worker, input_chunks)
129
+ return
130
+
131
+
132
+ if __name__ == '__main__':
133
+ parser = argparse.ArgumentParser('UCSF Mets', parents=[get_args_parser()])
134
+ args = parser.parse_args()
135
+
136
+ # set logging format
137
+ logging.basicConfig(
138
+ filename=f'./process.log',
139
+ filemode='w',
140
+ level=logging.INFO,
141
+ format='%(asctime)s - %(levelname)s - %(message)s'
142
+ )
143
+ logging.info(f'{args}\n')
144
+
145
+ main(args)
hlip/hlip/data/rad_chestct/download.py ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import os
2
+ import requests
3
+ from tqdm import tqdm
4
+
5
+
6
+ if __name__ == "__main__":
7
+
8
+ save_dir = "/download/rad_chestct/"
9
+ os.makedirs(save_dir, exist_ok=True)
10
+
11
+ access_token = "" # your token
12
+ record_id = "6406114"
13
+
14
+ r = requests.get(f"https://zenodo.org/api/records/{record_id}", params={'access_token': access_token})
15
+ download_urls = [f['links']['self'] for f in r.json()['files']]
16
+ filenames = [f['key'] for f in r.json()['files']]
17
+
18
+ for filename, url in tqdm(zip(filenames, download_urls), total=len(filenames)):
19
+ # print("Downloading:", filename)
20
+ r = requests.get(url, params={'access_token': access_token})
21
+ with open(os.path.join(save_dir, filename), 'wb') as f:
22
+ f.write(r.content)
hlip/hlip/data/rad_chestct/files/imgtest.csv ADDED
The diff for this file is too large to render. See raw diff
 
hlip/hlip/data/rad_chestct/files/imgtest_16.csv ADDED
@@ -0,0 +1,361 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ NoteAcc_DEID,Emphysema,Atelectasis,Lung nodule,Lung opacity,Pulmonary fibrotic sequela,Pleural effusion,Peribronchial thickening,Consolidation,Bronchiectasis,Interlobular septal thickening,Cardiomegaly,Pericardial effusion,Hiatal hernia,Coronary artery wall calcification,Arterial wall calcification
2
+ tst34780,0.0,0.0,1.0,1.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0
3
+ tst33567,1.0,0.0,1.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0
4
+ tst36098,0.0,1.0,1.0,1.0,0.0,0.0,0.0,1.0,1.0,0.0,0.0,0.0,0.0,0.0,0.0
5
+ tst30445,0.0,1.0,1.0,1.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,1.0,1.0
6
+ tst31586,0.0,0.0,1.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0
7
+ tst35936,0.0,0.0,1.0,1.0,1.0,0.0,0.0,0.0,0.0,0.0,1.0,0.0,0.0,0.0,0.0
8
+ tst33689,0.0,0.0,1.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,1.0,1.0
9
+ tst32342,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,1.0,1.0
10
+ tst31233,0.0,1.0,1.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0
11
+ tst33552,1.0,1.0,0.0,0.0,0.0,1.0,0.0,0.0,0.0,0.0,0.0,1.0,0.0,0.0,0.0
12
+ tst35389,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,0.0,0.0,0.0,0.0,0.0,0.0,0.0,1.0,1.0
354
+ tst35891,0.0,0.0,1.0,1.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0
355
+ tst31219,0.0,0.0,1.0,1.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0
356
+ tst33609,0.0,1.0,1.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,1.0,1.0
357
+ tst29123,0.0,0.0,1.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0
358
+ tst34883,0.0,0.0,1.0,1.0,0.0,0.0,0.0,0.0,0.0,0.0,1.0,1.0,0.0,1.0,1.0
359
+ tst34029,0.0,1.0,1.0,1.0,0.0,1.0,0.0,0.0,0.0,0.0,1.0,0.0,0.0,1.0,1.0
360
+ tst34239,1.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,1.0,1.0,1.0
361
+ tst32907,0.0,0.0,1.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0
hlip/hlip/data/rad_chestct/files/imgtrain.csv ADDED
The diff for this file is too large to render. See raw diff
 
hlip/hlip/data/rad_chestct/files/imgtrain_16.csv ADDED
The diff for this file is too large to render. See raw diff
 
hlip/hlip/data/rad_chestct/files/imgvalid.csv ADDED
The diff for this file is too large to render. See raw diff