Jfortin1 / ComBatHarmonization

Harmonization of multi-site imaging data with ComBat
268 stars 107 forks source link

How to deal with .nii files directly? #43

Open xiuwang0614 opened 1 year ago

xiuwang0614 commented 1 year ago

Hi, sorry for bothering. I am WangRong. The codes you provided are very useful! :) But I have some questions. I want to do combat harmonization for .nii files directly, because I want to do Independent Components Analysis, moreover, the parameter needed to group-level analysis is too much.

I tried following codes: a = load_nifti('I:\combatdemo\411.nii'); b = load_nifti('I:\combatdemo\CDP.nii'); p = {a,b}; n = 2; dat = repmat(p,n,1);

But results give me lots of error: var (第 164 行) y = sum(abs(x - sum(x,dim)./n).^2, dim) ./ denom; std (第 59 行) y = sqrt(var(varargin{:})); combat (第 9 行) [sds] = std(dat')'; Because sum should be used for a numeric or logical value.

I was wondering if you could tell me how to solve my problem. Thank you very much!