-
Notifications
You must be signed in to change notification settings - Fork 3
Coverage #107
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
Coverage #107
Changes from 3 commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
e529c73
Add documentation badge and section to README
Hendrik-code a51873d
Add extended unit tests for NII, np_utils, and POI operations
Hendrik-code 59860ff
Add module overview table to README and sub-README pages to docs
Hendrik-code d0aa88d
Potential fix for pull request finding
Hendrik-code 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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| --8<-- "TPTBox/core/README.md" |
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 @@ | ||
| --8<-- "TPTBox/logger/README.md" |
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 @@ | ||
| --8<-- "TPTBox/mesh3D/README.md" |
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 @@ | ||
| --8<-- "TPTBox/core/poi_fun/README.md" |
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 @@ | ||
| --8<-- "TPTBox/registration/README.md" |
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 @@ | ||
| --8<-- "TPTBox/segmentation/README.md" |
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 @@ | ||
| --8<-- "TPTBox/spine/snapshot2D/README.md" |
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,27 @@ | ||
| # Spine (`TPTBox.spine`) | ||
|
|
||
| Spine-specific utilities built on top of the core `NII` and `POI` abstractions. | ||
| Contains two sub-modules: 2D snapshot generation and statistical spine measurements. | ||
|
|
||
| ## Sub-modules | ||
|
|
||
| | Sub-module | Description | | ||
| |---|---| | ||
| | [`snapshot2D/`](snapshot2d.md) | Modular 2D image snapshot generation (slices, MIPs, overlays) | | ||
| | [`spinestats/`](spinestats.md) | Clinical measurements: distances, Cobb angles, IVD POIs, endplates | | ||
|
|
||
| ## Quick Example | ||
|
|
||
| ```python | ||
| from TPTBox import NII, calc_centroids | ||
| from TPTBox.spine.snapshot2D.snapshot_modular import Snapshot_Frame, create_snapshot | ||
|
|
||
| ct = NII.load("ct.nii.gz", seg=False) | ||
| seg = NII.load("seg.nii.gz", seg=True) | ||
|
|
||
| # Generate a 2D sagittal snapshot with a segmentation overlay | ||
| create_snapshot( | ||
| [Snapshot_Frame(image=ct, segmentation=seg, mode="CT")], | ||
| to="snapshot.png", | ||
| ) | ||
| ``` |
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 @@ | ||
| --8<-- "TPTBox/spine/spinestats/README.md" |
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,90 @@ | ||
| # Stitching (`TPTBox.stitching`) | ||
|
|
||
| Merges multiple NIfTI images that are already aligned in global space into a single volume. | ||
| Useful for whole-body or long-spine multi-station acquisitions. | ||
| You can verify alignment by opening the images in ITKSnap with "open additional image." | ||
|
|
||
| ## API | ||
|
|
||
| | Function | Description | | ||
| |---|---| | ||
| | `stitching(nii_list, out, ...)` | Stitch a list of `NII` objects; returns `(result_nii, ramp_nii)` | | ||
| | `stitching_raw(paths, out, ...)` | Stitch from file paths directly | | ||
| | `GNC_stitch_T2w(nii_list, ...)` | GNC-based stitching optimised for T2w spine MRI | | ||
|
|
||
|  | ||
|
|
||
|
|
||
| ### Standalone | ||
| This script can be run directly from the console. Copy 'stiching.py' and install the necessary package. | ||
|
|
||
| ``` | ||
| stitching.py | ||
| [-h] print the help message | ||
| [-i IMAGES [IMAGES ...]] a list of input image paths | ||
| [-o OUTPUT] The output image path | ||
| [-v] verbose - if set, there will be more printouts. | ||
| [-min_value MIN_VALUE] New pixels not present will get this value. Recommended 0 for MRI and for CT -1024 or the known min-value. | ||
| [-seg] This flag is required if you merge segmentation Niftis. | ||
| Switches: | ||
| [-no_bias] If set: Do not use n4_bias_field_correction. It speeds up the process, but n4_bias_field_correction helps in roughly aligning the histogram. | ||
| [-bias_crop] crop empty spaces by the bias field mask. | ||
| [-crop] crop empty space away | ||
| [-sr] Store the ramp and stitching of the images in a 4d nii.gz | ||
| Optional: | ||
| [-hists] Use histogram matching to put the images in the roughly same histogram. The previous image is used when hist_n is not set. | ||
| [-hist_n HISTOGRAM_NAME] path to an image that should be used for histogram matching | ||
| [-ramp_e RAMP_EDGE_MIN_VALUE] The ramp is only considering values above this minimum value | ||
| [-ms MIN_SPACING] Set the minimum Spacing (in mm) | ||
| [-dtype DTYPE] Force a dtype | ||
| ``` | ||
|
|
||
| Example: | ||
|
|
||
| Given the image a.nii.gz,b.nii.gz,c.nii.gz and the segmentations a_msk.nii.gz,b_msk.nii.gz,c_msk.nii.gz. The images can be merged with: | ||
|
|
||
| ```bash | ||
| stitching.py -i a.nii.gz b.nii.gz c.nii.gz -o out.nii.gz | ||
| stitching.py -i a_msk.nii.gz b_msk.nii.gz c_msk.nii.gz -o out_msk.nii.gz -seg | ||
| ``` | ||
|
|
||
| ### Install as a package | ||
|
|
||
| Install on Python 3.10 or higher | ||
| ```bash | ||
| pip install TPTBox | ||
| ``` | ||
|
|
||
| ```python | ||
| from TPTBox import NII | ||
| from TPTBox.stitching import stitching | ||
| out_nii,_ = stitching([NII.load("a.nii.gz",seg=False), NII.load("b.nii.gz",seg=False), NII.load("c.nii.gz",seg=False)], out="out.nii.gz") | ||
|
|
||
| ``` | ||
|
|
||
| or | ||
|
|
||
|
|
||
| ```python | ||
| from TPTBox.stitching import stitching_raw | ||
| stitching_raw(["a.nii.gz", "b.nii.gz", "c.nii.gz"], "out.nii.gz", is_segmentation=False) | ||
| ``` | ||
|
|
||
|
|
||
| ### Cite | ||
| ``` | ||
| Graf, R., Platzek, PS., Riedel, E.O. et al. Generating synthetic high-resolution spinal STIR and T1w images from T2w FSE and low-resolution axial Dixon. Eur Radiol (2024). https://doi.org/10.1007/s00330-024-11047-1 | ||
|
|
||
| ``` | ||
|
|
||
| ``` | ||
| @article{graf2024generating, | ||
| title={Generating synthetic high-resolution spinal STIR and T1w images from T2w FSE and low-resolution axial Dixon}, | ||
| author={Graf, Robert and Platzek, Paul-S{\"o}ren and Riedel, Evamaria Olga and Kim, Su Hwan and Lenhart, Nicolas and Ramsch{\"u}tz, Constanze and Paprottka, Karolin Johanna and Kertels, Olivia Ruriko and M{\"o}ller, Hendrik Kristian and Atad, Matan and others}, | ||
| journal={European Radiology}, | ||
| pages={1--11}, | ||
| year={2024}, | ||
| publisher={Springer} | ||
| } | ||
|
|
||
| ``` | ||
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.