graymatter

S e g m e n t a t i o n o f g r a y m a t t e r a g n o s t i c t o M R I c o n t r a s t s a n d r e g i o n s Segmentation of gray matter agnostic to MRI contrasts and regions

T h i s m o d e l f o r s p i n a l c o r d g r a y m a t t e r ( G M ) s e g m e n t a t i o n u s e s a 2 D n n U - N e t a r c h i t e c t u r e . I t o u t p u t s a b i n a r y s e g m e n t a t i o n . T h e m o d e l w a s t r a i n e d a n d t e s t e d o n d a t a s e t s i n c l u d i n g > 2 0 s i t e s , 3 m a g n e t i c f i e l d s t r e n g t h s , 9 s e q u e n c e s , 1 3 6 7 s u b j e c t s i n c l u d e d : 1 . 5 T - P D w ( N = 8 ) , 3 T - M G E - T 2 s t a r w ( N = 5 0 9 ) , 3 T - M T R ( N = 2 1 ) , 3 T - P D w ( N = 1 4 5 ) , 3 T - P S I R ( N = 1 7 6 ) , 3 T - r A M I R A ( N = 4 8 ) , 3 T - T S E - T 1 w ( N = 6 4 ) , 7 T - M G E - T 2 s t a r w ( N = 8 9 ) , 7 T - M P 2 R A G E - T 1 m a p ( N = 1 4 4 ) , 7 T - M P 2 R A G E - U N I ( N = 1 4 4 ) , 7 T - Q S M ( N = 1 4 ) , 7 T - S W I ( N = 5 ) , a c q u i r e d i n t h e c e r v i c a l , t h o r a c i c a n d l u m b a r r e g i o n s f r o m h e a l t h y c o n t r o l s , p e d i a t r i c s , m u l t i p l e s c l e r o s i s , s p i n a l m u s c u l a r a t r o p h y , c e r v i c a l d e g e n e r a t i v e m y e l o p a t h y , s p i n a l c o r d i n j u r y , a m y o t r o p h i c l a t e r a l s c l e r o s i s p o s t - p o l i o s y n d r o m e a n d s t r o k e . This model for spinal cord gray matter (GM) segmentation uses a 2D nnU-Net architecture. It outputs a binary segmentation. The model was trained and tested on datasets including >20 sites, 3 magnetic field strengths, 9 sequences, 1367 subjects included: 1.5T-PDw(N = 8), 3T-MGE-T2starw(N = 509), 3T-MTR(N = 21), 3T-PDw(N = 145), 3T-PSIR(N = 176), 3T-rAMIRA(N = 48), 3T-TSE-T1w(N = 64), 7T-MGE-T2starw(N = 89), 7T-MP2RAGE-T1map(N = 144), 7T-MP2RAGE-UNI(N = 144), 7T-QSM(N = 14), 7T-SWI(N = 5), acquired in the cervical, thoracic and lumbar regions from healthy controls, pediatrics, multiple sclerosis, spinal muscular atrophy, cervical degenerative myelopathy, spinal cord injury, amyotrophic lateral sclerosis post-polio syndrome and stroke.

Reference

P r o j e c t U R L : [ h t t p s : / / g i t h u b . c o m / i v a d o m e d / m o d e l - g m - c o n t r a s t - r e g i o n - a g n o s t i c ] ( h t t p s : / / g i t h u b . c o m / i v a d o m e d / m o d e l - g m - c o n t r a s t - r e g i o n - a g n o s t i c ) Project URL: https://github.com/ivadomed/model-gm-contrast-region-agnostic

usage: sct_deepseg graymatter [-i <file> [<file> ...]] [-o <str>] [-install]
                              [-custom-url CUSTOM_URL [CUSTOM_URL ...]]
                              [-largest {0,1}] [-fill-holes {0,1}]
                              [-remove-small REMOVE_SMALL [REMOVE_SMALL ...]]
                              [-qc <folder>] [-qc-dataset <str>]
                              [-qc-subject <str>] [-qc-plane <str>]
                              [-qc-seg <file>] [-h] [-v <int>] [-r {0,1}]
                              [-test-time-aug]

INPUT/OUTPUT

-i

I m a g e f i l e n a m e ( s ) t o s e g m e n t . I f s e g m e n t i n g m u l t i p l e f i l e s , s e p a r a t e f i l e n a m e s w i t h a s p a c e . Image filename(s) to segment. If segmenting multiple files, separate filenames with a space.

-o

