ft42 commited on
Commit
6fd1609
Β·
verified Β·
1 Parent(s): 3379206

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +361 -3
README.md CHANGED
@@ -1,3 +1,361 @@
1
- ---
2
- license: mit
3
- ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ language: en
3
+ license: cc-by-nc-4.0
4
+ library_name: pins-toolkit
5
+ tags:
6
+ - medical-imaging
7
+ - computed-tomography
8
+ - pulmonary-nodules
9
+ - radiomics
10
+ - segmentation
11
+ - lung-cancer
12
+ - ct-analysis
13
+ - pyradiomics
14
+ - simpleitk
15
+ - pytorch
16
+ - monai
17
+ - opencv
18
+ - docker
19
+ datasets:
20
+ - dlcs24
21
+ metrics:
22
+ - dice-coefficient
23
+ - feature-reproducibility
24
+ pipeline_tag: image-segmentation
25
+ widget:
26
+ - example_title: Lung Nodule Segmentation
27
+ text: Automated segmentation of pulmonary nodules in chest CT scans
28
+ model-index:
29
+ - name: PiNS
30
+ results:
31
+ - task:
32
+ type: image-segmentation
33
+ name: Medical Image Segmentation
34
+ dataset:
35
+ name: LIDC-IDRI
36
+ type: medical-ct
37
+ metrics:
38
+ - type: dice-coefficient
39
+ value: 0.82
40
+ name: Dice Similarity Coefficient
41
+ - type: hausdorff-distance
42
+ value: 2.3
43
+ name: Hausdorff Distance (mm)
44
+ - type: correlation
45
+ value: 0.94
46
+ name: Volume Correlation (RΒ²)
47
+ ---
48
+
49
+ # PiNS - Point-driven Nodule Segmentation 🫁
50
+
51
+ <div align="center">
52
+ <p align="center">
53
+ <img src="assets/PiNS_logo.png" alt="PiNS Logo" width="500">
54
+ </p>
55
+
56
+ ![PiNS Banner](https://via.placeholder.com/800x200/0066cc/ffffff?text=PiNS%3A+Medical+Imaging+Toolkit+for+Lung+Nodule+Analysis)
57
+
58
+ **Medical imaging toolkit for automated pulmonary nodule detection, segmentation, and quantitative analysis**
59
+
60
+ [![Docker Hub](https://img.shields.io/docker/pulls/ft42/pins?logo=docker)](https://hub.docker.com/r/ft42/pins)
61
+ [![License](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT)
62
+ [![Python](https://img.shields.io/badge/Python-3.9+-green.svg)](https://python.org)
63
+ [![Medical Imaging](https://img.shields.io/badge/Medical-Imaging-red.svg)](https://simpleitk.org)
64
+ [![PyTorch](https://img.shields.io/badge/PyTorch-2.8.0-orange.svg)](https://pytorch.org)
65
+ [![MONAI](https://img.shields.io/badge/MONAI-1.4.0-blue.svg)](https://monai.io)
66
+
67
+ [πŸš€ Quick Start](#quick-start) β€’ [πŸ“– Documentation](https://github.com/ft42/PiNS/blob/main/docs/TECHNICAL_DOCUMENTATION.md) β€’ [πŸ’» GitHub](https://github.com/ft42/PiNS) β€’ [🐳 Docker Hub](https://hub.docker.com/r/ft42/pins)
68
+
69
+ </div>
70
+
71
+ ## Overview
72
+
73
+ **PiNS (Point-driven Nodule Segmentation)** is a medical imaging toolkit designed for analysis of pulmonary nodules in computed tomography (CT) scans. The toolkit provides three core functionalities:
74
+
75
+ 🎯 **Automated Segmentation** - Multi-algorithm nodule segmentation with clinical validation
76
+ πŸ“Š **Quantitative Radiomics** - 100+ standardized imaging biomarkers
77
+ 🧩 **3D Patch Extraction** - Deep learning-ready data preparation
78
+
79
+ ## Model Architecture & Algorithms
80
+
81
+ ### Segmentation Pipeline
82
+
83
+ ```mermaid
84
+ graph TB
85
+ A[CT Image + Coordinates] --> B[Coordinate Transformation]
86
+ B --> C[ROI Extraction]
87
+ C --> D{Segmentation Algorithm}
88
+ D --> E[K-means Clustering]
89
+ D --> F[Gaussian Mixture Model]
90
+ D --> G[Fuzzy C-Means]
91
+ D --> H[Otsu Thresholding]
92
+ E --> I[Connected Components]
93
+ F --> I
94
+ G --> I
95
+ H --> I
96
+ I --> J[Morphological Operations]
97
+ J --> K[Expansion (2mm)]
98
+ K --> L[Binary Mask Output]
99
+ ```
100
+
101
+ ### Core Algorithms
102
+
103
+ 1. **K-means Clustering** (Default)
104
+ - Binary classification: nodule vs. background
105
+ - Euclidean distance metric
106
+ - Automatic initialization
107
+
108
+ 2. **Gaussian Mixture Model**
109
+ - Probabilistic clustering approach
110
+ - Expectation-maximization optimization
111
+ - Suitable for heterogeneous nodules
112
+
113
+ 3. **Fuzzy C-Means**
114
+ - Soft clustering with membership degrees
115
+ - Iterative optimization
116
+ - Robust to noise and partial volume effects
117
+
118
+ 4. **Otsu Thresholding**
119
+ - Automatic threshold selection
120
+ - Histogram-based method
121
+ - Fast execution for large datasets
122
+
123
+
124
+ ## Quick Start
125
+
126
+ ### Prerequisites
127
+ - Docker 20.10.0+ installed
128
+ - 8GB+ RAM
129
+ - 15GB+ free disk space
130
+
131
+ ### Installation & Usage
132
+
133
+ ```bash
134
+ # 1. Pull the Docker image (automatically handled)
135
+ docker pull ft42/pins:latest
136
+
137
+ # 2. Clone the repository
138
+ git clone https://github.com/ft42/PiNS.git
139
+ cd PiNS
140
+
141
+ # 3. Run segmentation pipeline
142
+ ./scripts/DLCS24_KNN_2mm_Extend_Seg.sh
143
+
144
+ # 4. Extract radiomics features
145
+ ./scripts/DLCS24_KNN_2mm_Extend_Radiomics.sh
146
+
147
+ # 5. Generate ML-ready patches
148
+ ./scripts/DLCS24_CADe_64Qpatch.sh
149
+ ```
150
+
151
+ ### Expected Output
152
+
153
+ ```
154
+ βœ… Segmentation completed!
155
+ πŸ“Š Features extracted: 107 radiomics features per nodule
156
+ 🧩 Patches generated: 64Γ—64Γ—64 voxel volumes
157
+ πŸ“ Results saved to: demofolder/output/
158
+ ```
159
+
160
+ ## Input Data Requirements
161
+
162
+
163
+
164
+ ### Image Specifications
165
+ - **Format**: NIfTI (.nii.gz) or DICOM
166
+ - **Modality**: CT chest/abdomen/CAP scans
167
+ - **Resolution**: 0.5-2.0 mm isotropic (preferred)
168
+ - **Matrix size**: 512Γ—512 or larger
169
+ - **Bit depth**: 16-bit signed integers
170
+ - **Intensity range**: Standard HU values (-1024 to +3071)
171
+ - **Sample Dataset:** Duke Lung Cancer Screening Dataset 2024(DLCS24)[![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.13799069.svg)](https://doi.org/10.5281/zenodo.13799069)
172
+ ### Annotation Format
173
+
174
+ ```csv
175
+ ct_nifti_file,nodule_id,coordX,coordY,coordZ,w,h,d,Malignant_lbl
176
+ patient001.nii.gz,patient001_01,-106.55,-63.84,-211.68,4.39,4.39,4.30,0
177
+ patient001.nii.gz,patient001_02,88.69,39.48,-126.09,6.24,6.24,6.25,1
178
+ ```
179
+
180
+ **Column Descriptions**:
181
+ - `coordX/Y/Z`: World coordinates in millimeters (ITK/SimpleITK standard)
182
+ - `w/h/d`: Bounding box dimensions in millimeters
183
+ - `Malignant_lbl`: Binary malignancy label (0=benign, 1=malignant)
184
+
185
+ ## Output Specifications
186
+
187
+ ### 1. Segmentation Masks
188
+ - **Format**: NIfTI binary masks (.nii.gz)
189
+ - **Values**: 0 (background), 1 (nodule)
190
+ - **Coordinate system**: Aligned with input CT
191
+ - **Quality**: Sub-voxel precision boundaries
192
+
193
+ ### 2. Radiomics Features
194
+
195
+ **Feature Categories** (107 total features):
196
+
197
+ | Category | Count | Description |
198
+ |----------|-------|-------------|
199
+ | **Shape** | 14 | Volume, Surface Area, Sphericity, Compactness |
200
+ | **First-order** | 18 | Mean, Std, Skewness, Kurtosis, Percentiles |
201
+ | **GLCM** | 24 | Contrast, Correlation, Energy, Homogeneity |
202
+ | **GLRLM** | 16 | Run Length Non-uniformity, Gray Level Variance |
203
+ | **GLSZM** | 16 | Size Zone Matrix features |
204
+ | **GLDM** | 14 | Dependence Matrix features |
205
+ | **NGTDM** | 5 | Neighboring Gray Tone Difference |
206
+
207
+ ### 3. 3D Patches
208
+ - **Dimensions**: 64Γ—64Γ—64 voxels (configurable)
209
+ - **Normalization**: Lung window (-1000 to 500 HU) β†’ [0,1]
210
+ - **Format**: Individual NIfTI files per nodule
211
+ - **Centering**: Precise coordinate-based positioning
212
+
213
+ ## Configuration Options
214
+
215
+ ### Algorithm Selection
216
+ ```bash
217
+ SEG_ALG="knn" # Options: knn, gmm, fcm, otsu
218
+ EXPANSION_MM=2.0 # Expansion radius in millimeters
219
+ ```
220
+
221
+ ### Radiomics Parameters
222
+ ```json
223
+ {
224
+ "binWidth": 25,
225
+ "resampledPixelSpacing": [1, 1, 1],
226
+ "interpolator": "sitkBSpline",
227
+ "labelInterpolator": "sitkNearestNeighbor"
228
+ }
229
+ ```
230
+
231
+ ### Patch Extraction
232
+ ```bash
233
+ PATCH_SIZE="64 64 64" # Voxel dimensions
234
+ NORMALIZATION="-1000 500 0 1" # HU window and output range
235
+ ```
236
+
237
+ ## Use Cases & Applications
238
+
239
+ ### πŸ”¬ Research Applications
240
+ - **Biomarker Discovery**: Large-scale radiomics studies
241
+ - **Algorithm Development**: Standardized evaluation protocols
242
+ - **Multi-institutional Studies**: Reproducible feature extraction
243
+ - **Longitudinal Analysis**: Change assessment over time
244
+
245
+ ### πŸ€– AI/ML Applications
246
+ - **Training Data Preparation**: Standardized patch generation
247
+ - **Feature Engineering**: Comprehensive radiomics features
248
+ - **Model Validation**: Consistent preprocessing pipeline
249
+ - **Transfer Learning**: Pre-processed medical imaging data
250
+
251
+ ## Technical Specifications
252
+
253
+ ### Docker Container Details
254
+ - **Base Image**: Ubuntu 20.04 LTS
255
+ - **Size**: ~1.5 GB
256
+ - **Python**: 3.9+
257
+ - **Key Libraries**:
258
+ - SimpleITK 2.2.1+ (medical image processing)
259
+ - PyRadiomics 3.1.0+ (feature extraction)
260
+ - scikit-learn 1.3.0+ (machine learning algorithms)
261
+ - pandas 2.0.3+ (data manipulation)
262
+
263
+ ### Performance Characteristics
264
+ - **Memory Usage**: ~500MB per nodule
265
+ - **Processing Speed**: Linear scaling with nodule count
266
+ - **Concurrent Processing**: Multi-threading support
267
+ - **Storage Requirements**: ~1MB per output mask
268
+
269
+ ## Validation & Quality Assurance
270
+
271
+
272
+
273
+
274
+ ## Limitations & Considerations
275
+
276
+ ### Current Limitations
277
+ - **Nodule Size**: Optimized for nodules 3-30mm diameter
278
+ - **Image Quality**: Requires standard clinical CT protocols
279
+ - **Coordinate Accuracy**: Dependent on annotation precision
280
+ - **Processing Time**: Sequential processing (parallelization possible)
281
+
282
+
283
+
284
+ ## Contributing & Development
285
+
286
+ ### Research Collaborations
287
+ We welcome collaborations from:
288
+ - **Academic Medical Centers**
289
+ - **Radiology Departments**
290
+ - **Medical AI Companies**
291
+ - **Open Source Contributors**
292
+
293
+
294
+
295
+ ## Citation & References
296
+
297
+ ### Primary Citation
298
+ ```bibtex
299
+ @software{pins2025,
300
+ title={PiNS: Point-driven Nodule Segmentation Toolkit for Quantitative CT Analysis},
301
+ author={Fakrul Islam Tushar},
302
+ year={2025},
303
+ url={https://github.com/fitushar/PiNS},
304
+ version={1.0.0},
305
+ doi={10.5281/zenodo.xxxxx}
306
+ }
307
+ ```
308
+
309
+ ### Related Publications
310
+ 1. **AI in Lung Health: Benchmarking** : [Tushar et al. arxiv (2024)](https://arxiv.org/abs/2405.04605)
311
+ 2. **AI in Lung Health: Benchmarking** : [https://github.com/fitushar/AI-in-Lung-Health-Benchmarking](https://github.com/fitushar/AI-in-Lung-Health-Benchmarking-Detection-and-Diagnostic-Models-Across-Multiple-CT-Scan-Datasets)
312
+ 4. **DLCS Dataset**: [Wang et al. Radiology AI 2024](https://doi.org/10.1148/ryai.240248);[Zenedo](https://zenodo.org/records/13799069)
313
+ 5. **Refining Focus in AI for Lung Cancer:** Comparing Lesion-Centric and Chest-Region Models with Performance Insights from Internal and External Validation. [![arXiv](https://img.shields.io/badge/arXiv-2411.16823-<color>.svg)](https://arxiv.org/abs/2411.16823)
314
+ 6. **Peritumoral Expansion Radiomics** for Improved Lung Cancer Classification. [![arXiv](https://img.shields.io/badge/arXiv-2411.16008-<color>.svg)](https://arxiv.org/abs/2411.16008)
315
+ 7. **PyRadiomics Framework**: [van Griethuysen et al., Cancer Research 2017](https://pubmed.ncbi.nlm.nih.gov/29092951/)
316
+
317
+
318
+
319
+ ## License & Usage
320
+ **license: cc-by-nc-4.0**
321
+ ### Academic Use License
322
+ This project is released for **academic and non-commercial research purposes only**.
323
+ You are free to use, modify, and distribute this code under the following conditions:
324
+ - βœ… Academic research use permitted
325
+ - βœ… Modification and redistribution permitted for research
326
+ - ❌ Commercial use prohibited without prior written permission
327
+ For commercial licensing inquiries, please contact: tushar.ece@duke.edu
328
+
329
+
330
+
331
+
332
+ ## Support & Community
333
+
334
+ ### Getting Help
335
+ - **πŸ“– Documentation**: [Comprehensive technical docs](https://github.com/fitushar/PiNS/blob/main/docs/)
336
+ - **πŸ› Issues**: [GitHub Issues](https://github.com/fitushar/PiNS/issues)
337
+ - **πŸ’¬ Discussions**: [GitHub Discussions](https://github.com/fitushar/PiNS/discussions)
338
+ - **πŸ“§ Email**: tushar.ece@Duke.edu ; fitushar.mi@gmail.com
339
+
340
+ ### Community Stats
341
+ - **Users**:
342
+ - **Publications**: 5+ research papers
343
+ - **Downloads**:
344
+ - **Contributors**: Active open-source community
345
+
346
+ ---
347
+
348
+ <div align="center">
349
+
350
+ ### 🌟 **Star this project on [GitHub](https://github.com/fitushar/PiNS) if it helps your research!** 🌟
351
+
352
+ **Made with ❀️ for the medical imaging community**
353
+
354
+ [πŸš€ Get Started](#quick-start) β€’ [πŸ“– Full Documentation](https://github.com/ft42/PiNS) β€’ [πŸ’» Source Code](https://github.com/ft42/PiNS) β€’ [🐳 Docker Image](https://hub.docker.com/r/ft42/nodule-segmentation)
355
+
356
+ </div>
357
+
358
+
359
+ ---
360
+ license: mit
361
+ ---