Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
181 commits
Select commit Hold shift + click to select a range
972fbc7
add image script
NathanMolinier Jul 8, 2025
0cf3171
init measure seg script
NathanMolinier Jul 8, 2025
e531580
extract foramen area
NathanMolinier Jul 8, 2025
f6d08f4
update comments
NathanMolinier Jul 8, 2025
49fbcfc
add png
NathanMolinier Jul 9, 2025
82b865b
add mapping totalspineseg
NathanMolinier Jul 9, 2025
24a44cd
add resolution measure_disc
NathanMolinier Jul 9, 2025
a305c66
add missing functions + debug
NathanMolinier Jul 11, 2025
145981f
init measure script
NathanMolinier Jul 11, 2025
6ab9c1c
add csv
NathanMolinier Jul 11, 2025
9298b59
update canal metrics
NathanMolinier Aug 6, 2025
9b227bb
add area
NathanMolinier Aug 6, 2025
eb9c70e
convert diameters to mm
NathanMolinier Aug 6, 2025
9df1765
fetch disc SI signal
NathanMolinier Aug 7, 2025
81fcc14
fetch csf signal
NathanMolinier Aug 7, 2025
66fe2e0
use arry instead of Image class
NathanMolinier Aug 11, 2025
003b9a2
update arguments and reorganize
NathanMolinier Aug 11, 2025
64784b9
add function to measure vertebrae
NathanMolinier Aug 11, 2025
e67d3a4
fix function use
NathanMolinier Aug 11, 2025
5304a1f
add function to save 3d isometric views
NathanMolinier Aug 11, 2025
5fba539
add function to crop around binary volumes
NathanMolinier Aug 11, 2025
627b3b0
add missing import
NathanMolinier Aug 11, 2025
8a8281e
remove cropping
NathanMolinier Aug 11, 2025
7b8300b
output volumes for vizualization
NathanMolinier Aug 11, 2025
b2cd345
save csv and images
NathanMolinier Aug 12, 2025
ee0af64
save vertebrae and foramen image
NathanMolinier Aug 12, 2025
a057f2d
rotate vertebrae to help visualization
NathanMolinier Aug 12, 2025
e1beda9
remove rotation
NathanMolinier Aug 12, 2025
0fc755d
fix variable name
NathanMolinier Aug 12, 2025
2dc681d
fix loop and mapping
NathanMolinier Aug 12, 2025
f81c9db
remove empty lines
NathanMolinier Aug 12, 2025
be6c9f2
increase smoothing
NathanMolinier Aug 12, 2025
b9c27a1
fix variable name issue
NathanMolinier Aug 12, 2025
2db7740
extract csf signal intensity
NathanMolinier Aug 12, 2025
936bce4
fix key error
NathanMolinier Aug 13, 2025
193177d
add missing imports
NathanMolinier Aug 13, 2025
deb5673
init generate report script
NathanMolinier Aug 13, 2025
c73f6a2
add init
NathanMolinier Aug 13, 2025
49ac76c
fix script
NathanMolinier Aug 13, 2025
5960f46
remove rotation
NathanMolinier Aug 13, 2025
e99393a
update arguments
NathanMolinier Aug 13, 2025
f980192
rotate vertebrae for visualization
NathanMolinier Aug 13, 2025
5df094f
extract disc image
NathanMolinier Aug 14, 2025
8f19f11
compute median thickness and mean intensity profile
NathanMolinier Aug 14, 2025
1d4bbd3
extract disc image
NathanMolinier Aug 14, 2025
2b3bf50
create plots canal and csf
NathanMolinier Aug 14, 2025
770c599
remove rotation
NathanMolinier Aug 19, 2025
283a4bd
fetch eccentricity and solidity discs
NathanMolinier Aug 19, 2025
3eec1a7
extract median_thickness and intensity_profile
NathanMolinier Aug 19, 2025
1b47668
fix folder use
NathanMolinier Aug 19, 2025
083e560
regroup canal and csf metrics calculation
NathanMolinier Aug 19, 2025
6459137
plot intensity profile
NathanMolinier Aug 19, 2025
92e69b2
save subject dictionary
NathanMolinier Aug 19, 2025
16a0beb
create global figures
NathanMolinier Aug 19, 2025
170c610
compute disc eccentricity in RL-AP plane
NathanMolinier Aug 20, 2025
d3a64d5
return values in mm
NathanMolinier Aug 20, 2025
aad48c8
generate global subplots
NathanMolinier Aug 20, 2025
58248dc
add metrics images
NathanMolinier Aug 20, 2025
cd3abf6
add name to images
NathanMolinier Aug 20, 2025
538a614
rename images
NathanMolinier Aug 20, 2025
ed10d1c
add area to title
NathanMolinier Aug 20, 2025
f34a724
crop images
NathanMolinier Aug 20, 2025
ffc4934
create subject subplot for discs, vertebrae and foramens
NathanMolinier Aug 20, 2025
39a8554
highlight plots with lower values than mean
NathanMolinier Aug 21, 2025
81d4281
flip left foramens
NathanMolinier Aug 21, 2025
c86a131
account for subject with different visible structures
NathanMolinier Aug 21, 2025
43b3dc8
swap left and right foramen
NathanMolinier Aug 21, 2025
5550f99
remove -1 from values
NathanMolinier Aug 21, 2025
fbabb39
remove unused sys
NathanMolinier Aug 21, 2025
67ee12d
allow verbose false resampling
NathanMolinier Aug 22, 2025
c47e23c
rename output image folder
NathanMolinier Aug 22, 2025
0d8c220
remove resampling warning
NathanMolinier Aug 22, 2025
bd79489
create spine centerline with discs and vertebral bodies
NathanMolinier Aug 22, 2025
2872f0d
disociate centerline creation and canal metrics computation
NathanMolinier Aug 22, 2025
b3cffdb
use spine centerline for canal metrics
NathanMolinier Aug 22, 2025
96c12b4
use discs labels to scale canal
NathanMolinier Aug 22, 2025
d5e72ec
fertch both canal and spinalcord properties
NathanMolinier Aug 22, 2025
9e71b2e
deal with single slice discs
NathanMolinier Aug 22, 2025
a3db7e7
zoom in pyvista plot
NathanMolinier Aug 22, 2025
12636bc
update function use
NathanMolinier Aug 22, 2025
91d082e
deal with null diameters
NathanMolinier Aug 22, 2025
c6aa05d
fix bug with spinalcord
NathanMolinier Aug 22, 2025
169b7a1
fix eccentricity calculation
NathanMolinier Aug 22, 2025
e65a03b
move all_values out of create_global_figures
NathanMolinier Aug 22, 2025
1fccf33
remove plot creation and create canal and csf dict
NathanMolinier Aug 22, 2025
aa7534d
update image folder name
NathanMolinier Aug 22, 2025
a9d665b
add test group and control group
NathanMolinier Aug 26, 2025
9497ef7
extract metrics control group
NathanMolinier Aug 26, 2025
58a886f
align slices
NathanMolinier Aug 26, 2025
b7bda00
calculate averages
NathanMolinier Aug 26, 2025
b9d7d91
load test subject and interpolate slices
NathanMolinier Aug 26, 2025
9d46816
reorganize canal and csf dict
NathanMolinier Aug 26, 2025
0a487a1
change testing parameters
NathanMolinier Aug 26, 2025
7f53ed9
plot canal and csf
NathanMolinier Aug 26, 2025
3947b40
add disc levels mapping
NathanMolinier Aug 26, 2025
33decfc
avoid empty lists
NathanMolinier Aug 26, 2025
8cc92f7
use dataframe
NathanMolinier Aug 26, 2025
98423e6
use discs levels
NathanMolinier Aug 26, 2025
d7d90ac
remove metrics
NathanMolinier Aug 26, 2025
69fb85a
fix dataframe usage
NathanMolinier Aug 26, 2025
3cef65d
add quotient spinalcord/canal
NathanMolinier Aug 26, 2025
95c1f10
fix vertebrae label displayed
NathanMolinier Aug 26, 2025
f431ad1
rename functions
NathanMolinier Aug 26, 2025
3d5701f
extract 2d disc image
NathanMolinier Aug 27, 2025
7144993
fix min and max canal
NathanMolinier Aug 27, 2025
3a8ac49
normalize images
NathanMolinier Aug 27, 2025
3b59f62
extract most represented values for csf signal
NathanMolinier Aug 27, 2025
2dd7e8b
extract median intensity
NathanMolinier Aug 27, 2025
1f764d1
normalize discs intensities
NathanMolinier Aug 27, 2025
3be44be
rename file
NathanMolinier Aug 27, 2025
964aa53
show intensity and image disc only
NathanMolinier Aug 27, 2025
6c85362
rescale disc image
NathanMolinier Aug 27, 2025
18b23d5
rescale image intensity with percentile
NathanMolinier Aug 27, 2025
a69baee
normalize image instead of patch
NathanMolinier Aug 28, 2025
ea30566
fix dict creation to avoid empty dict
NathanMolinier Aug 28, 2025
4a4d14e
rename compute to process
NathanMolinier Aug 28, 2025
88244f8
compute disc height index
NathanMolinier Aug 28, 2025
2cf2c74
ensure struc_names are in both subject and all_values
NathanMolinier Aug 28, 2025
93ac340
normalize image values
NathanMolinier Aug 28, 2025
af93139
fix convert_str_to_list
NathanMolinier Aug 29, 2025
c178421
normalize image distribution
NathanMolinier Aug 29, 2025
7b0cbf9
incorporate multiprocessing
NathanMolinier Aug 29, 2025
ac5f616
fix case where vertebrae is not present
NathanMolinier Aug 29, 2025
075e44f
add progress bar
NathanMolinier Aug 29, 2025
445aa74
use median instead of mean
NathanMolinier Aug 29, 2025
0ec2f04
update print
NathanMolinier Aug 29, 2025
3ea57a0
use median gap
NathanMolinier Aug 29, 2025
24cdfa8
add new functions
NathanMolinier Aug 29, 2025
9285497
update dependencies
NathanMolinier Aug 29, 2025
73b5765
output vertebrae image
NathanMolinier Sep 2, 2025
cefdb31
adjust centerline to split L5 body
NathanMolinier Sep 3, 2025
a38f9e3
pad disc min and max to reduce edges effect
NathanMolinier Sep 3, 2025
419b5cf
save intensity histogram
NathanMolinier Sep 3, 2025
2bc2005
crop around vertebral body
NathanMolinier Sep 3, 2025
06660ad
fix dict name intensity
NathanMolinier Sep 3, 2025
8a6366c
use mean vertebra vector
NathanMolinier Sep 3, 2025
776fd1d
plot intensity distribution
NathanMolinier Sep 3, 2025
65b47c9
normalize metrics and compute foramen assymetry
NathanMolinier Sep 3, 2025
4ec141d
move histogram outside of compute_thickness_profile
NathanMolinier Sep 3, 2025
06d35df
remove vertebrae intensity
NathanMolinier Sep 4, 2025
6e2cc9d
check if vertebrae exist for foramen
NathanMolinier Sep 10, 2025
2d2c66e
use else
NathanMolinier Sep 10, 2025
eded2c4
use both median and std to analyze value
NathanMolinier Sep 10, 2025
6cae75c
exclude structure touching the image border
NathanMolinier Sep 25, 2025
410e075
overlay segmentation in 2d for seg image
NathanMolinier Sep 25, 2025
7e8626b
quick fix
NathanMolinier Sep 25, 2025
185a424
save 2d view of segmentation
NathanMolinier Sep 25, 2025
3022a7b
save only 2d views
NathanMolinier Sep 25, 2025
378ecc3
rotate seg
NathanMolinier Sep 25, 2025
054c914
use spine_centerline deriv to measure disc thickness
NathanMolinier Sep 26, 2025
afd699c
use canal centerline
NathanMolinier Sep 26, 2025
1988cad
fix coords problem
NathanMolinier Sep 26, 2025
72fd837
take maximum intensity in the canal
NathanMolinier Sep 26, 2025
f315ab2
extract 90th percentile for csf
NathanMolinier Sep 26, 2025
c4099b7
move discs back to beginning
NathanMolinier Sep 26, 2025
3e2612f
use gaussian mixture models to extract intensity peaks
NathanMolinier Sep 26, 2025
2006677
center disc thickness extraction far from edges
NathanMolinier Sep 26, 2025
cb7ea31
remove print and warning
NathanMolinier Sep 26, 2025
14e5a75
use percentile 95
NathanMolinier Sep 26, 2025
d46798f
use most represented values
NathanMolinier Oct 7, 2025
96160b0
handle IndexError and check metrics[struc] size
NathanMolinier Oct 7, 2025
faafcdc
add index error
NathanMolinier Oct 8, 2025
e5e5be1
update csf signal extraction
NathanMolinier Oct 9, 2025
85ac685
find intensity peak in the inner and outer layer of the disc
NathanMolinier Oct 9, 2025
458c0d5
try to account for signal loss
NathanMolinier Oct 10, 2025
84e4425
try to estimate ap signal variations
NathanMolinier Oct 10, 2025
369b1b6
add n4_bias_field_correction
NathanMolinier Oct 15, 2025
60444b3
normalize with csf intensity
NathanMolinier Oct 16, 2025
08c9b19
extract intensity from 2d slice and smooth
NathanMolinier Oct 16, 2025
cbd20eb
generate report using demographics
NathanMolinier Oct 17, 2025
f37b359
incorporate disc grading
NathanMolinier Oct 17, 2025
fba5933
remove normalisations
NathanMolinier Oct 17, 2025
94110cf
update figure size
NathanMolinier Oct 20, 2025
caeabd5
rename assymetry
NathanMolinier Oct 20, 2025
573ac2d
Update images and add canal images
NathanMolinier Oct 20, 2025
cf6e52c
use metrics_dict to select displayed metrics
NathanMolinier Oct 20, 2025
81d0936
fix image aspect ratio
NathanMolinier Oct 20, 2025
1edbe06
Merge remote-tracking branch 'refs/remotes/origin/nm/calculate_metric…
NathanMolinier Oct 20, 2025
71cc18a
fix image aspect ratio
NathanMolinier Oct 20, 2025
2686a0f
fix text size
NathanMolinier Oct 20, 2025
0e8d808
fix figure size
NathanMolinier Oct 20, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -176,3 +176,7 @@ cython_debug/

