sct_image¶
P e r f o r m m a n i p u l a t i o n s o n i m a g e s ( e . g . , p a d , c h a n g e s p a c e , s p l i t a l o n g d i m e n s i o n ) . I n p u t s c a n b e a n u m b e r , a 4 d i m a g e , o r s e v e r a l 3 d i m a g e s s e p a r a t e d w i t h ` , `
Perform manipulations on images (e.g., pad, change space, split along dimension). Inputs can be a number, a 4d image, or several 3d images separated with ,
usage: sct_image -i <file> [<file> ...] [-o <file>] [-pad <list>]
[-pad-asym <list>] [-split {x,y,z,t}] [-concat {x,y,z,t}]
[-stitch] [-qc <folder>] [-qc-dataset <str>]
[-qc-subject <str>] [-remove-vol <list>] [-keep-vol <list>]
[-type {uint8,int16,int32,float32,complex64,float64,int8,uint16,uint32,int64,uint64}]
[-header [{sct,fslhd,nibabel}]] [-copy-header <file>]
[-set-sform-to-qform | -set-qform-to-sform] [-getorient]
[-setorient {LAS,LAI,LPS,LPI,LSA,LSP,LIA,LIP,RAS,RAI,RPS,RPI,RSA,RSP,RIA,RIP,ALS,ALI,ARS,ARI,ASL,ASR,AIL,AIR,PLS,PLI,PRS,PRI,PSL,PSR,PIL,PIR,SLA,SLP,SRA,SRP,SAL,SAR,SPL,SPR,ILA,ILP,IRA,IRP,IAL,IAR,IPL,IPR}]
[-flip {x,y,z,t}] [-transpose ax1,ax2,ax3] [-mcs] [-omc]
[-display-warp] [-to-fsl [<file> ...]] [-h] [-v <int>]
MANDATORY ARGUMENTS¶
- -i
I n p u t f i l e ( s ) . E x a m p l e : ` d a t a . n i i . g z ` N o t e : O n l y ` - c o n c a t ` , ` - o m c ` o r ` - s t i t c h ` s u p p o r t m u l t i p l e i n p u t f i l e s . I n t h o s e c a s e s , s e p a r a t e f i l e n a m e s u s i n g s p a c e s . E x a m p l e u s a g e : ` s c t _ i m a g e - i d a t a 1 . n i i . g z d a t a 2 . n i i . g z - c o n c a t ` Input file(s). Example:
data.nii.gzNote: Only-concat,-omcor-stitchsupport multiple input files. In those cases, separate filenames using spaces. Example usage:sct_image -i data1.nii.gz data2.nii.gz -concat
OPTIONAL ARGUMENTS¶
- -o
O u t p u t f i l e . E x a m p l e : ` d a t a _ p a d . n i i . g z ` Output file. Example:
data_pad.nii.gz
IMAGE OPERATIONS¶
- -pad
P a d 3 D i m a g e . S p e c i f y p a d d i n g a s : ` x , y , z ` ( i n v o x e l ) . E x a m p l e : ` 0 , 0 , 1 ` Pad 3D image. Specify padding as:
x,y,z(in voxel). Example:0,0,1- -pad-asym
P a d 3 D i m a g e w i t h a s y m m e t r i c p a d d i n g . S p e c i f y p a d d i n g a s : ` x _ i , x _ f , y _ i , y _ f , z _ i , z _ f ` ( i n v o x e l ) . E x a m p l e : ` 0 , 0 , 5 , 1 0 , 1 , 1 ` Pad 3D image with asymmetric padding. Specify padding as:
x_i,x_f,y_i,y_f,z_i,z_f(in voxel). Example:0,0,5,10,1,1- -split
P o s s i b l e c h o i c e s : x , y , z , t Possible choices: x, y, z, t
S p l i t d a t a a l o n g t h e s p e c i f i e d d i m e n s i o n . T h e s u f f i x _ D I M + N U M B E R w i l l b e a d d e d t o t h e i n t p u t f i l e n a m e . Split data along the specified dimension. The suffix _DIM+NUMBER will be added to the intput file name.
- -concat
P o s s i b l e c h o i c e s : x , y , z , t Possible choices: x, y, z, t
C o n c a t e n a t e d a t a a l o n g t h e s p e c i f i e d d i m e n s i o n Concatenate data along the specified dimension
- -stitch
S t i t c h m u l t i p l e i m a g e s a c q u i r e d i n t h e s a m e o r i e n t a t i o n u t i l i z i n g t h e a l g o r i t h m b y L a v d a s , G l o c k e r e t a l . ( h t t p s : / / d o i . o r g / 1 0 . 1 0 1 6 / j . c r a d . 2 0 1 9 . 0 1 . 0 1 2 ) . T h e f i r s t i m a g e i s u s e d a s t h e r e f e r e n c e . E n s u r e t o u s e t h e i m a g e w i t h t h e l a r g e s t d i m e n s i o n s f i r s t t o a v o i d c r o p p i n g o f t h e i m a g e s . Stitch multiple images acquired in the same orientation utilizing the algorithm by Lavdas, Glocker et al. (https://doi.org/10.1016/j.crad.2019.01.012).The first image is used as the reference.Ensure to use the image with the largest dimensions first to avoid cropping of the images.
D e f a u l t : ` ` F a l s e ` ` Default:
False- -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 . ( N o t e : Q C r e p o r t i n g i s o n l y a v a i l a b l e f o r ` s c t _ i m a g e - s t i t c h ` ) . The path where the quality control generated content will be saved. (Note: QC reporting is only available for
sct_image -stitch).- -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 . ( N o t e : Q C r e p o r t i n g i s o n l y a v a i l a b l e f o r ` s c t _ i m a g e - s t i t c h ` ) . If provided, this string will be mentioned in the QC report as the dataset the process was run on. (Note: QC reporting is only available for
sct_image -stitch).- -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 . ( N o t e : Q C r e p o r t i n g i s o n l y a v a i l a b l e f o r ` s c t _ i m a g e - s t i t c h ` ) . If provided, this string will be mentioned in the QC report as the subject the process was run on. (Note: QC reporting is only available for
sct_image -stitch).- -remove-vol
R e m o v e s p e c i f i c v o l u m e s f r o m a 4 d v o l u m e . S e p a r a t e w i t h ` , ` . E x a m p l e : ` 0 , 5 , 1 0 ` Remove specific volumes from a 4d volume. Separate with
,. Example:0,5,10- -keep-vol
K e e p s p e c i f i c v o l u m e s f r o m a 4 d v o l u m e ( r e m o v e o t h e r s ) . S e p a r a t e w i t h ` , ` . E x a m p l e : ` 1 , 2 , 3 , 1 1 ` Keep specific volumes from a 4d volume (remove others). Separate with
,. Example:1,2,3,11- -type
P o s s i b l e c h o i c e s : u i n t 8 , i n t 1 6 , i n t 3 2 , f l o a t 3 2 , c o m p l e x 6 4 , f l o a t 6 4 , i n t 8 , u i n t 1 6 , u i n t 3 2 , i n t 6 4 , u i n t 6 4 Possible choices: uint8, int16, int32, float32, complex64, float64, int8, uint16, uint32, int64, uint64
C h a n g e f i l e t y p e Change file type
HEADER OPERATIONS¶
- -header
P o s s i b l e c h o i c e s : s c t , f s l h d , n i b a b e l Possible choices: sct, fslhd, nibabel
P r i n t t h e h e a d e r o f a N I f T I f i l e . Y o u c a n s e l e c t t h e o u t p u t f o r m a t o f t h e h e a d e r : ‘ s c t ‘ ( d e f a u l t ) , ‘ n i b a b e l ‘ o r ‘ f s l h d ‘ . Print the header of a NIfTI file. You can select the output format of the header: ‘sct’ (default), ‘nibabel’ or ‘fslhd’.
- -copy-header
C o p y t h e N I f T I h e a d e r o f t h e s o u r c e i m a g e ( s p e c i f i e d i n ` - i ` ) t o t h e d e s t i n a t i o n i m a g e ( s p e c i f i e d h e r e ) a n d s a v e i t i n t o a n e w i m a g e ( s p e c i f i e d i n ` - o ` ) . Copy the NIfTI header of the source image (specified in
-i) to the destination image (specified here) and save it into a new image (specified in-o).! ! W A R N I N G : T h i s c o m m a n d s h o u l d O N L Y b e r u n t o f i x a w r o n g h e a d e r ( e . g . , w h e r e t h e q f o r m a n d / o r s f o r m b e t w e e n a n i m a g e a n d a m a s k o f t h e i m a g e d o n o t m a t c h ) . A l s o n o t e t h a t t h e i m a g e i s N O T a f f e c t e d b y t h i s c o m m a n d , s o i f t h e d i m e n s i o n s o f t h e s o u r c e a n d d e s t i n a t i o n i m a g e s d o n o t m a t c h , t h e n y o u s h o u l d p r o b a b l y N O T u s e t h i s c o m m a n d . !! WARNING: This command should ONLY be run to fix a wrong header (e.g., where the qform and/or sform between an image and a mask of the image do not match). Also note that the image is NOT affected by this command, so if the dimensions of the source and destination images do not match, then you should probably NOT use this command.
- -set-sform-to-qform
S e t t h e i n p u t i m a g e ‘ s s f o r m m a t r i x e q u a l t o i t s q f o r m m a t r i x . U s e t h i s o p t i o n w h e n y o u n e e d t o e n f o r c e m a t c h i n g s f o r m a n d q f o r m m a t r i c e s . T h i s o p t i o n c a n b e u s e d b y i t s e l f , o r i n c o m b i n a t i o n w i t h o t h e r f u n c t i o n s . Set the input image’s sform matrix equal to its qform matrix. Use this option when you need to enforce matching sform and qform matrices. This option can be used by itself, or in combination with other functions.
D e f a u l t : ` ` F a l s e ` ` Default:
False- -set-qform-to-sform
S e t t h e i n p u t i m a g e ‘ s q f o r m m a t r i x e q u a l t o i t s s f o r m m a t r i x . U s e t h i s o p t i o n w h e n y o u n e e d t o e n f o r c e m a t c h i n g s f o r m a n d q f o r m m a t r i c e s . T h i s o p t i o n c a n b e u s e d b y i t s e l f , o r i n c o m b i n a t i o n w i t h o t h e r f u n c t i o n s . Set the input image’s qform matrix equal to its sform matrix. Use this option when you need to enforce matching sform and qform matrices. This option can be used by itself, or in combination with other functions.
D e f a u l t : ` ` F a l s e ` ` Default:
False
ORIENTATION OPERATIONS¶
- -getorient
G e t o r i e n t a t i o n o f t h e i n p u t i m a g e Get orientation of the input image
D e f a u l t : ` ` F a l s e ` ` Default:
False- -setorient
P o s s i b l e c h o i c e s : L A S , L A I , L P S , L P I , L S A , L S P , L I A , L I P , R A S , R A I , R P S , R P I , R S A , R S P , R I A , R I P , A L S , A L I , A R S , A R I , A S L , A S R , A I L , A I R , P L S , P L I , P R S , P R I , P S L , P S R , P I L , P I R , S L A , S L P , S R A , S R P , S A L , S A R , S P L , S P R , I L A , I L P , I R A , I R P , I A L , I A R , I P L , I P R Possible choices: LAS, LAI, LPS, LPI, LSA, LSP, LIA, LIP, RAS, RAI, RPS, RPI, RSA, RSP, RIA, RIP, ALS, ALI, ARS, ARI, ASL, ASR, AIL, AIR, PLS, PLI, PRS, PRI, PSL, PSR, PIL, PIR, SLA, SLP, SRA, SRP, SAL, SAR, SPL, SPR, ILA, ILP, IRA, IRP, IAL, IAR, IPL, IPR
S e t o r i e n t a t i o n o f t h e i n p u t i m a g e ( m o d i f i e s B O T H t h e h e a d e r a n d d a t a a r r a y , s i m i l a r t o ` f s l s w a p d i m ` ) . Set orientation of the input image (modifies BOTH the header and data array, similar to
fslswapdim).- -flip
P o s s i b l e c h o i c e s : x , y , z , t Possible choices: x, y, z, t
F l i p a n a x i s o f t h e i m a g e ‘ s d a t a a r r a y . ( T h i s w i l l n o t c h a n g e t h e h e a d e r o r i e n t a t i o n s t r i n g . ) Flip an axis of the image’s data array. (This will not change the header orientation string.)
W A R N I N G : T h i s o p t i o n s h o u l d o n l y b e u s e d t o f i x t h e d a t a a r r a y w h e n i t d o e s n o t m a t c h t h e o r i e n t a t i o n s t r i n g i n t h e h e a d e r . W e r e c o m m e n d t h a t y o u i n v e s t i g a t e a n d u n d e r s t a n d w h e r e t h e m i s m a t c h o r i g i n a t e d f r o m i n t h e f i r s t p l a c e b e f o r e u s i n g t h i s o p t i o n . WARNING: This option should only be used to fix the data array when it does not match the orientation string in the header. We recommend that you investigate and understand where the mismatch originated from in the first place before using this option.
E x a m p l e : F o r a n i m a g e w i t h ‘ R P I ‘ i n i t s h e a d e r , ` - f l i p x ` w i l l f l i p t h e L R a x i s o f t h e d a t a a r r a y . Example: For an image with ‘RPI’ in its header,
-flip xwill flip the LR axis of the data array.
- -transpose
T r a n s p o s e t h e a x e s ( x , y , z ) o f t h e i m a g e ‘ s d a t a a r r a y . ( T h i s w i l l n o t c h a n g e t h e h e a d e r o r i e n t a t i o n s t r i n g . ) Transpose the axes (x,y,z) of the image’s data array. (This will not change the header orientation string.)
W A R N I N G : T h i s o p t i o n s h o u l d o n l y b e u s e d t o f i x t h e d a t a a r r a y w h e n i t d o e s n o t m a t c h t h e o r i e n t a t i o n s t r i n g i n t h e h e a d e r . W e r e c o m m e n d t h a t y o u i n v e s t i g a t e a n d u n d e r s t a n d w h e r e t h e m i s m a t c h o r i g i n a t e d f r o m i n t h e f i r s t p l a c e b e f o r e u s i n g t h i s o p t i o n . WARNING: This option should only be used to fix the data array when it does not match the orientation string in the header. We recommend that you investigate and understand where the mismatch originated from in the first place before using this option.
E x a m p l e : F o r a 3 D i m a g e w i t h ‘ R P I ‘ i n i t s h e a d e r , ` - t r a n s p o s e z , y , x ` w i l l s w a p t h e L R a n d S I a x e s o f t h e d a t a a r r a y . Example: For a 3D image with ‘RPI’ in its header,
-transpose z,y,xwill swap the LR and SI axes of the data array.
MULTI-COMPONENT OPERATIONS ON ITK COMPOSITE WARPING FIELDS¶
- -mcs
M u l t i - c o m p o n e n t s p l i t : S p l i t I T K w a r p i n g f i e l d i n t o t h r e e s e p a r a t e d i s p l a c e m e n t f i e l d s . T h e s u f f i x e s ` _ X ` , ` _ Y ` a n d ` _ Z ` w i l l b e a d d e d t o t h e i n p u t f i l e n a m e . Multi-component split: Split ITK warping field into three separate displacement fields. The suffixes
_X,_Yand_Zwill be added to the input file name.D e f a u l t : ` ` F a l s e ` ` Default:
False- -omc
M u l t i - c o m p o n e n t m e r g e : M e r g e i n p u t t e d i m a g e s i n t o o n e m u l t i - c o m p o n e n t i m a g e . R e q u i r e s s e v e r a l i n p u t s . Multi-component merge: Merge inputted images into one multi-component image. Requires several inputs.
D e f a u l t : ` ` F a l s e ` ` Default:
False
WARPING FIELD OPERATIONS¶
- -display-warp
C r e a t e a g r i d a n d d e f o r m i t u s i n g p r o v i d e d w a r p i n g f i e l d . Create a grid and deform it using provided warping field.
D e f a u l t : ` ` F a l s e ` ` Default:
False- -to-fsl
T r a n s f o r m d i s p l a c e m e n t f i e l d v a l u e s t o a b s o l u t e F S L w a r p s . T o b e u s e d w i t h F S L ‘ s a p p l y w a r p f u n c t i o n w i t h t h e ` - - a b s ` f l a g . I n p u t t h e f i l e t h a t w i l l b e u s e d a s t h e i n p u t ( s o u r c e ) f o r a p p l y w a r p a n d o p t i o n a l l y t h e t a r g e t ( r e f ) . T h e t a r g e t f i l e i s n e c e s s a r y f o r t h e c a s e w h e r e t h e w a r p i s i n a d i f f e r e n t s p a c e t h a n t h e t a r g e t . F o r e x a m p l e , t h e i n v e r s e w a r p s g e n e r a t e d b y ` s c t _ s t r a i g h t e n _ s p i n a l c o r d ` . T h i s f e a t u r e h a s n o t b e e n e x t e n s i v e l y v a l i d a t e d s o c o n s i d e r c h e c k i n g t h e r e s u l t s o f ` a p p l y w a r p ` a g a i n s t ` s c t _ a p p l y _ t r a n s f o ` b e f o r e u s i n g i n F S L p i p e l i n e s . E x a m p l e s y n t a x : ` s c t _ i m a g e - i W A R P _ S R C 2 D E S T - t o - f s l I M _ S R C ( I M _ D E S T ) - o W A R P _ F S L ` , f o l l o w e d b y F S L : ` a p p l y w a r p - i I M _ S R C - r I M _ D E S T - w W A R P _ F S L - - a b s - o I M _ S R C 2 D E S T ` Transform displacement field values to absolute FSL warps. To be used with FSL’s applywarp function with the
--absflag. Input the file that will be used as the input (source) for applywarp and optionally the target (ref). The target file is necessary for the case where the warp is in a different space than the target. For example, the inverse warps generated bysct_straighten_spinalcord. This feature has not been extensively validated so consider checking the results ofapplywarpagainstsct_apply_transfobefore using in FSL pipelines. Example syntax:sct_image -i WARP_SRC2DEST -to-fsl IM_SRC (IM_DEST) -o WARP_FSL, followed by FSL:applywarp -i IM_SRC -r IM_DEST -w WARP_FSL --abs -o IM_SRC2DEST
MISC ARGUMENTS¶
- -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