SPM99 Gem 21 is the same (with minor changes).
Subject: Re: a script to use ImaCal From: John Ashburner Date: Thu, 16 Oct 2003 11:24:17 +0000 (07:24 EDT) To: SPM@JISCMAIL.AC.UK > Brain image for each subject to mask out CSF signal was generated by > using MPR_seg1.img (i1) and MPR_seg2.img (i2) with (i1+i2)>0.5 in > ImaCal.(called brainmpr.img for each subject) > > Then I have more than two-hundred maps, which need to mask out > CSF. I think I can use ImaCal again with selecting brainmpr.img (i1) > and FAmap.img (i1), and then calculating (i1.*i2) to generate a new > image named as bFAmap.img. Unfortunately, if I use the ImaCal, it > take so long time to finish all subjects. Could anyone have a script > to generate a multiplication imaging with choosing a brain > image(brainmpr.img, i1) and a map image (FAmap.img, i2) and writing > an output image (bFAmap.img) from i1.*i2? You can do this with a script in Matlab. Something along the lines of the following should do it: P1=spm_get(Inf,'*.IMAGE','Select i1'); P2=spm_get(size(P1,1),'*.IMAGE','Select i2'); for i=1:size(P1,1), P = strvcat(P1(i,:),P2(i,:))); Q = ['brainmpr_' num2str(i) '.img']; f = '(i1+i2)>0.5'; flags = {[],[],[],[]}; Q = spm_imcalc_ui(P,Q,f,flags); end; Note that I have not tested the above script. I'm sure you can fix it if it doesn't work. Best regards, -John
One thought on “SPM2 Gem 8: ImCalc Script”