unravel.warp.warp module#
Use warp
from UNRAVEL to warp to/from atlas space and registration input space
- Prereq:
reg
Note
This warps padded images in ./reg_outputs (i.e., images that match the padded fixed reg input). For unpadded final images, use
warp_to_fixed
andwarp_to_atlas
.To make an average template, run reg as usual then follow the usage to inverse warp the autofl images to atlas space.
agg -i ‘atlas_space/tissue_in_atlas_space.nii.gz’ -a -td autofl_CCF30 -d $DIRS
cd autofl_CCF30
avg -o SMM2_autofl_avg.nii.gz
lr_avg -i SMM2_autofl_avg.nii.gz
for d in $DIRS ; do cd $d ; for s in sample?? ; do reg -m path/SMM2_autofl_avg_LRavg.nii.gz -bc -sm 0.4 -ort $(cat $s/parameters/ort.txt) -m2 path/atlas_CCFv3_2020_30um.nii.gz -v -d $s ; done ; done
Usage for forward warping atlas to tissue space:#
warp -m atlas_img.nii.gz -f reg_outputs/autofl_50um_masked_fixed_reg_input.nii.gz -o native_space/atlas_in_tissue_space.nii.gz -inp multiLabel [-ro reg_outputs] [-v]
Usage for inverse warping tissue to atlas space:#
warp -m reg_outputs/autofl_50um_masked_fixed_reg_input.nii.gz -f atlas_img.nii.gz -o atlas_space/tissue_in_atlas_space.nii.gz -inv [–inp bSpline] [-ro reg_outputs] [-v]
- unravel.warp.warp.warp(reg_outputs_path, moving_img_path, fixed_img_path, output_path, inverse, interpol)[source]#
Applies the transformations to an image using ANTsPy.
Parameters:#
reg_outputs_path (Path): Path to the reg_outputs folder (contains transformation files) moving_img_path (str): Path to the image to be transformed. fixed_img_path (str): Path to the reference image for applying the transform. output_path (str): Path where the transformed image will be saved. inverse (bool): If True, apply the inverse transformation. Defaults to False. interpol (str): Type of interpolation (e.g., ‘Linear’, ‘NearestNeighbor’, etc.).
Notes:#
If multiLabel interpolation is used, the label values are rounded.
If bSpline interpolation is used, negative values are set to 0.