The dim4 output from fslinfo will indicate the size of the 4th dimension of an image file. If this value is greater than 1, you have a 4D file.
For example:
$ fslinfo newfile.nii
data_type UINT8
dim1 182
dim2 218
dim3 182
dim4 1
datatype 2
pixdim1 1.000000
pixdim2 1.000000
pixdim3 1.000000
pixdim4 1.000000
cal_max 121.0000
cal_min 0.0000
file_type NIFTI-1+
The above is a 3D file since dim4 is 1.
$ fslinfo newfile2.nii
data_type INT16
dim1 52
dim2 62
dim3 45
dim4 225
datatype 4
pixdim1 3.000000
pixdim2 3.000000
pixdim3 3.000000
pixdim4 1.000000
cal_max 0.0000
cal_min 0.0000
file_type NIFTI-1+
This is a 4D file because dim4 is 225, indicating there are 225 timepoints.
On Linux (and probably Mac) something like this would pull out the number of timepoints directly:
$ fslinfo newfile2.nii | grep "^dim4" | awk '{print $2}'
225
-Mike
--
Mike Angstadt
Research Computer Specialist / PANLab Lab Manager
Department of Psychiatry / University of Michigan
(734) 936-8229
> -----Original Message-----
> From: FSL - FMRIB's Software Library [mailto:[log in to unmask]] On
> Behalf Of Jon Anderson
> Sent: Thursday, March 03, 2016 4:37 PM
> To: [log in to unmask]
> Subject: [FSL] 3D vs 4D nifti file
>
> Dear experts,
> How can I differentiate between 3D and 4D nifti files(3D+time). In other
> words is there any command line that can show me if a nifti file is 3D or 4D
>
> Thanks for any advice.
> Jon
**********************************************************
Electronic Mail is not secure, may not be read every day, and should not be used for urgent or sensitive issues
|