Dear Bob and Ziad, and other helpful matlab-to-AFNI converters,
I have almost successfully written a 64x64 matrix (matp) of numbers (floating point) as an AFNI Brik file, but alas, I need help with the very last step. I want to convert matp into a functional overlay that can be read into AFNI.
I have read in the header info from the header of a functional dataset, and modified the attributes as below. Note that my matrix was only calculated for slice 1, so i only need one sub-brick.
[err, Func, FInfo, ErrMessage] = BrikLoad ('scan1+orig');
InfoDelOut = FInfo;
InfoDelOut.RootName = ''; %that'll get set by WriteBrik
InfoDelOut.DATASET_RANK(2) = 1; %one sub-brick
InfoDelOut.TAXIS_NUMS(1) = InfoDelOut.DATASET_RANK(2); %one sub-brick
InfoDelOut.BRICK_TYPES = [1]; %store data as shorts
InfoDelOut.BRICK_STATS = []; %automatically set
InfoDelOut.BRICK_FLOAT_FACS = [];%automatically set
InfoDelOut.BRICK_LABS = 'test';
InfoDelOut.IDCODE_STRING = '';%automatically set
InfoDelOut.BRICK_STATAUX = [1 2 3 160 2 2]; %WHAT IS THIS?
InfoDelOut.DATASET_DIMENSIONS(3) = 1; %write out slice 1
%Important! See README.attributes for more details
InfoDelOut.SCENE_DATA(1) = 0; %3DIM_HEAD_FUNC
InfoDelOut.SCENE_DATA(2) = 3; %fitt: t-statistic
InfoDelOut.SCENE_DATA(3) = 2; %corresponds to SCENE_DATA(1)
Then I defined the OptDelOut struct:
OptDelOut.Scale = 1;
OptDelOut.Prefix = 'Testmap';
OptDelOut.verbose = 0;
OptDelOut.View = '+orig';
OptDelOut.Slices = 1;
And ran the WriteBrik command:
[err, ErrMessage, matpInfo] = WriteBrik (matp, InfoDelOut, OptDelOut);
This produced no errors, and when i read Testmap+orig back into matlab using the LoadBrik command, and plotted it with imagesc, everything was fine. But when I tried to load Testmap+orig into AFNI, i got these errors:
DATASET error: non-matching SCENE_TYPE[2]
DATASET error: function type missing auxilliary statistical data
DATASET error: illegal time-dependent dataset and func_type combination!
So I have not specified things properly in SCENE_DATA. The numbers in matp are not any of the options for the func type, so i just picked t-statistic (3). Can you please advise?
Thanks very much!
cnan