Thanks Marina, Joe, Cinly
I had somehow forgotten about spm_vol - so I should be sorted, thanks
all of you! After that I have code for finding clusters within a
mapped volume (I used spm_max which does use 18 connectivity but this
can easily be edited where it calls spm_bwlabel). Must take a holiday!
all the best
Alexa
Quoting Marina <[log in to unmask]>:
>
> Hi Alexa,
>
> this is quite simple to do in matlab, though there is a bit of fiddling
> around involved.
>
> 1. Read the image in a matrix (use spm_read_vols)
> 2. and create a binary mask using a threshold that you think is suitable.
> 3. You can identify the different clusters by using the function
> "bwlabeln". This function basically labels connected components in
> binary images (your mask) and you can also specify the connectivity,
> e.g. 8, 26 etc. Look at the help information in matlab. If I am not
> mistaken SPM uses 18 connectivity (but I may be remembering wrong.
> Please correct me).
>
> The output of the functions is a matrix (same dimensions as the input)
> with voxels labeled according to the cluster they belong to.
>
> 4. You can then use "find" to get the voxel coordinates for each
> cluster, e.g. find(mask == 1) for cluster 1.
>
> This way you can also count the number of voxels per cluster (the length
> of the index) and you can also use the output from "find" to extract the
> statistical values from your original statistical image. To get an index
> that is for 3-D images, you can use "ind2sub". To get the peak value
> just use "max" on the extracted values and use the index from "max" to
> get the voxel coordinates.
>
> Does that make any sense? Sorry for not sending a script, but I don't
> have one for exactly what you are asking. Let me know if you have
> trouble writing it though. I'll be happy to help out. I am still in
> Edinburgh.
>
> I hope you are well,
> Marina
>
> Alexa Morcom wrote:
>> Hello list people
>>
>> Has anyone out there written code to extract image values - ideally
>> cluster sizes and peak values/ locations - from a 'raw' statistical
>> image? I have some images processed outside SPM that I'd like to explore
>> in this way; they're in .nii format.
>>
>> Thanks!
>>
>> Alexa Morcom
>>
>>
>> -------
>>
>> Dr. Alexa Morcom
>> Department of Psychology/ Centre for Cognitive and Neural Systems
>> University of Edinburgh
>> 1 George Square
>> Edinburgh EH8 9JZ
>>
>> Tel: +44131 9511907 (ext. 511907)
>> Fax: +44131 650 4572
>>
>> The University of Edinburgh is a charitable body, registered in
>> Scotland, with registration number SC005336
>>
>>
>>
>>
>
>
--
The University of Edinburgh is a charitable body, registered in
Scotland, with registration number SC005336.
|