-
Notifications
You must be signed in to change notification settings - Fork 149
Lesion inpainting (LIT) integration #803
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
08a75da
initial integration of LIT module
ClePol 458139b
integrated updated neurolit
ClePol 58088df
Adjust neurolit dependency and clarify Docker config
ClePol b9ff8eb
Refine LIT integration paths and docs
ClePol 0cf6399
Store LIT FastSurfer outputs in subject directories
ClePol 8a1e091
Clarify LIT inpainting control flow
ClePol 62f85ff
Require neurolit 0.6.1 public outputs
ClePol ac8acc4
Mark LIT integration as experimental
ClePol fd3126e
Support native voxel size for keepgeom segmentation
ClePol 165760f
Address FastSurfer LIT documentation review
ClePol 3fc1956
Move neurolit data home out of tmp
ClePol 1e28c18
Make neurolit an optional FastSurfer dependency
ClePol e210171
Simplify LIT control flow in run_fastsurfer
ClePol d6e8df3
Apply suggestions from code review
dkuegler File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,56 @@ | ||
| # Lesion Inpainting Tool (LIT) | ||
|
|
||
| With the **Lesion Inpainting Tool (LIT)** extension, FastSurfer is able to process T1-weighted | ||
| images with lesions, such as tumors, cavities, or abnormalities. Since the deep learning-based | ||
| tool LIT is designed to paint healthy-looking tissue into those lesions, downstream analysis with | ||
| FastSurfer can produce more reliable whole-brain segmentation and cortical surface reconstruction | ||
| in cases with significant structural alterations. | ||
|
|
||
| > **Note:** The FastSurfer LIT extension is currently experimental. Review the LIT-modified | ||
| > outputs before using them for downstream analyses. | ||
|
|
||
| ## FastSurfer Usage | ||
|
|
||
| FastSurfer runs LIT when a lesion mask is passed with `--lesion_mask <path to file>`: | ||
|
|
||
| ```bash | ||
| ./run_fastsurfer.sh --t1 /path/to/T1.nii.gz \ | ||
| --lesion_mask /path/to/lesion_mask.nii.gz \ | ||
| --sid subject_id --sd /path/to/output_dir \ | ||
| --fs_license /path/to/license.txt | ||
| ``` | ||
|
|
||
| Lesion inpainting is not compatible with separate processing of the segmentation and surfaces with `--seg_only` and `--surf_only`. If you want to run the surface pipeline, avoid `--seg_only`! | ||
|
|
||
| With `--lesion_mask <path to file>`, FastSurfer: | ||
|
|
||
| 1. inpaints the lesion area in the input T1w image, | ||
| 2. runs the requested FastSurfer segmentation and surface pipeline on the inpainted image, and | ||
| 3. maps the lesion into the final FastSurfer outputs and regenerates affected statistics. | ||
|
|
||
| ## Lesion Mask Requirements | ||
|
|
||
| The lesion annotation must match the MRI volume passed as `--t1`: it should use the same voxel | ||
| grid and vox2ras/affine, and it should be an integer or binary-compatible numeric image. Non-zero | ||
| voxels are treated as lesion. The mask defines which voxels are inpainted and later marked in the | ||
| FastSurfer outputs. | ||
|
|
||
| Underestimation of lesion areas affects the segmentation more than oversegmentation of lesion masks, | ||
| hence we recommend generous annotation of all damaged tissue and potentially dilating the mask. | ||
|
|
||
|
ClePol marked this conversation as resolved.
|
||
| ## Output Behavior | ||
|
|
||
| FastSurfer with LIT updates the standard subject directory instead of writing a separate LIT output | ||
| tree. The primary FastSurfer files are lesion-integrated, while pre-lesion versions are preserved | ||
| as `.lit` backups or, for selected surface-derived files, as mapped backup files. | ||
|
|
||
| `lesion_impact_summary.yaml` is currently emitted as YAML by neurolit. The accompanying text | ||
| reports provide a human-readable summary of the affected anatomical structures. | ||
| The complete list of LIT-related output files is documented in the | ||
| [FastSurfer output files overview](../OUTPUT_FILES.md#lesion-inpainting-tool-lit-optional). | ||
|
|
||
| ## References | ||
|
|
||
| If you use LIT in your research, please cite: | ||
|
|
||
| *Pollak C, Kuegler D, Bauer T, Rueber T, Reuter M, FastSurfer-LIT: Lesion Inpainting Tool for Whole Brain MRI Segmentation with Tumors, Cavities and Abnormalities, Imaging Neuroscience 2025. https://doi.org/10.1162/imag_a_00446* | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -7,3 +7,4 @@ FastSurfer includes several specialized deep learning modules that can be run in | |
| :maxdepth: 2 | ||
|
|
||
| CC | ||
| LIT | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
|
ClePol marked this conversation as resolved.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.