canal

S e g m e n t a t i o n o f s p i n a l c a n a l o n a l l c o n t r a s t s Segmentation of spinal canal on all contrasts

T h i s m o d e l s e g m e n t s t h e s p i n a l c a n a l , o r i n a n a n a t o m i c d e f i n i t i o n t h e d u r a l s a c , o n a l l c o n t r a s t s . U s e s a 3 D U - N e t , t r a i n e d w i t h t h e n n U N e t V 2 f r a m e w o r k . I t i s a s i n g l e - c l a s s m o d e l o u t p u t t i n g t h e b i n a r y c a n a l s e g m e n t a t i o n . T r a i n i n g c o n s i s t e d o f a n a c t i v e l e a r n i n g p r o c e d u r e , c o r r e c t i n g s e g m e n t a t i o n s w i t h I T K S n a p . L a s t t r a i n i n g p r o c e d u r e c a n b e f o u n d h e r e : 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 - c a n a l - s e g / i s s u e s / 2 0 I m a g e s u s e d p r e s e n t d i f f e r e n t r e s o l u t i o n s , F O V , a n d p a t h o l o g i e s . A s c r i p t i s a d d e d a s p o s t - p r o c e s s i n g t o k e e p t h e l a r g e s t c o n n e c t e d c o m p o n e n t o f t h e s e g m e n t a t i o n , s i n c e s p i n a l c a n a l i s c o n n e c t e d , t o a v o i d f a l s e p o s i t i v e s s e g m e n t a t i o n s o f o t h e r a n a t o m i c a l s t r u c t u r e s . This model segments the spinal canal, or in an anatomic definition the dural sac, on all contrasts. Uses a 3D U-Net, trained with the nnUNetV2 framework. It is a single-class model outputting the binary canal segmentation. Training consisted of an active learning procedure, correcting segmentations with ITK Snap. Last training procedure can be found here : https://github.com/ivadomed/model-canal-seg/issues/20 Images used present different resolutions, FOV, and pathologies. A script is added as post-processing to keep the largest connected component of the segmentation, since spinal canal is connected, to avoid false positives segmentations of other anatomical structures.

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 - c a n a l - s e g ] ( 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 - c a n a l - s e g ) Project URL: https://github.com/ivadomed/model-canal-seg

usage: sct_deepseg canal [-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 c a n a l - 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 c a n a l - 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 canal -install -custom-url CUSTOM_URL sct_deepseg canal -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