Last active
April 28, 2020 17:15
-
-
Save ofgulban/2677029103bc2433fcca1c2bf3042711 to your computer and use it in GitHub Desktop.
Convert nifti to fmr and change the orientations.
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
% Convert nifti to fmr and change the orientations. | |
% This scripts requires neuroelf. | |
% | |
% NOTES | |
% ----- | |
% If you are getting erro about `Dyn3DToFMR`: | |
% 1. Clone the recent neuroelf version from <https://github.com/neuroelf/neuroelf-matlab> (this is written on 2020/04/28). | |
% 2. Copy `hdr_Dyn3DToFMR.m` file from neuroelf/_todo/@xff/private/ directory and paste in into neuroelf/@xff/private/ directory. | |
% 3. Comment out the following line fmrc.FirstDataSourceFile = hdrs.F; because otherwise it produces an error. | |
% 4. Add this modified neuroelf's path to your MATLAB. | |
% | |
% This should make the `Dyn3DToFMR` underfied error go away. | |
clear all; close all; | |
% Load | |
nii = xff('/path/to/file.nii'); | |
fmr = nii.Dyn3DToFMR; | |
data = fmr.Slice.STCData; | |
% Flip or permute data (change fmr headers if permute) | |
data = flipdim(data,1); | |
% save | |
fmr.Slice.STCData = data; | |
fmr.SaveAs('/path/to/file_reorient.fmr') |
Hello @ortiztudelaJ,
For some reason I did not receive any Github notification about this before and saw it now randomly.
What you need to do is to:
- clone the recent neuroelf version from here
- copy hdr_Dyn3DToFMR.m file from
neuroelf/_todo/@xff/private/
directory and paste in intoneuroelf/@xff/private/
directory. - Comment out the following line
fmrc.FirstDataSourceFile = hdrs.F;
because otherwise it produces an error. - Add this modified neuroelf's path to your MATLAB.
Now Dyn3DToFMR
method will work.
I will add these instructions as comments in the script. Probably something has changed in the neuroelf over the years and this method became hidden away.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi,
This looks exactly like what I need. However, I get an error when running it:
"mr = nii.Dyn3DToFMR;
Error using xff/subsref (line 202)
Field or method Dyn3DToFMR unknown for type HDR objects."
Is a specific way to call that function? The closest function I have is "hdr_Dyn3DToFMR", but that one also crashes.
Thank you!