Last active
May 19, 2017 14:27
-
-
Save ofgulban/5c1ff01b0d8d3a3f5b811111c8113c94 to your computer and use it in GitHub Desktop.
Delete unwanted volumes from Brainvoyager FMR files.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| % 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