O u t p u t f i l e n a m e . T h e c h o s e n f i l e n a m e w i l l b e u s e d a s a b a s e n a m e , a n d m o d e l - s p e c i f i c s u f f i x e s w i l l b e a d d e d t o t h e e n d d e p e n d i n g o n t h e t y p e o f o u t p u t ( e . g . ‘ _ c o r d . n i i . g z ‘ , ‘ _ g m . n i i . g z ‘ , e t c . ) . Output file name. The chosen filename will be used as a base name, and model-specific suffixes will be added to the end depending on the type of output (e.g. ‘_cord.nii.gz’, ‘_gm.nii.gz’, etc.).

TASKS

-install

I n s t a l l m o d e l s t h a t a r e r e q u i r e d f o r s p e c i f i e d t a s k . Install models that are required for specified task.

D e f a u l t : ` ` F a l s e ` ` Default: False

-custom-url

U R L ( s ) p o i n t i n g t o t h e ` . z i p ` a s s e t f o r a m o d e l r e l e a s e . T h i s o p t i o n c a n b e u s e d w i t h ` - i n s t a l l ` t o i n s t a l l a s p e c i f i c v e r s i o n o f a m o d e l . T o u s e t h i s o p t i o n , n a v i g a t e t o t h e ‘ R e l e a s e s ‘ p a g e o f t h e m o d e l , f i n d r e l e a s e y o u w i s h t o i n s t a l l , a n d r i g h t - c l i c k + c o p y t h e U R L o f t h e ` . z i p ` l i s t e d u n d e r ‘ A s s e t s ‘ . E x a m p l e : ` s c t _ d e e p s e g g r a y m a t t e r - i n s t a l l - c u s t o m - u r l C U S T O M _ U R L ` ` s c t _ d e e p s e g g r a y m a t t e r - i t 2 . n i i . g z ` URL(s) pointing to the .zip asset for a model release. This option can be used with -install to install a specific version of a model. To use this option, navigate to the ‘Releases’ page of the model, find release you wish to install, and right-click + copy the URL of the .zip listed under ‘Assets’. Example: sct_deepseg graymatter -install -custom-url CUSTOM_URL sct_deepseg graymatter -i t2.nii.gz

PARAMETERS

-largest

P o s s i b l e c h o i c e s : 0 , 1 Possible choices: 0, 1

K e e p t h e l a r g e s t c o n n e c t e d o b j e c t f r o m e a c h o u t p u t s e g m e n t a t i o n ; i f n o t s e t , a l l o b j e c t s a r e k e p t . Keep the largest connected object from each output segmentation; if not set, all objects are kept.

D e f a u l t : ` ` 0 ` ` Default: 0

-fill-holes

P o s s i b l e c h o i c e s : 0 , 1 Possible choices: 0, 1

I f s e t , s m a l l h o l e s i n t h e s e g m e n t a t i o n w i l l b e f i l l e d i n a u t o m a t i c a l l y . If set, small holes in the segmentation will be filled in automatically.

D e f a u l t : ` ` 0 ` ` Default: 0

-remove-small

M i n i m a l o b j e c t s i z e t o k e e p w i t h u n i t ( m m 3 o r v o x ) . A s i n g l e v a l u e c a n b e p r o v i d e d o r o n e v a l u e p e r p r e d i c t i o n c l a s s . S i n g l e v a l u e e x a m p l e : 1 m m 3 , 5 v o x . M u l t i p l e v a l u e s e x a m p l e : 1 0 2 0 1 0 v o x ( r e m o v e o b j e c t s s m a l l e r t h a n 1 0 v o x e l s f o r c l a s s 1 a n d 3 , a n d s m a l l e r t h a n 2 0 v o x e l s f o r c l a s s 2 ) . Minimal object size to keep with unit (mm3 or vox). A single value can be provided or one value per prediction class. Single value example: 1mm3, 5vox. Multiple values example: 10 20 10vox (remove objects smaller than 10 voxels for class 1 and 3, and smaller than 20 voxels for class 2).

-test-time-aug

P e r f o r m t e s t - t i m e a u g m e n t a t i o n ( T T A ) b y f l i p p i n g t h e i n p u t i m a g e a l o n g a l l a x e s a n d a v e r a g i n g t h e r e s u l t i n g p r e d i c t i o n s . N o t e : T h e t i m e i t t a k e s t o r u n t h e m o d e l w i l l i n c r e a s e d u e t o t h e a d d i t i o n a l p r e d i c t i o n s . Perform test-time augmentation (TTA) by flipping the input image along all axes and averaging the resulting predictions. Note: The time it takes to run the model will increase due to the additional predictions.

