If you want to select every Nth time point, I would personally use the term sub-sampling rather than down-sampling. In this case you could use the suggestion from @ptaylor, or if you want to use FSL, a combination of fslsplit
and fslmerge
.
If you want to perform down-sampling (or up-sampling), there are a range of options, including a hidden command in FSL called $FSLDIR/bin/resample_image
which allows flexible resampling along all dimensions including time:
$FSLDIR/bin/resample_image -h
usage: resample_image (--shape|--dim|--reference) [options] input output
Resample an image to different dimensions.
positional arguments:
input Input image
output Output image
options:
-h, --help show this help message and exit
-i {nearest,linear,cubic}, --interp {nearest,linear,cubic}
Interpolation (default: linear)
-o {centre,corner}, --origin {centre,corner}
Resampling origin (default: centre)
-dt {char,short,int,float,double}, --dtype {char,short,int,float,double}
Data type (default: data type of input image)
-n, --nosmooth Do not smooth image when downsampling
Resampling destination:
Specify the resampling destination space using one of the following options. Note that the --reference option will cause the field-of-view of
the input image to be changed to that of the reference image.
-s X,Y,Z,..., --shape X,Y,Z,...
Output shape
-d X,Y,Z,..., --dim X,Y,Z,...
Output voxel dimensions
-r IMAGE, --reference IMAGE
Resample input to the space of this reference image(overrides --origin)
e.g. if your image has shape (100, 100, 100, 20)
, and you want to upsample it along the time dimension by a factor of two:
$FSLDIR/bin/resample_image input.nii.gz output.nii.gz -s 100,100,100,40
Having said that, I’m going to pass on the question of whether down-sampling is suitable for your particular use-case 