Module Import alias ImportFrom alias alias alias ImportFrom alias Import alias identifier ImportFrom alias alias alias ImportFrom alias ImportFrom alias ImportFrom alias ImportFrom alias alias alias ImportFrom alias ImportFrom alias FunctionDef arguments args NameParam NameParam NameParam NameParam NameParam NameParam NameParam NameParam defaults Str Str Str NameLoad NameLoad Num body Expr Call AttributeLoad NameLoad attr Str NameLoad Assign NameStore Call AttributeLoad NameLoad attr NameLoad Expr Call AttributeLoad NameLoad attr Str NameLoad Expr Call NameLoad NameLoad BinOpAdd NameLoad Str Expr Call NameLoad NameLoad BinOpAdd NameLoad Str If CompareNotEq NameLoad Str body Expr Call NameLoad NameLoad BinOpAdd NameLoad Str Expr Call NameLoad NameLoad If CompareEq AttributeLoad NameLoad attr Str body Expr Call NameLoad Str Str keyword NameLoad keyword NameLoad keyword NameLoad orelse Assign NameStore Dict Str Str Str Str Str Str Str Str Str Str Str Str Assign AttributeStore NameLoad attr SubscriptLoad NameLoad Index AttributeLoad NameLoad attr Expr Call NameLoad Str Str keyword NameLoad keyword NameLoad keyword NameLoad keyword NameLoad keyword NameLoad keyword NameLoad Expr Call AttributeLoad NameLoad attr Str NameLoad Expr Call AttributeLoad NameLoad attr BinOpAdd BinOpAdd Str NameLoad Str Expr Call AttributeLoad NameLoad attr BinOpAdd BinOpAdd Str NameLoad Str Expr Call NameLoad Str decorator_list FunctionDef arguments args NameParam NameParam NameParam NameParam NameParam defaults Str Str Num body Expr Str Assign NameStore Call NameLoad Str Assign NameStore Call NameLoad Str Assign NameStore AttributeLoad NameLoad attr Assign NameStore AttributeLoad NameLoad attr Assign NameStore BinOpMult ListLoad Num SubscriptLoad AttributeLoad NameLoad attr Index Num Assign NameStore BinOpMult ListLoad Num SubscriptLoad AttributeLoad NameLoad attr Index Num Expr Call AttributeLoad NameLoad attr Str NameLoad Assign NameStore Call AttributeLoad NameLoad attr ListLoad ListLoad Num Num Num Assign ListStore ListStore NameStore NameStore NameStore Call AttributeLoad NameLoad attr NameLoad For NameStore Call NameLoad SubscriptLoad AttributeLoad NameLoad attr Index Num body Assign TupleStore SubscriptStore NameLoad Index NameLoad SubscriptStore NameLoad Index NameLoad Call AttributeLoad AttributeLoad NameLoad attr attr Call NameLoad SubscriptLoad NameLoad ExtSlice Slice Slice Index BinOpAdd NameLoad NameLoad Assign NameStore BinOpMult ListLoad Num SubscriptLoad AttributeLoad NameLoad attr Index Num Assign NameStore BinOpMult ListLoad Num SubscriptLoad AttributeLoad NameLoad attr Index Num Expr Call AttributeLoad NameLoad attr Str NameLoad For NameStore Call NameLoad SubscriptLoad AttributeLoad NameLoad attr Index Num body TryExcept body Assign TupleStore SubscriptStore NameLoad Index NameLoad SubscriptStore NameLoad Index NameLoad Call AttributeLoad AttributeLoad NameLoad attr attr Call NameLoad SubscriptLoad NameLoad ExtSlice Slice Slice Index NameLoad handlers ExceptHandler type NameLoad name NameStore body Expr Call AttributeLoad NameLoad attr Str Num Str Print Call AttributeLoad Str attr AttributeLoad SubscriptLoad Call AttributeLoad NameLoad attr Index Num attr Print NameLoad Assign NameStore BinOpMult ListLoad Num SubscriptLoad AttributeLoad NameLoad attr Index Num Assign NameStore BinOpMult ListLoad Num SubscriptLoad AttributeLoad NameLoad attr Index Num Expr Call AttributeLoad NameLoad attr Str NameLoad For NameStore Call NameLoad SubscriptLoad AttributeLoad NameLoad attr Index Num body Assign SubscriptStore NameLoad Index NameLoad UnaryOpUSub BinOpSub SubscriptLoad NameLoad Index NameLoad SubscriptLoad NameLoad Index NameLoad Assign SubscriptStore NameLoad Index NameLoad BinOpSub SubscriptLoad NameLoad Index NameLoad SubscriptLoad NameLoad Index NameLoad Assign NameStore Call NameLoad NameLoad Assign NameStore Call NameLoad NameLoad Assign NameStore Call NameLoad SubscriptLoad AttributeLoad NameLoad attr Index Num Expr Call NameLoad Str NameLoad NameLoad NameLoad keyword NameLoad Expr Call NameLoad Str UnaryOpUSub NameLoad UnaryOpUSub NameLoad NameLoad keyword NameLoad decorator_list FunctionDef arguments args NameParam NameParam NameParam NameParam NameParam NameParam NameParam NameParam defaults Str Str Str Call NameLoad keyword Str keyword Str keyword Str keyword Str keyword Str keyword Str keyword Str keyword Str Dict Str Str Str Str Str Str Str Str Str Str Str Str Str Str Str Str Str Str Str Str Num body Expr Str If CompareEq AttributeLoad NameLoad attr Str body Assign NameStore Str orelse Assign NameStore Str Expr Call AttributeLoad NameLoad attr Str NameLoad Assign TupleStore NameStore NameStore NameStore NameStore NameStore NameStore NameStore NameStore AttributeLoad Call NameLoad NameLoad attr Expr Call AttributeLoad NameLoad attr BinOpAdd BinOpAdd BinOpAdd BinOpAdd BinOpAdd Str Call NameLoad NameLoad Str Call NameLoad NameLoad Str Call NameLoad NameLoad NameLoad Expr Call AttributeLoad NameLoad attr BinOpAdd BinOpAdd BinOpAdd BinOpAdd BinOpAdd BinOpAdd Str Call NameLoad NameLoad Str Call NameLoad NameLoad Str Call NameLoad NameLoad Str NameLoad Expr Call AttributeLoad NameLoad attr Str NameLoad ImportFrom alias Assign NameStore Call NameLoad Str Assign NameStore Call NameLoad NameLoad Num For NameStore NameLoad body Expr Call AttributeLoad NameLoad attr Expr Call AttributeLoad NameLoad attr Str NameLoad Assign NameStore Call NameLoad Str Assign NameStore Call NameLoad NameLoad Num For NameStore NameLoad body Expr Call AttributeLoad NameLoad attr If CompareNotEq NameLoad Str body Expr Call AttributeLoad NameLoad attr Str NameLoad Assign NameStore Call NameLoad Str Assign NameStore Call NameLoad NameLoad Num For NameStore NameLoad body Expr Call AttributeLoad NameLoad attr If CompareIn AttributeLoad NameLoad attr ListLoad Str body Assign NameStore ListComp Num comprehension NameStore Call NameLoad NameLoad Assign NameStore ListComp Num comprehension NameStore Call NameLoad NameLoad Assign NameStore ListComp Num comprehension NameStore Call NameLoad NameLoad If CompareIn AttributeLoad NameLoad attr ListLoad Str Str Str Str body Assign NameStore ListLoad Assign NameStore ListLoad For NameStore Call NameLoad NameLoad body Expr Call AttributeLoad NameLoad attr BinOpAdd BinOpAdd BinOpAdd BinOpAdd Str Call NameLoad NameLoad Str Call NameLoad BinOpSub NameLoad Num Str NameLoad Assign NameStore Call NameLoad NameLoad Assign NameStore BinOpAdd Str NameLoad If CompareNotEq NameLoad Str body Assign NameStore BinOpAdd BinOpAdd Str NameLoad Str orelse Assign NameStore Str Assign NameStore BinOpAdd BinOpAdd BinOpAdd BinOpAdd BinOpAdd BinOpAdd BinOpAdd BinOpAdd BinOpAdd BinOpAdd BinOpAdd BinOpAdd BinOpAdd BinOpAdd BinOpAdd BinOpAdd BinOpAdd BinOpAdd BinOpAdd BinOpAdd BinOpAdd BinOpAdd BinOpAdd BinOpAdd BinOpAdd BinOpAdd Str AttributeLoad NameLoad attr Str Call NameLoad AttributeLoad NameLoad attr SubscriptLoad NameLoad Index Call AttributeLoad AttributeLoad NameLoad attr attr Str AttributeLoad NameLoad attr Str NameLoad Str Str NameLoad Str Str NameLoad Str Call NameLoad AttributeLoad NameLoad attr Str Call NameLoad AttributeLoad NameLoad attr Str Call NameLoad AttributeLoad NameLoad attr Str NameLoad Str NameLoad Str NameLoad If UnaryOpNot CompareEq AttributeLoad NameLoad attr Str body Assign NameStore Dict Str Str Str Str Str Str AugAssignAdd NameStore BinOpAdd BinOpAdd BinOpAdd BinOpAdd BinOpAdd BinOpAdd BinOpAdd Str NameLoad Str Str NameLoad Str SubscriptLoad NameLoad Index AttributeLoad NameLoad attr Str TryExcept body Expr Call AttributeLoad NameLoad attr NameLoad If CompareIn AttributeLoad NameLoad attr ListLoad Str body Assign NameStore BinOpAdd NameLoad Str Assign NameStore Call NameLoad NameLoad keyword NameLoad Assign NameStore SubscriptLoad NameLoad Index Str Assign SubscriptStore NameLoad Index NameLoad SubscriptLoad SubscriptLoad NameLoad Index Num Index Num Assign SubscriptStore NameLoad Index NameLoad SubscriptLoad SubscriptLoad NameLoad Index Num Index Num Assign SubscriptStore NameLoad Index NameLoad Call NameLoad SubscriptLoad NameLoad Index Num If CompareIn AttributeLoad NameLoad attr ListLoad Str Str Str Str body Assign NameStore BinOpAdd NameLoad Str Assign NameStore BinOpAdd NameLoad Str Expr Call AttributeLoad NameLoad attr NameLoad Expr Call AttributeLoad NameLoad attr NameLoad If CompareIn AttributeLoad NameLoad attr ListLoad Str Str body Expr Call AttributeLoad NameLoad attr BinOpAdd BinOpAdd BinOpAdd BinOpAdd Str NameLoad Str NameLoad Str Assign NameStore BinOpAdd NameLoad Str Expr Call AttributeLoad NameLoad attr BinOpAdd BinOpAdd BinOpAdd BinOpAdd BinOpAdd Str NameLoad Str NameLoad Str NameLoad Expr Call AttributeLoad NameLoad attr BinOpAdd BinOpAdd BinOpAdd BinOpAdd BinOpAdd Str NameLoad Str NameLoad Str NameLoad handlers ExceptHandler type NameLoad name NameStore body Expr Call AttributeLoad NameLoad attr BinOpAdd Str Call NameLoad NameLoad Num Str Expr Call AttributeLoad NameLoad attr Str NameLoad If CompareIn AttributeLoad NameLoad attr ListLoad Str body Assign NameStore Call NameLoad NameLoad Assign NameStore Call NameLoad NameLoad Assign NameStore Call NameLoad NameLoad Expr Call NameLoad Str NameLoad NameLoad NameLoad keyword NameLoad Expr Call NameLoad Str UnaryOpUSub NameLoad UnaryOpUSub NameLoad NameLoad keyword NameLoad If CompareIn AttributeLoad NameLoad attr ListLoad Str Str Str Str body ImportFrom alias Expr Call NameLoad NameLoad NameLoad Str Expr Call NameLoad NameLoad NameLoad Str decorator_list FunctionDef arguments args NameParam defaults body Expr Str If CompareLt NameLoad Num body Print Str Expr Call AttributeLoad NameLoad attr keyword Num orelse If CompareLtLt Num NameLoad Num body Assign NameStore BinOpAdd Str Call NameLoad NameLoad orelse If CompareLtLt Num NameLoad Num body Assign NameStore BinOpAdd Str Call NameLoad NameLoad orelse If CompareLtLt Num NameLoad Num body Assign NameStore BinOpAdd Str Call NameLoad NameLoad orelse If CompareLtLt Num NameLoad Num body Assign NameStore Call NameLoad NameLoad orelse If CompareGt NameLoad Num body Print Str Expr Call AttributeLoad NameLoad attr keyword Num Return NameLoad decorator_list FunctionDef arguments args NameParam NameParam NameParam NameParam NameParam NameParam NameParam defaults NameLoad Str Num body Expr Str Expr Call AttributeLoad NameLoad attr Str NameLoad Assign NameStore Call NameLoad NameLoad Assign NameStore Call AttributeLoad NameLoad attr Assign NameStore Call AttributeLoad NameLoad attr Expr Call AttributeLoad NameLoad attr Str NameLoad Assign TupleStore NameStore NameStore NameStore NameStore NameStore NameStore NameStore NameStore AttributeLoad Call NameLoad NameLoad attr Expr Call AttributeLoad NameLoad attr BinOpAdd BinOpAdd BinOpAdd BinOpAdd BinOpAdd Str Call NameLoad NameLoad Str Call NameLoad NameLoad Str Call NameLoad NameLoad NameLoad Expr Call AttributeLoad NameLoad attr BinOpAdd BinOpAdd BinOpAdd BinOpAdd BinOpAdd BinOpAdd Str Call NameLoad NameLoad Str Call NameLoad NameLoad Str Call NameLoad NameLoad Str NameLoad If CompareEq NameLoad NameLoad body Assign NameStore Call NameLoad Call NameLoad BinOpDiv NameLoad Num Assign NameStore Call NameLoad Call NameLoad BinOpDiv NameLoad Num orelse Assign NameStore SubscriptLoad NameLoad Index Num Assign NameStore SubscriptLoad NameLoad Index Num Assign NameStore Call NameLoad TupleLoad NameLoad NameLoad NameLoad Num Num Assign NameStore ListComp ListLoad ListLoad BinOpSub NameLoad NameLoad ListLoad BinOpSub NameLoad NameLoad comprehension NameStore Call NameLoad NameLoad comprehension NameStore Call NameLoad NameLoad For NameStore Call NameLoad NameLoad body For NameStore Call NameLoad NameLoad body For NameStore Call NameLoad NameLoad body Assign SubscriptStore NameLoad Index TupleLoad NameLoad NameLoad NameLoad Num Num BinOpAdd BinOpSub BinOpMult BinOpSub Call NameLoad SubscriptLoad NameLoad Index NameLoad Num BinOpSub NameLoad NameLoad BinOpMult Call NameLoad SubscriptLoad NameLoad Index NameLoad BinOpSub NameLoad NameLoad SubscriptLoad NameLoad Index NameLoad Assign SubscriptStore NameLoad Index TupleLoad NameLoad NameLoad NameLoad Num Num BinOpAdd BinOpSub BinOpMult UnaryOpUSub Call NameLoad SubscriptLoad NameLoad Index NameLoad BinOpSub NameLoad NameLoad BinOpMult BinOpSub Call NameLoad SubscriptLoad NameLoad Index NameLoad Num BinOpSub NameLoad NameLoad SubscriptLoad NameLoad Index NameLoad Assign SubscriptStore NameLoad Index TupleLoad NameLoad NameLoad NameLoad Num Num Num Expr Call AttributeLoad NameLoad attr Str TupleLoad Str Expr Call AttributeLoad NameLoad attr Str Assign NameStore Call NameLoad NameLoad NameLoad NameLoad Expr Call NameLoad NameLoad NameLoad Expr Call AttributeLoad NameLoad attr BinOpAdd Str NameLoad NameLoad decorator_list
N/A N/A sys math asin cos sin os chdir N/A sct_utils sct numpy array asarray zeros scipy ndimage scipy.io loadmat msct_image Image nibabel load Nifti1Image save sct_convert convert sct_register_multimodal Paramreg register_slicewise N/A N/A fname_src fname_dest fname_mask warp_forward_out warp_inverse_out paramreg ants_registration_params verbose N/A step0Warp.nii.gz step0InverseWarp.nii.gz None None 0 N/A N/A N/A N/A sct printv 
Create temporary folder... verbose N/A path_tmp N/A N/A sct tmp_create verbose N/A N/A N/A sct printv 
Copy input data to temp folder... verbose N/A N/A convert fname_src N/A path_tmp src.nii N/A N/A convert fname_dest N/A path_tmp dest.nii N/A N/A fname_mask N/A N/A N/A convert fname_mask N/A path_tmp mask.nii.gz N/A N/A chdir path_tmp N/A N/A N/A paramreg algo centermass N/A N/A N/A register2d_centermass src.nii dest.nii fname_warp warp_forward_out fname_warp_inv warp_inverse_out verbose verbose N/A N/A algo_dic N/A translation rigid affine syn bsplinesyn centermass Translation Rigid Affine SyN BSplineSyN centermass N/A N/A paramreg algo N/A algo_dic N/A N/A paramreg algo N/A N/A register2d src.nii dest.nii fname_mask fname_mask fname_warp warp_forward_out fname_warp_inv warp_inverse_out paramreg paramreg ants_registration_params ants_registration_params verbose verbose N/A N/A N/A sct printv 
Move warping fields to parent folder... verbose N/A N/A N/A sct run N/A N/A mv  warp_forward_out  ../ N/A N/A N/A sct run N/A N/A mv  warp_inverse_out  ../ N/A N/A chdir ../ N/A register2d_centermass N/A N/A fname_src fname_dest fname_warp fname_warp_inv verbose N/A warp_forward.nii.gz warp_inverse.nii.gz 1 N/A N/A Slice-by-slice registration by translation of two segmentations.
    For each slice, we estimate the translation vector by calculating the difference of position of the two centers of
    mass in voxel unit.
    The segmentations can be of different sizes but the output segmentation must be smaller than the input segmentation.

    input:
        seg_input: name of moving segmentation file (type: string)
        seg_dest: name of fixed segmentation file (type: string)
    input optional:
        fname_warp: name of output 3d forward warping field
        fname_warp_inv: name of output 3d inverse warping field
        verbose
    output:
        x_displacement: list of translation along x axis for each slice (type: list)
        y_displacement: list of translation along y axis for each slice (type: list)

     N/A seg_input_img N/A Image src.nii N/A seg_dest_img N/A Image dest.nii N/A seg_input_data N/A seg_input_img data N/A seg_dest_data N/A seg_dest_img data N/A x_center_of_mass_input N/A N/A 0 N/A N/A seg_dest_data shape N/A 2 N/A y_center_of_mass_input N/A N/A 0 N/A N/A seg_dest_data shape N/A 2 N/A N/A N/A sct printv 
