Print

Print


Thanks to Donald for highlighting that my expression was indeed for 3 images, this was how Aser asked the question and I was lazy and did not make it generic. The following line works for any positive number of t-maps (or other images):


[1:size(X,1)]*(X==repmat(max(X),[size(X,1),1]))


Best
Torben




Den Uge:23 05/06/2014 kl. 19.51 skrev MCLAREN, Donald <[log in to unmask]>:

This code is specific to 3 images.

For 2 images: [1 2]*(X==repmat(max(X),[2,1]))
For 3 images: [1 2 3]*(X==repmat(max(X),[3,1]))
For 4 images: [1 2 3 4]*(X==repmat(max(X),[4,1]))
etc.

I just tested the code in SPM8.

Best Regards, Donald McLaren
=================
D.G. McLaren, Ph.D.
Research Fellow, Department of Neurology, Massachusetts General Hospital and
Harvard Medical School
Postdoctoral Research Fellow, GRECC, Bedford VA
Website: http://www.martinos.org/~mclaren
Office: (773) 406-2464
=====================
This e-mail contains CONFIDENTIAL INFORMATION which may contain PROTECTED
HEALTHCARE INFORMATION and may also be LEGALLY PRIVILEGED and which is
intended only for the use of the individual or entity named above. If the
reader of the e-mail is not the intended recipient or the employee or agent
responsible for delivering it to the intended recipient, you are hereby
notified that you are in possession of confidential and privileged
information. Any unauthorized use, disclosure, copying or the taking of any
action in reliance on the contents of this information is strictly
prohibited and may be unlawful. If you have received this e-mail
unintentionally, please immediately notify the sender via telephone at (773)
406-2464 or email.


On Thu, Jun 5, 2014 at 1:29 PM, Aser A <[log in to unmask]> wrote:
I have the same windows/batch that you suggested and used SPM8 and 12 but still receive the same error:
Matrix dimensions must agree.
Can't evaluate "[1 2 3]*(X==repmat(max(X),[3,1]))".

In the beginning I entered two T maps in the input and then tried four maps, which I want, but still no luck

Aser


On Thu, Jun 5, 2014 at 3:35 PM, Torben Lund <[log in to unmask]> wrote:
Maybe it is due to different SPM versions, try setting up the imcalc job yourself it should look like the attached screen shots:

<Skærmbillede 2014-06-05 kl. 16.35.29.png><Skærmbillede 2014-06-05 kl. 16.32.59.png><Skærmbillede 2014-06-05 kl. 16.32.50.png>


Torben Ellegaard Lund
Associate Professor, PhD
Center of Functionally Integrative Neuroscience (CFIN)
Aarhus University
Aarhus University Hospital
Building 10G, 5th floor, room 31
Noerrebrogade 44
8000 Aarhus C
Denmark
Phone: +45 7846 4380
Fax: +45 7846 4400
http://www.cfin.au.dk
[log in to unmask]





Den Uge:23 05/06/2014 kl. 16.21 skrev Aser A <[log in to unmask]>:

Thanks all for your response. I have tried your way Colin but will try it and hope it works. The only issue is that I would not get an image with this way rather just values.

So I hope that if I have say four T maps, I can create a one map that includes the highest T values in each region ...etc. 

Torben I tried you batch but it gives me this message:

Failed  'Image Calculator'
Error using spm_imcalc (line 101)
Can't evaluate "[1 2 3]*(X==repmat(max(X),[3,1]))".
In file "/Users/adnan/Documents/SPMs/spm8/spm_imcalc.m" (v1143), function "spm_imcalc" at line 101.
In file "/Users/adnan/Documents/SPMs/spm8/spm_imcalc_ui.m" (v3691), function "spm_imcalc_ui" at line 159.
In file "/Users/adnan/Documents/SPMs/spm8/config/spm_cfg_imcalc.m" (v4385), function "my_spm_imcalc_ui" at line 174.

No executable modules, but still unresolved dependencies or incomplete module inputs.
The following modules did not run:
Failed: Image Calculator
Skipped: Check Registration



On Thu, Jun 5, 2014 at 2:54 PM, Torben Lund <[log in to unmask]> wrote:
Hi Asher

Attached is a batch job which implements what I described in my previous mail, just click the bacth button, select your t-maps and press run.

Best
Torben




Torben Ellegaard Lund
Associate Professor, PhD
Center of Functionally Integrative Neuroscience (CFIN)
Aarhus University
Aarhus University Hospital
Building 10G, 5th floor, room 31
Noerrebrogade 44
8000 Aarhus C
Denmark
Phone: +45 7846 4380
Fax: +45 7846 4400
http://www.cfin.au.dk
[log in to unmask]





Den Uge:23 05/06/2014 kl. 15.15 skrev Torben Lund <[log in to unmask]>:

Dear Aser

While imcalc can take multiple images as imput i can, unfortunately, only return one output. So the solution is to make two imcalc jobs. To make an image which is the maximal of 3 t-tvalues, those the option "read images into datamatrix -Yes" and enter max(X) as the function. To get the corresponding indices set up the other imcalc job with another output name, but also with "read images into datamatrix -Yes" and enter the following equation:

[1 2 3]*(X==repmat(max(X),[3,1]))

This should give you a image with values 1 2 3 . Remember to use NN interpolation when looking at the images.

Best
Torben





Torben Ellegaard Lund
Associate Professor, PhD
Center of Functionally Integrative Neuroscience (CFIN)
Aarhus University
Aarhus University Hospital
Building 10G, 5th floor, room 31
Noerrebrogade 44
8000 Aarhus C
Denmark
Phone: +45 7846 4380
Fax: +45 7846 4400
http://www.cfin.au.dk
[log in to unmask]





Den Uge:23 04/06/2014 kl. 18.12 skrev Aser A <[log in to unmask]>:

Hello all, 

If I have four regressors at the group level ( and each has con and t maps), I would like a way of selecting the highest T-values for each voxel. 

For example: 

If A gives me a t value of 5 in -34 60 10 
and B gives me a t value of 4 in the same coordinate, then I want away of returning only a map contains the B result AND telling me that this B. 

Can I do this with ImCalc or peak nii, your help is appreciated 


Thanks

Aser