ykirchhoff commited on
Commit
6af65c5
·
verified ·
1 Parent(s): 662f140

Upload folder using huggingface_hub

Browse files
.gitattributes CHANGED
@@ -1,35 +1,3 @@
1
- *.7z filter=lfs diff=lfs merge=lfs -text
2
- *.arrow filter=lfs diff=lfs merge=lfs -text
3
- *.bin filter=lfs diff=lfs merge=lfs -text
4
- *.bz2 filter=lfs diff=lfs merge=lfs -text
5
- *.ckpt filter=lfs diff=lfs merge=lfs -text
6
- *.ftz filter=lfs diff=lfs merge=lfs -text
7
- *.gz filter=lfs diff=lfs merge=lfs -text
8
- *.h5 filter=lfs diff=lfs merge=lfs -text
9
- *.joblib filter=lfs diff=lfs merge=lfs -text
10
- *.lfs.* filter=lfs diff=lfs merge=lfs -text
11
- *.mlmodel filter=lfs diff=lfs merge=lfs -text
12
- *.model filter=lfs diff=lfs merge=lfs -text
13
- *.msgpack filter=lfs diff=lfs merge=lfs -text
14
- *.npy filter=lfs diff=lfs merge=lfs -text
15
- *.npz filter=lfs diff=lfs merge=lfs -text
16
- *.onnx filter=lfs diff=lfs merge=lfs -text
17
- *.ot filter=lfs diff=lfs merge=lfs -text
18
- *.parquet filter=lfs diff=lfs merge=lfs -text
19
- *.pb filter=lfs diff=lfs merge=lfs -text
20
- *.pickle filter=lfs diff=lfs merge=lfs -text
21
- *.pkl filter=lfs diff=lfs merge=lfs -text
22
- *.pt filter=lfs diff=lfs merge=lfs -text
23
  *.pth filter=lfs diff=lfs merge=lfs -text
24
- *.rar filter=lfs diff=lfs merge=lfs -text
25
- *.safetensors filter=lfs diff=lfs merge=lfs -text
26
- saved_model/**/* filter=lfs diff=lfs merge=lfs -text
27
- *.tar.* filter=lfs diff=lfs merge=lfs -text
28
- *.tar filter=lfs diff=lfs merge=lfs -text
29
- *.tflite filter=lfs diff=lfs merge=lfs -text
30
- *.tgz filter=lfs diff=lfs merge=lfs -text
31
- *.wasm filter=lfs diff=lfs merge=lfs -text
32
- *.xz filter=lfs diff=lfs merge=lfs -text
33
- *.zip filter=lfs diff=lfs merge=lfs -text
34
- *.zst filter=lfs diff=lfs merge=lfs -text
35
- *tfevents* filter=lfs diff=lfs merge=lfs -text
 
1
+ # Store large model-card assets and model weights with Git LFS on Hugging Face.
2
+ *.gif filter=lfs diff=lfs merge=lfs -text
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3
  *.pth filter=lfs diff=lfs merge=lfs -text
 
 
 
 
 
 
 
 
 
 
 
 
