Hi,
I have nifti neuroimaging data that I want to normalise within an ROI to a zero-mean, unit-variance space.
I tried using the code below however kept on getting an error;
ROI = niftiread('CHB_train_Case01_T1_brain_mask.nii');Raw_brain = niftiread('CHB_train_Case01_T1.nii');ind = find(ROI==1);mean_val = mean(Raw_brain(ind));std_val = std(Raw_brain(ind));Raw_brain(ind)= Raw_brain(ind)-mean_val;Raw_brain(ind)= (Raw_brain(ind)-mean_val)/std_val;niftiwrite(Raw_brain,'Raw_brain_normalised_T1.nii');
the error I seem to be getting is as follows;
Error using var (line 74)Invalid data type. First input argument must be single or double.Error in std (line 59)y = sqrt(var(varargin{:}));Error in untitled8 (line 5)std_val = std(Raw_brain(ind));
Would appreciate any guidance/help
Thanks
Best Answer