# Extra files
/totalspineseg/models/nnUNet

# More
*.png
*.csv
10 changes: 4 additions & 6 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -34,19 +34,15 @@ keywords = [
]
dependencies = [
"tqdm",
"numpy<2",
"numpy",
"nibabel",
"gryds",
"torchio",
"scipy",
"pillow",
"nilearn",
"SimpleITK",
# We use nnunetv2==2.4.2 for nnUNetTrainer_DASegOrd0_NoMirroring
# https://github.com/MIC-DKFZ/nnUNet/issues/2480
# --verify_dataset_integrity not working in nnunetv2==2.4.2 do we need to update this when fixed
# https://github.com/MIC-DKFZ/nnUNet/issues/2144
"nnunetv2<=2.4.2",
"nnunetv2",
"psutil",
]

Expand Down Expand Up @@ -76,6 +72,8 @@ totalspineseg_extract_levels = "totalspineseg.utils.extract_levels:main"
totalspineseg_extract_alternate = "totalspineseg.utils.extract_alternate:main"
totalspineseg_install_weights = "totalspineseg.utils.install_weights:main"
totalspineseg_predict_nnunet = "totalspineseg.utils.predict_nnunet:main"
totalspineseg_measure_seg = "totalspineseg.utils.measure_seg:main"
totalspineseg_generate_reports = "totalspineseg.utils.generate_reports:main"