.gitignore ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Python and uv environments
2
+ __pycache__/
3
+ *.py[cod]
4
+ .pytest_cache/
5
+ .venv/
6
+
7
+ # Local inference inputs and outputs
8
+ input/
9
+ output/
10
+ predictions/
11
+
12
+ # Operating-system files
13
+ .DS_Store
14
+ Thumbs.db
LongiTrack_v1.0/dataset.json ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "channel_names": {
3
+ "0": "CT"
4
+ },
5
+ "labels": {
6
+ "background": 0,
7
+ "tumor": 1
8
+ },
9
+ "numTraining": 670,
10
+ "file_ending": ".nii.gz",
11
+ "name": "AutoPETIV_Longi",
12
+ "reference": "https://autopet-iv.grand-challenge.org/",
13
+ "description": "AutoPETIV_Longi",
14
+ "overwrite_image_reader_writer": "SimpleITKIO",
15
+ "citation": "@misc{kuestner2025longitudinal, author = {Thomas K\u00fcstner and Felix Peisen and Sergios Gatidis and Andreas Wagner and Ornela Megne and Ahmed Othman and Antoine Sanner and Tanja Lo\u00dfau and Jan Hendrik Moltz and Temke Kohlbrandt and Alessa Hering}, title = {Longitudinal-CT}, year = {2025}, publisher = {University of T\u00fcbingen}, doi = {10.57754/FDAT.qwsry-7t837}, url = {https://doi.org/10.57754/FDAT.qwsry-7t837}}",
16
+ "converted_by": "Yannick Kirchhoff & Max Rokuss"
17
+ }
LongiTrack_v1.0/fold_0/checkpoint_final.pth ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:19fdabeec11c504c604bac822cc004a4198322af099958baebc7005d9379224f
3
+ size 409353577
LongiTrack_v1.0/plans.json ADDED
@@ -0,0 +1,200 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "dataset_name": "Dataset232_AutoPETIV_Longi",
3
+ "plans_name": "nnUNetResEncUNetLPlans",
4
+ "original_median_spacing_after_transp": [
5
+ 3.0,
6
+ 0.8515625,
7
+ 0.8515625
8
+ ],
9
+ "original_median_shape_after_transp": [
10
+ 267,
11
+ 512,
12
+ 512
13
+ ],
14
+ "image_reader_writer": "SimpleITKIO",
15
+ "transpose_forward": [
16
+ 0,
17
+ 1,
18
+ 2
19
+ ],
20
+ "transpose_backward": [
21
+ 0,
22
+ 1,
23
+ 2
24
+ ],
25
+ "configurations": {
26
+ "3d_fullres": {
27
+ "data_identifier": "nnUNetPlans_3d_fullres",
28
+ "preprocessor_name": "LongiSegTrackingPreprocessor",
29
+ "batch_size": 2,
30
+ "patch_size": [
31
+ 112,
32
+ 224,
33
+ 224
34
+ ],
35
+ "median_image_size_in_voxels": [
36
+ 267.0,
37
+ 512.0,
38
+ 512.0
39
+ ],
40
+ "spacing": [
41
+ 3.0,
42
+ 0.8515625,
43
+ 0.8515625
44
+ ],
45
+ "normalization_schemes": [
46
+ "CTNormalization"
47
+ ],
48
+ "use_mask_for_norm": [
49
+ false
50
+ ],
51
+ "resampling_fn_data": "resample_data_or_seg_to_shape",
52
+ "resampling_fn_seg": "resample_data_or_seg_to_shape",
53
+ "resampling_fn_data_kwargs": {
54
+ "is_seg": false,
55
+ "order": 3,
56
+ "order_z": 0,
57
+ "force_separate_z": null
58
+ },
59
+ "resampling_fn_seg_kwargs": {
60
+ "is_seg": true,
61
+ "order": 1,
62
+ "order_z": 0,
63
+ "force_separate_z": null
64
+ },
65
+ "resampling_fn_probabilities": "resample_data_or_seg_to_shape",
66
+ "resampling_fn_probabilities_kwargs": {
67
+ "is_seg": false,
68
+ "order": 1,
69
+ "order_z": 0,
70
+ "force_separate_z": null
71
+ },
72
+ "architecture": {
73
+ "network_class_name": "dynamic_network_architectures.architectures.unet.ResidualEncoderUNet",
74
+ "arch_kwargs": {
75
+ "n_stages": 6,
76
+ "features_per_stage": [
77
+ 32,
78
+ 64,
79
+ 128,
80
+ 256,
81
+ 320,
82
+ 320
83
+ ],
84
+ "conv_op": "torch.nn.modules.conv.Conv3d",
85
+ "kernel_sizes": [
86
+ [
87
+ 1,
88
+ 3,
89
+ 3
90
+ ],
91
+ [
92
+ 3,
93
+ 3,
94
+ 3
95
+ ],
96
+ [
97
+ 3,
98
+ 3,
99
+ 3
100
+ ],
101
+ [
102
+ 3,
103
+ 3,
104
+ 3
105
+ ],
106
+ [
107
+ 3,
108
+ 3,
109
+ 3
110
+ ],
111
+ [
112
+ 3,
113
+ 3,
114
+ 3
115
+ ]
116
+ ],
117
+ "strides": [
118
+ [
119
+ 1,
120
+ 1,
121
+ 1
122
+ ],
123
+ [
124
+ 1,
125
+ 2,
126
+ 2
127
+ ],
128
+ [
129
+ 2,
130
+ 2,
131
+ 2
132
+ ],
133
+ [
134
+ 2,
135
+ 2,
136
+ 2
137
+ ],
138
+ [
139
+ 2,
140
+ 2,
141
+ 2
142
+ ],
143
+ [
144
+ 2,
145
+ 2,
146
+ 2
147
+ ]
148
+ ],
149
+ "n_blocks_per_stage": [
150
+ 1,
151
+ 3,
152
+ 4,
153
+ 6,
154
+ 6,
155
+ 6
156
+ ],
157
+ "n_conv_per_stage_decoder": [
158
+ 1,
159
+ 1,
160
+ 1,
161
+ 1,
162
+ 1
163
+ ],
164
+ "conv_bias": true,
165
+ "norm_op": "torch.nn.modules.instancenorm.InstanceNorm3d",
166
+ "norm_op_kwargs": {
167
+ "eps": 1e-05,
168
+ "affine": true
169
+ },
170
+ "dropout_op": null,
171
+ "dropout_op_kwargs": null,
172
+ "nonlin": "torch.nn.LeakyReLU",
173
+ "nonlin_kwargs": {
174
+ "inplace": true
175
+ }
176
+ },
177
+ "_kw_requires_import": [
178
+ "conv_op",
179
+ "norm_op",
180
+ "dropout_op",
181
+ "nonlin"
182
+ ]
183
+ },
184
+ "batch_dice": true
185
+ }
186
+ },
187
+ "experiment_planner_used": "nnUNetPlannerResEncL",
188
+ "label_manager": "LabelManager",
189
+ "foreground_intensity_properties_per_channel": {
190
+ "0": {
191
+ "max": 1510.982177734375,
192
+ "mean": -40.024558348857674,
193
+ "median": 49.00435256958008,
194
+ "min": -1878.9481201171875,
195
+ "percentile_00_5": -1024.0,
196
+ "percentile_99_5": 449.9750671386719,
197
+ "std": 265.1273934308606
198
+ }
199
+ }
200
+ }
README.md ADDED
@@ -0,0 +1,104 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: cc-by-nc-sa-4.0
3
+ library_name: LongiSeg
4
+ pipeline_tag: image-segmentation
5
+ tags:
6
+ - longiseg
7
+ - medical-imaging
8
+ - ct
9
+ - longitudinal
10
+ - lesion-tracking
11
+ - tumor-segmentation
12
+ - segmentation
13
+ - 3d-segmentation
14
+ - autopet
15
+ - autopet-iv
16
+ - radiology
17
+ ---
18
+
19
+ # LongiTrack
20
+
21
+ ![LongiSeg verified lesion tracking](assets/longisegv2.gif)
22
+
23
+ LongiTrack provides point-prompted longitudinal lesion tracking and segmentation for CT. It runs through [LongiSeg](https://github.com/MIC-DKFZ/LongiSeg) using CT images and a `tracking.json` file.
24
+
25
+ > **Research use only.** LongiTrack is not a medical device and must not be used as the sole basis for diagnosis, treatment, or other clinical decisions.
26
+
27
+ ## Download and install
28
+
29
+ Install [Git LFS](https://git-lfs.com/) and [uv](https://docs.astral.sh/uv/) first. Replace `<namespace>` with the Hugging Face account or organization that hosts this model.
30
+
31
+ ```bash
32
+ git lfs install
33
+ git clone https://huggingface.co/<namespace>/LongiTrack
34
+ cd LongiTrack
35
+ uv sync
36
+ ```
37
+
38
+ ## Run tracking inference
39
+
40
+ `tracking.json` must follow the [LongiSeg tracking-file format](https://github.com/MIC-DKFZ/LongiSeg/blob/master/documentation/lesion_tracking.md).
41
+
42
+ ```bash
43
+ uv run longitrack-predict \
44
+ --images-path /path/to/images \
45
+ --output-path /path/to/output \
46
+ --tracking-path /path/to/tracking.json
47
+ ```
48
+
49
+ Supported options:
50
+
51
+ | Option | Default | Description |
52
+ | --- | --- | --- |
53
+ | `--images-path` | — | Input image directory. |
54
+ | `--output-path` | — | Output directory. |
55
+ | `--tracking-path` | — | Path to `tracking.json`. |
56
+ | `--version` | `1.0` | Model version to use for inference. |
57
+ | `--mode` | `automatic` | Tracking mode: `automatic` or `manual`. |
58
+ | `--device` | `cuda` | Inference device: `cuda`, `cpu`, or `mps`. |
59
+
60
+ The selected version determines the model directory. Available checkpoint folds are detected automatically.
61
+
62
+ ## Versions
63
+
64
+ | Version | Model directory | Training data |
65
+ | --- | --- | --- |
66
+ | 1.0 | `LongiTrack_v1.0/` | [AutoPET IV](https://autopet-iv.grand-challenge.org/) |
67
+
68
+ ## Interactive viewer
69
+
70
+ [LongiTrack-napari](https://github.com/MIC-DKFZ/LongiTrack-napari) provides the interactive napari workflow for reviewing and correcting tracking points.
71
+
72
+ ## Citation
73
+
74
+ ### LongiTrack and LongiSeg
75
+
76
+ ```bibtex
77
+ @inproceedings{kirchhoff2026exploiting,
78
+ title = {Exploiting Longitudinal Context in Clinician-Verified Interactive Lesion Tracking},
79
+ author = {Kirchhoff, Yannick and Rokuss, Maximilian and Mertens, Daniel Philipp and F{\"u}ller, David and Hamm, Benjamin and Schreyer, Andreas and Ritter, Oliver and Maier-Hein, Klaus},
80
+ booktitle = {Medical Image Computing and Computer Assisted Intervention -- MICCAI 2026},
81
+ year = {2026}
82
+ }
83
+
84
+ @inproceedings{rokuss2024longitudinal,
85
+ title = {Longitudinal Segmentation of MS Lesions via Temporal Difference Weighting},
86
+ author = {Rokuss, Maximilian R and Kirchhoff, Yannick and Roy, Saikat and Kovacs, Balint and Ulrich, Constantin and Wald, Tassilo and Zenk, Maximilian and Denner, Stefan and Isensee, Fabian and Vollmuth, Philipp and Kleesiek, Jens and Maier-Hein, Klaus},
87
+ booktitle = {International Conference on Medical Image Computing and Computer-Assisted Intervention},
88
+ pages = {64--74},
89
+ year = {2024},
90
+ organization = {Springer}
91
+ }
92
+ ```
93
+
94
+ ### Data
95
+
96
+ ```bibtex
97
+ @misc{kuestner2025longitudinal,
98
+ author = {K\"ustner, Thomas and Peisen, Felix and Gatidis, Sergios and Wagner, Andreas and Megne, Ornela and Othman, Ahmed and Sanner, Antoine and Lo\ssau, Tanja and Moltz, Jan Hendrik and Kohlbrandt, Temke and Hering, Alessa},
99
+ title = {Longitudinal-CT},
100
+ year = {2025},
101
+ publisher = {University of T\"ubingen},
102
+ doi = {10.57754/FDAT.qwsry-7t837}
103
+ }
104
+ ```
assets/longisegv2.gif ADDED

Git LFS Details

  • SHA256: 373349f3913338c94d48b8242fe35655d5b90ebc0005d4d9a9ca54b1b80ee665
  • Pointer size: 133 Bytes
  • Size of remote file: 15.8 MB
pyproject.toml ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ [project]
2
+ name = "longitrack-inference"
3
+ version = "1.0.0"
4
+ description = "Thin command-line wrapper for LongiTrack tracking inference."
5
+ readme = "README.md"
6
+ requires-python = ">=3.10,<3.13"
7
+ dependencies = [
8
+ "longiseg @ git+https://github.com/MIC-DKFZ/LongiSeg.git@5f5987be17e100889c507fe52645e7ddfbb036cf",
9
+ ]
10
+
11
+ [project.scripts]
12
+ longitrack-predict = "longitrack_inference.cli:main"
13
+
14
+ [build-system]
15
+ requires = ["hatchling>=1.27"]
16
+ build-backend = "hatchling.build"
17
+
18
+ [tool.uv]
19
+ package = true
src/longitrack_inference/__init__.py ADDED
File without changes
src/longitrack_inference/cli.py ADDED
@@ -0,0 +1,46 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from __future__ import annotations
2
+
3
+ import argparse
4
+ from pathlib import Path
5
+
6
+
7
+ REPOSITORY_ROOT = Path(__file__).resolve().parents[2]
8
+
9
+
10
+ def parse_options() -> argparse.Namespace:
11
+ parser = argparse.ArgumentParser(description="Run point-prompted LongiTrack tracking inference.")
12
+ parser.add_argument("--images-path", type=Path, required=True, help="Input image directory.")
13
+ parser.add_argument("--output-path", type=Path, required=True, help="Output directory.")
14
+ parser.add_argument("--tracking-path", type=Path, required=True, help="Path to tracking.json.")
15
+ parser.add_argument("--version", default="1.0", help="Model version to use for inference (default: 1.0).")
16
+ parser.add_argument("--mode", choices=("automatic", "manual"), default="automatic", help="Tracking mode.")
17
+ parser.add_argument("--device", choices=("cuda", "cpu", "mps"), default="cuda", help="Inference device.")
18
+ return parser.parse_args()
19
+
20
+
21
+ def main() -> int:
22
+ options = parse_options()
23
+ model_path = REPOSITORY_ROOT / f"LongiTrack_v{options.version}"
24
+ dataset_json_path = model_path / "dataset.json"
25
+ if not model_path.is_dir() or not dataset_json_path.is_file():
26
+ raise SystemExit(f"Unknown or incomplete model version: {options.version}")
27
+
28
+ from torch import device
29
+ from longiseg.inference.tracking_inference import predict
30
+
31
+ predict(
32
+ images_path=options.images_path,
33
+ labels_path=None,
34
+ output_path=options.output_path,
35
+ model_path=model_path,
36
+ tracking_path=options.tracking_path,
37
+ dataset_json_path=dataset_json_path,
38
+ folds=None,
39
+ device=device(options.device),
40
+ mode=options.mode,
41
+ )
42
+ return 0
43
+
44
+
45
+ if __name__ == "__main__":
46
+ raise SystemExit(main())
uv.lock ADDED
The diff for this file is too large to render. See raw diff