How can I delete certain volumes from my data?

Hi there,
I would like to delete some of the volumes at the end of each run as the break was getting announced and participants could take a rest, while scanner was still scanning. I would like to remove about 6 volumes at the end of each run. I know I can remove volumes at the start of each run using fsl gui, is there a command or any other way to remove other volumes as well before preprocessing?


You can use the command fslroi.

Fslutils - FslWiki (

Hope this helps!

1 Like

I get the error that my time index is out of bound. I calculated the times based on the number of volumes that I have. I have 397 volumes with TR=1.5. So, I have 595.5s in each run. If I want to get rid of the first 9s and the last 6s, then I should use the following:

fslroi input output 9 580.5

But I receive the following exception:

Image Exception : #5 :: Out of Bounds (time index)
Out of Bounds (time index)

Are my time calculations off? How can I know the exact duration of each run?

Thanks a lot.

I think the examples I was following were not accurate, and the time index is actually the volumes, not the seconds, as anything above 397 would result in a time index error. Please let me know if I am doing my analysis wrong. Now I have updated the code to the following:

fslroi input output 6 387

1 Like


Yes- one should index volumes (but note that it is the volume start and volume size - not the end volume, so in this case you start from 7th volume note that indexing in fsl starts from zero and keep 387 volumes after that ).
Here is the help text of the function:

Usage: fslroi <input> <output> <xmin> <xsize> <ymin> <ysize> <zmin> <zsize>
       fslroi <input> <output> <tmin> <tsize>

       fslroi <input> <output> <xmin> <xsize> <ymin> <ysize> <zmin> <zsize> <tmin> <tsize>
Note: indexing (in both time and space) starts with 0 not 1! Inputting -1 for a size will set it to the full image extent for that dimension.

Apperantly, you can only define the tmin and tsize (I also did not know that :slight_smile: ) so your call looks fine!

1 Like