Get center of mass of source image... verbose N/A coord_origin_dest N/A N/A seg_dest_img transfo_pix2phys N/A N/A 0 0 0 N/A N/A N/A x_o y_o z_o N/A N/A seg_input_img transfo_phys2pix coord_origin_dest N/A iz N/A xrange N/A N/A seg_dest_data shape N/A 2 N/A N/A N/A N/A x_center_of_mass_input N/A iz N/A y_center_of_mass_input N/A iz N/A N/A N/A ndimage measurements center_of_mass N/A array N/A seg_input_data N/A N/A N/A N/A N/A z_o iz N/A x_center_of_mass_output N/A N/A 0 N/A N/A seg_dest_data shape N/A 2 N/A y_center_of_mass_output N/A N/A 0 N/A N/A seg_dest_data shape N/A 2 N/A N/A N/A sct printv 
Get center of mass of destination image... verbose N/A iz N/A xrange N/A N/A seg_dest_data shape N/A 2 N/A N/A N/A N/A N/A N/A x_center_of_mass_output N/A iz N/A y_center_of_mass_output N/A iz N/A N/A N/A ndimage measurements center_of_mass N/A array N/A seg_dest_data N/A N/A N/A N/A iz N/A N/A N/A Exception N/A e N/A N/A N/A N/A sct printv WARNING: Exception error in msct_register during register_seg: 1 warning N/A N/A N/A Error on line {} format N/A N/A N/A N/A sys exc_info N/A -1 tb_lineno N/A e N/A x_displacement N/A N/A 0 N/A N/A seg_input_data shape N/A 2 N/A y_displacement N/A N/A 0 N/A N/A seg_input_data shape N/A 2 N/A N/A N/A sct printv 
Get X-Y displacement for each slice... verbose N/A iz N/A xrange N/A N/A seg_dest_data shape N/A 2 N/A N/A N/A x_displacement N/A iz N/A N/A N/A x_center_of_mass_output N/A iz N/A x_center_of_mass_input N/A iz N/A N/A y_displacement N/A iz N/A N/A y_center_of_mass_output N/A iz N/A y_center_of_mass_input N/A iz N/A x_disp_a N/A asarray x_displacement N/A y_disp_a N/A asarray y_displacement N/A theta_rot_a N/A zeros N/A N/A seg_dest_data shape N/A 2 N/A N/A generate_warping_field dest.nii x_disp_a y_disp_a theta_rot_a fname fname_warp N/A N/A generate_warping_field src.nii N/A x_disp_a N/A y_disp_a theta_rot_a fname fname_warp_inv N/A register2d N/A N/A fname_src fname_dest fname_mask fname_warp fname_warp_inv paramreg ants_registration_params verbose N/A warp_forward.nii.gz warp_inverse.nii.gz N/A Paramreg step 0 type im algo Translation metric MI iter 5 shrink 1 smooth 0 gradStep 0.5 N/A rigid affine compositeaffine similarity translation bspline gaussiandisplacementfield bsplinedisplacementfield syn bsplinesyn ,10 ,3,0 ,5,10 ,3,0 ,1,3 0 N/A N/A Slice-by-slice registration of two images.

    We first split the 3D images into 2D images (and the mask if inputted). Then we register slices of the two images
    that physically correspond to one another looking at the physical origin of each image. The images can be of
    different sizes but the destination image must be smaller thant the input image. We do that using antsRegistration
    in 2D. Once this has been done for each slices, we gather the results and return them.
    Algorithms implemented: translation, rigid, affine, syn and BsplineSyn.
    N.B.: If the mask is inputted, it must also be 3D and it must be in the same space as the destination image.

    input:
        fname_source: name of moving image (type: string)
        fname_dest: name of fixed image (type: string)
        mask[optional]: name of mask file (type: string) (parameter -x of antsRegistration)
        fname_warp: name of output 3d forward warping field
        fname_warp_inv: name of output 3d inverse warping field
        paramreg[optional]: parameters of antsRegistration (type: Paramreg class from sct_register_multimodal)
        ants_registration_params[optional]: specific algorithm's parameters for antsRegistration (type: dictionary)

    output:
        if algo==translation:
            x_displacement: list of translation along x axis for each slice (type: list)
            y_displacement: list of translation along y axis for each slice (type: list)
        if algo==rigid:
            x_displacement: list of translation along x axis for each slice (type: list)
            y_displacement: list of translation along y axis for each slice (type: list)
            theta_rotation: list of rotation angle in radian (and in ITK's coordinate system) for each slice (type: list)
        if algo==affine or algo==syn or algo==bsplinesyn:
            creation of two 3D warping fields (forward and inverse) that are the concatenations of the slice-by-slice
            warps.
     N/A N/A N/A paramreg metric MI N/A N/A metricSize 32 N/A N/A metricSize 4 N/A N/A N/A sct printv 
Get image dimensions of destination image... verbose N/A N/A nx ny nz nt px py pz pt N/A N/A Image fname_dest dim N/A N/A N/A sct printv N/A N/A N/A N/A N/A .. matrix size:  N/A str nx  x  N/A str ny  x  N/A str nz verbose N/A N/A N/A sct printv N/A N/A N/A N/A N/A N/A .. voxel size:   N/A str px mm x  N/A str py mm x  N/A str pz mm verbose N/A N/A N/A sct printv 
Split input volume... verbose sct_image split_data N/A im_src N/A Image src.nii N/A split_source_list N/A split_data im_src 2 N/A im split_source_list N/A N/A N/A N/A im save N/A N/A N/A sct printv 
Split destination volume... verbose N/A im_dest N/A Image dest.nii N/A split_dest_list N/A split_data im_dest 2 N/A im split_dest_list N/A N/A N/A N/A im save N/A N/A fname_mask N/A N/A N/A N/A sct printv 
Split mask volume... verbose N/A im_mask N/A Image mask.nii.gz N/A split_mask_list N/A split_data im_mask 2 N/A im split_mask_list N/A N/A N/A N/A im save N/A N/A N/A paramreg algo N/A Translation N/A N/A x_displacement N/A 0 N/A i N/A range nz N/A y_displacement N/A 0 N/A i N/A range nz N/A theta_rotation N/A 0 N/A i N/A range nz N/A N/A N/A paramreg algo N/A Rigid Affine BSplineSyN SyN N/A N/A list_warp N/A N/A list_warp_inv N/A N/A i N/A range nz N/A N/A N/A N/A sct printv N/A N/A N/A N/A Registering slice  N/A str i / N/A str N/A nz 1 ... verbose N/A num N/A numerotation i N/A prefix_warp2d N/A warp2d_ num N/A N/A fname_mask N/A N/A masking N/A N/A -x mask_Z num .nii.gz N/A N/A masking N/A cmd N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A isct_antsRegistration --dimensionality 2 --transform  N/A paramreg algo [ N/A str N/A paramreg gradStep N/A ants_registration_params N/A N/A N/A N/A paramreg algo lower ] --metric  N/A paramreg metric [dest_Z num .nii ,src_Z num .nii ,1, metricSize ] --convergence  N/A str N/A paramreg iter  --shrink-factors  N/A str N/A paramreg shrink  --smoothing-sigmas  N/A str N/A paramreg smooth mm --output [ prefix_warp2d ,src_Z num _reg.nii] --interpolation BSpline[3]  masking N/A N/A N/A N/A paramreg init N/A N/A init_dict N/A geometric centermass origin 0 1 2 N/A cmd N/A N/A N/A N/A N/A N/A N/A  -r [dest_Z num .nii ,src_Z num .nii, N/A init_dict N/A N/A paramreg init ] N/A N/A N/A N/A N/A sct run cmd N/A N/A N/A paramreg algo N/A Translation N/A N/A file_mat N/A prefix_warp2d 0GenericAffine.mat N/A matfile N/A loadmat file_mat struct_as_record True N/A array_transfo N/A matfile N/A AffineTransform_double_2_2 N/A N/A x_displacement N/A i N/A N/A array_transfo N/A 4 N/A 0 N/A N/A y_displacement N/A i N/A N/A array_transfo N/A 5 N/A 0 N/A N/A theta_rotation N/A i N/A asin N/A array_transfo N/A 2 N/A N/A N/A paramreg algo N/A Rigid Affine BSplineSyN SyN N/A N/A file_warp2d N/A prefix_warp2d 0Warp.nii.gz N/A file_warp2d_inv N/A prefix_warp2d 0InverseWarp.nii.gz N/A N/A N/A list_warp append file_warp2d N/A N/A N/A list_warp_inv append file_warp2d_inv N/A N/A N/A paramreg algo N/A Rigid Affine N/A N/A N/A N/A sct run N/A N/A N/A N/A isct_antsRegistration -d 2 -t SyN[1, 1, 1] -c 0 -m MI[dest_Z num .nii, src_Z num .nii, 1, 32] -o warp2d_null -f 1 -s 0 N/A file_mat N/A prefix_warp2d 0GenericAffine.mat N/A N/A N/A sct run N/A N/A N/A N/A N/A isct_ComposeMultiTransform 2  file_warp2d  -R dest_Z num .nii warp2d_null0Warp.nii.gz  file_mat N/A N/A N/A sct run N/A N/A N/A N/A N/A isct_ComposeMultiTransform 2  file_warp2d_inv  -R src_Z num .nii warp2d_null0InverseWarp.nii.gz -i  file_mat N/A N/A N/A Exception N/A e N/A N/A N/A N/A sct printv N/A ERROR: Exception occurred.
 N/A str e 1 error N/A N/A N/A sct printv 
Merge warping fields along z... verbose N/A N/A N/A paramreg algo N/A Translation N/A N/A x_disp_a N/A asarray x_displacement N/A y_disp_a N/A asarray y_displacement N/A theta_rot_a N/A asarray theta_rotation N/A N/A generate_warping_field dest.nii x_disp_a y_disp_a theta_rot_a fname fname_warp N/A N/A generate_warping_field src.nii N/A x_disp_a N/A y_disp_a theta_rot_a fname fname_warp_inv N/A N/A N/A paramreg algo N/A Rigid Affine BSplineSyN SyN N/A sct_image concat_warp2d N/A N/A concat_warp2d list_warp fname_warp dest.nii N/A N/A concat_warp2d list_warp_inv fname_warp_inv src.nii N/A numerotation N/A N/A nb N/A N/A N/A Indexation of number for matching fslsplit's index.

    Given a slice number, this function returns the corresponding number in fslsplit indexation system.

    input:
        nb: the number of the slice (type: int)

    output:
        nb_output: the number of the slice for fslsplit (type: string)
     N/A N/A nb 0 N/A N/A ERROR: the number is negative. N/A N/A N/A sys exit status 2 N/A N/A N/A -1 nb 10 N/A N/A nb_output N/A 000 N/A str nb N/A N/A N/A 9 nb 100 N/A N/A nb_output N/A 00 N/A str nb N/A N/A N/A 99 nb 1000 N/A N/A nb_output N/A 0 N/A str nb N/A N/A N/A 999 nb 10000 N/A N/A nb_output N/A str nb N/A N/A N/A nb 9999 N/A N/A ERROR: the number is superior to 9999. N/A N/A N/A sys exit status 2 N/A nb_output N/A generate_warping_field N/A N/A fname_dest x_trans y_trans theta_rot center_rotation fname verbose N/A None warping_field.nii.gz 1 N/A N/A Generation of a warping field towards an image and given transformation parameters.

    Given a destination image and transformation parameters this functions creates a NIFTI 3D warping field that can be
    applied afterwards. The transformation parameters corresponds to a slice-by-slice registration of images, thus the
    transformation parameters must be precised for each slice of the image.

    inputs:
        fname_dest: name of destination image (type: string). NEEDS TO BE RPI ORIENTATION!!!
        x_trans: list of translations along x axis for each slice (type: list, length: height of fname_dest)
        y_trans: list of translations along y axis for each slice (type: list, length: height of fname_dest)
        theta_rot: list of rotation angles in radian (and in ITK's coordinate system) for each slice (type: list)
    inputs (optional):
        center_rotation: pixel coordinates in plan xOy of the wanted center of rotation (type: list, length: 2, example: [0,ny/2])
        fname: name of output warp (type: string)
        verbose: display parameter (type: int)
    output:
        creation of a warping field of name 'fname' with an header similar to the destination image.
     N/A N/A N/A sct printv 
Creating warping field for transformations along z... verbose N/A file_dest N/A load fname_dest N/A hdr_file_dest N/A N/A file_dest get_header N/A hdr_warp N/A N/A hdr_file_dest copy N/A N/A N/A sct printv 
Get image dimensions of destination image... verbose N/A N/A nx ny nz nt px py pz pt N/A N/A Image fname_dest dim N/A N/A N/A sct printv N/A N/A N/A N/A N/A .. matrix size:  N/A str nx  x  N/A str ny  x  N/A str nz verbose N/A N/A N/A sct printv N/A N/A N/A N/A N/A N/A .. voxel size:   N/A str px mm x  N/A str py mm x  N/A str pz mm verbose N/A N/A center_rotation None N/A N/A x_a N/A int N/A round N/A nx 2 N/A y_a N/A int N/A round N/A ny 2 N/A N/A x_a N/A center_rotation N/A 0 N/A y_a N/A center_rotation N/A 1 N/A data_warp N/A zeros N/A nx ny nz 1 3 N/A vector_i N/A N/A N/A N/A i x_a N/A N/A j y_a N/A i N/A range nx N/A j N/A range ny N/A k N/A range nz N/A N/A i N/A range nx N/A N/A j N/A range ny N/A N/A N/A data_warp N/A N/A i j k 0 0 N/A N/A N/A N/A N/A cos N/A theta_rot N/A k 1 N/A i x_a N/A N/A sin N/A theta_rot N/A k N/A j y_a N/A x_trans N/A k N/A N/A data_warp N/A N/A i j k 0 1 N/A N/A N/A N/A N/A sin N/A theta_rot N/A k N/A i x_a N/A N/A N/A cos N/A theta_rot N/A k 1 N/A j y_a N/A y_trans N/A k N/A N/A data_warp N/A N/A i j k 0 2 0 N/A N/A N/A hdr_warp set_intent vector N/A N/A N/A N/A hdr_warp set_data_dtype float32 N/A img N/A Nifti1Image data_warp None hdr_warp N/A N/A save img fname N/A N/A N/A sct printv N/A 
Done! Warping field generated:  fname verbose N/A