Skip to content

Instantly share code, notes, and snippets.

@ofgulban
Last active May 19, 2017 14:27
Show Gist options
  • Select an option

  • Save ofgulban/5c1ff01b0d8d3a3f5b811111c8113c94 to your computer and use it in GitHub Desktop.

Select an option

Save ofgulban/5c1ff01b0d8d3a3f5b811111c8113c94 to your computer and use it in GitHub Desktop.
Delete unwanted volumes from Brainvoyager FMR files.
% Delete unwanted volumes from timeseries data (Brainvoyager, FMR format).
clear all;
% Enter FMR file path and volume indices to be erased
fmr_path = '/path/to/your/file.fmr';
vol_erase = [50:60, 100:103];
% Load FMR (headers) and STC (data)
fmr = xff(fmr_path);
data = fmr.Slice.STCData(:, :, :, :);
% Remove unwanted volumes
data(:, :, vol_erase, :) = [];
new_NrOfVolumes = size(data, 3);
% Update fmr
fmr.Slice.STCData = data;
fmr.NrOfVolumes = new_NrOfVolumes;
% Save
fmr.SaveAs([fmr_path(1:end-4), '_cropped.fmr']);
disp('Done.')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment