Talk:SPM/Working with 4D data

How to count the number of volumes of a 4D nifti file?
This tutorial is nice but it does not tell how to get the total number of volumes of a 4D nifti file, which is necessary if you want to program directly the number in a script. Can someone add a section to explain how to do so? Or showcase spm_select('expand', niftifile) available only on SPM12 (from https://www.jiscmail.ac.uk/cgi-bin/webadmin?A2=spm;17858a96.1410):

or show function spm_select_get_nbframes in spm_select.m (which should be visible from the outside, here it cannot be used by anyone but spm_select.m !):