Skip to content

Commit ecd2546

Browse files
committed
updated readme
1 parent 5111455 commit ecd2546

1 file changed

Lines changed: 165 additions & 0 deletions

File tree

Lines changed: 165 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,165 @@
1+
# 🧠 Pseudo-CT Inference Docker
2+
3+
This repository provides a **Dockerized inference pipeline** for generating pseudo-CT images from NAC PET input using a trained 3D U-Net model.
4+
5+
---
6+
7+
## 🚀 Features
8+
9+
* ✅ GPU-accelerated inference (CUDA)
10+
* ✅ Sliding window inference (overlap = 0.75)
11+
* ✅ PET-only input
12+
* ✅ Outputs CT in Hounsfield Units (HU)
13+
* ✅ Clean CLI interface
14+
* ✅ Runtime + inference timing logs
15+
16+
---
17+
18+
## 📦 Requirements
19+
20+
* Docker installed
21+
* NVIDIA GPU + drivers
22+
* NVIDIA Container Toolkit (`--gpus all` support)
23+
24+
---
25+
26+
## 🏗️ Build Docker Image
27+
28+
Navigate to the docker directory:
29+
30+
```bash
31+
cd inference/docker
32+
```
33+
34+
Build the image:
35+
36+
```bash
37+
docker build -t pseudoct .
38+
```
39+
40+
---
41+
42+
## ▶️ Run Inference
43+
44+
### 🔹 Basic Usage
45+
46+
```bash
47+
docker run --rm \
48+
--gpus all \
49+
--user $(id -u):$(id -g) \
50+
-v /absolute/path/to/data:/data \
51+
pseudoct \
52+
--input /data/sub-XXX/features/nacpet.nii.gz \
53+
--output /data/sub-XXX/pseudo_ct.nii.gz
54+
```
55+
56+
---
57+
58+
## 📁 Input Structure
59+
60+
Your data should follow:
61+
62+
```
63+
data/
64+
└── sub-XXX/
65+
└── features/
66+
└── nacpet.nii.gz
67+
```
68+
69+
---
70+
71+
## 📁 Output
72+
73+
The output will be saved as:
74+
75+
```
76+
data/
77+
└── sub-XXX/
78+
└── pseudo_ct.nii.gz
79+
```
80+
81+
---
82+
83+
## ⚠️ Important Notes
84+
85+
### 🔸 Path Mounting
86+
87+
Docker cannot access host paths directly. You must mount them using `-v`.
88+
89+
Example:
90+
91+
```bash
92+
-v /home/user/data:/data
93+
```
94+
95+
---
96+
97+
### 🔸 Permissions Fix
98+
99+
If you get a **permission denied error**, use:
100+
101+
```bash
102+
--user $(id -u):$(id -g)
103+
```
104+
105+
---
106+
107+
### 🔸 GPU Usage
108+
109+
Make sure to include:
110+
111+
```bash
112+
--gpus all
113+
```
114+
115+
Otherwise inference will run on CPU.
116+
117+
---
118+
119+
## ⏱️ Output Logs
120+
121+
Example output:
122+
123+
```
124+
Using device: cuda
125+
Inference time: 3.21 seconds
126+
Total runtime: 5.12 seconds
127+
Saved: /data/sub-XXX/pseudo_ct.nii.gz
128+
```
129+
130+
---
131+
132+
## 🧪 Debugging
133+
134+
### Check mounted data inside container:
135+
136+
```bash
137+
docker run --rm -it \
138+
-v /your/data:/data \
139+
pseudoct bash
140+
141+
ls /data
142+
```
143+
144+
---
145+
146+
## 🛠️ Customization
147+
148+
You can modify:
149+
150+
* Patch size → `PATCH_SIZE`
151+
* Sliding window batch → `SW_BATCH`
152+
* Overlap → `OVERLAP`
153+
154+
inside `inference.py`.
155+
156+
---
157+
158+
## 📌 Summary
159+
160+
| Step | Command |
161+
| ----- | -------------------------------------------------- |
162+
| Build | `docker build -t pseudoct .` |
163+
| Run | `docker run ... pseudoct --input ... --output ...` |
164+
165+
---

0 commit comments

Comments
 (0)