[build-system]
requires = ["pip>=23", "setuptools>=67"]
Expand Down
Empty file.
Binary file added totalspineseg/resources/imgs/.DS_Store
Binary file not shown.
Binary file added totalspineseg/resources/imgs/canal_area.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added totalspineseg/resources/imgs/discs_DHI.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added totalspineseg/resources/imgs/discs_solidity.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added totalspineseg/resources/imgs/discs_volume.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added totalspineseg/resources/imgs/vertebrae_volume.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
27 changes: 27 additions & 0 deletions totalspineseg/resources/labels_maps/levels_maps.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
"C1":1,
"C1-C2":2,
"C2-C3":3,
"C3-C4":4,
"C4-C5":5,
"C5-C6":6,
"C6-C7":7,
"C7-T1":8,
"T1-T2":9,
"T2-T3":10,
"T3-T4":11,
"T4-T5":12,
"T5-T6":13,
"T6-T7":14,
"T7-T8":15,
"T8-T9":16,
"T9-T10":17,
"T10-T11":18,
"T11-T12":19,
"T12-L1":20,
"L1-L2":21,
"L2-L3":22,
"L3-L4":23,
"L4-L5":24,
"L5-S":25
}
54 changes: 54 additions & 0 deletions totalspineseg/resources/labels_maps/tss_map.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
{
"SC":1,
"CSF":2,
"C1":11,
"C2":12,
"C3":13,
"C4":14,
"C5":15,
"C6":16,
"C7":17,
"T1":21,
"T2":22,
"T3":23,
"T4":24,
"T5":25,
"T6":26,
"T7":27,
"T8":28,
"T9":29,
"T10":30,
"T11":31,
"T12":32,
"L1":41,
"L2":42,
"L3":43,
"L4":44,
"L5":45,
"L6":46,
"L7":47,
"sacrum":50,
"C2-C3":63,
"C3-C4":64,
"C4-C5":65,
"C5-C6":66,
"C6-C7":67,
"C7-T1":71,
"T1-T2":72,
"T2-T3":73,
"T3-T4":74,
"T4-T5":75,
"T5-T6":76,
"T6-T7":77,
"T7-T8":78,
"T8-T9":79,
"T9-T10":80,
"T10-T11":81,
"T11-T12":82,
"T12-L1":91,
"L1-L2":92,
"L2-L3":93,
"L3-L4":94,
"L4-L5":95,
"L5-S":100
}
Loading