D e f a u l t : ` ` F a l s e ` ` Default: False

MISC ARGUMENTS

-qc

T h e p a t h w h e r e t h e q u a l i t y c o n t r o l g e n e r a t e d c o n t e n t w i l l b e s a v e d . The path where the quality control generated content will be saved.

-qc-dataset

I f p r o v i d e d , t h i s s t r i n g w i l l b e m e n t i o n e d i n t h e Q C r e p o r t a s t h e d a t a s e t t h e p r o c e s s w a s r u n o n . If provided, this string will be mentioned in the QC report as the dataset the process was run on.

-qc-subject

I f p r o v i d e d , t h i s s t r i n g w i l l b e m e n t i o n e d i n t h e Q C r e p o r t a s t h e s u b j e c t t h e p r o c e s s w a s r u n o n . If provided, this string will be mentioned in the QC report as the subject the process was run on.

-qc-plane

P o s s i b l e c h o i c e s : A x i a l , S a g i t t a l Possible choices: Axial, Sagittal

P l a n e o f t h e o u t p u t Q C . I f S a g i t t a l , i t i s h i g h l y r e c o m m e n d e d t o p r o v i d e t h e ` - q c - s e g ` o p t i o n , a s i t w i l l e n s u r e t h e o u t p u t Q C i s c r o p p e d t o a r e a s o n a b l e f i e l d o f v i e w . Plane of the output QC. If Sagittal, it is highly recommended to provide the -qc-seg option, as it will ensure the output QC is cropped to a reasonable field of view.

D e f a u l t : ` ` ‘ A x i a l ‘ ` ` Default: 'Axial'

-qc-seg

S e g m e n t a t i o n f i l e t o u s e f o r c r o p p i n g t h e Q C . T h i s o p t i o n i s u s e f u l w h e n y o u w a n t t o Q C a r e g i o n t h a t i s d i f f e r e n t f r o m t h e o u t p u t s e g m e n t a t i o n . F o r e x a m p l e , i t m i g h t b e u s e f u l t o p r o v i d e a d i l a t e d c o r d s e g m e n t a t i o n t o e x p a n d t h e Q C f i e l d o f v i e w . Segmentation file to use for cropping the QC. This option is useful when you want to QC a region that is different from the output segmentation. For example, it might be useful to provide a dilated cord segmentation to expand the QC field of view.

I f ` - q c - s e g ` i s n o t p r o v i d e d , t h e d e f a u l t b e h a v i o r w i l l d e p e n d o n t h e v a l u e o f ` - q c - p l a n e ` : If -qc-seg is not provided, the default behavior will depend on the value of -qc-plane:

  • ‘ A x i a l ‘ : W i t h o u t ‘ - q c - s e g ‘ , a s e n s i b l e c r o p r a d i u s b e t w e e n 1 5 - 4 0 v o x w i l l b e a u t o m a t i c a l l y u s e d , d e p e n d i n g o n t h e r e s o l u t i o n a n d s e g m e n t a t i o n t y p e . ‘Axial’: Without ‘-qc-seg’, a sensible crop radius between 15-40 vox will be automatically used, depending on the resolution and segmentation type.

  • ‘ S a g i t t a l ‘ : W i t h o u t ‘ - q c - s e g ‘ , t h e f u l l i m a g e w i l l b e d i s p l a y e d b y d e f a u l t . ( F o r v e r y l a r g e i m a g e s , t h i s m a y c a u s e a c r a s h , s o u s i n g ` - q c - s e g ` i s h i g h l y r e c o m m e n d e d . ) ‘Sagittal’: Without ‘-qc-seg’, the full image will be displayed by default. (For very large images, this may cause a crash, so using -qc-seg is highly recommended.)

-v

P o s s i b l e c h o i c e s : 0 , 1 , 2 Possible choices: 0, 1, 2

V e r b o s i t y . 0 : D i s p l a y o n l y e r r o r s / w a r n i n g s , 1 : E r r o r s / w a r n i n g s + i n f o m e s s a g e s , 2 : D e b u g m o d e . Verbosity. 0: Display only errors/warnings, 1: Errors/warnings + info messages, 2: Debug mode.

D e f a u l t : ` ` 1 ` ` Default: 1

-r

P o s s i b l e c h o i c e s : 0 , 1 Possible choices: 0, 1

R e m o v e t e m p o r a r y f i l e s . Remove temporary files.

D e f a u l t : ` ` 1 ` ` Default: 1