Page 1 of 1

averaging ROIs

Posted: Thu Mar 15, 2007 3:36 pm
by Narly
Hello,
Appologies in advance for this basic question. I want to make a mean image of several ROIs that I have labelled using anatomist (*ima files). These ROIs do overlap (I checked this by fusing them), and are binary. I used 'AimsAverage -i *ima -o mean.ima', but the output image is also a binary image, and does not look like the average of the input ones. What am I doing wrong?
thanks,
Narly.

Posted: Fri Mar 16, 2007 9:48 am
by denghien
Hi ,

It seems logic :)
You can obtain the grey levels of the image which correspond to the mask by using AimsMask.

Code: Select all

AimsMask -i initial_data.ima -m mask_binary.ima -o data_to_sum.ima
So after the mask drawing and before AimsAverage, use AimsMask to preserve the grey levels.

Isa

Posted: Fri Mar 16, 2007 10:39 am
by Narly
Hi Isa,
I want to simply average the binary files in order to have the 'probabilistic map' of this particular structure. I don't think that what you described does this - I don't want to use the mask to obtain the original T1 signal intensities witihin the mask. This is why I appologised for the simplicity of the question :oops:
thanks in advance for your help,
Narly.

Posted: Fri Mar 16, 2007 10:50 am
by denghien
Ok so you want to sum the masks and not to do an average ?

Posted: Fri Mar 16, 2007 11:00 am
by denghien
I don't understand very well how AimsAverage works.
I'm going to look at the command.

Isa

Posted: Fri Mar 16, 2007 11:32 am
by Narly
Hi again,
I think that summing the images would be OK, how can I do this?
thanks,
Narly.

Posted: Fri Mar 16, 2007 12:17 pm
by denghien
Ok, here is a documentation extract for the next aims tutorial :


Code: Select all


AimsLinearComb: sum 2 activation maps

OPTIONS:

AimsLinearComb: linear combination a.I1/b + c.I2/d + e. Note : a, b, c, d, and e must be real.

------------------------------------------------------------------
AimsLinearComb  -i <i1>  [-a <num1>] [-b <den1>]
[-j <i2>  [-c <num2>] [-d <den2>]]
[-e <cst>]
-o[utput] <fileout>
[-t[ype] <datatype>
[-h[elp]]
------------------------------------------------------------------
Linear combination a.I1/b + c.I2/d  + e

Note : a,b,c,d,e must be real
------------------------------------------------------------------
i1      : first data (volume or texture)
num1    : multiplicative coefficient for the first data [1.0]
den1    : divisor coefficient for the first data [1.0]
i2      : second data (volume or texture)
(if none, linear combination a.I1/b)
num2    : multiplicative coefficient for the second data[1.0]
den2    : divisor coefficient for the second data [1.0]
cst     : constant offset value [default=0.0]
fileout : destination data
datatype: data type of the destination volume/texture (S16, U8, ...)
[default=type of in1]
For texture, i1, i2 and fileout must have the same type
------------------------------------------------------------------

EXAMPLE: Sum of 2 activation maps. For instance, if you have 2 binary activation maps which have been obtained by functional analysis, and if you want to do a fusion of both, then you can create a new volume which will be the sum of map_I and map_II.

prompt% AimsLinearComb -i map_I.img -j map_II.img -o map_I+II.img
	options parsed
	i1      : map_I.img
	a       : 1
	b       : 1
	c       : 1
	d       : 1
	e       : 0
	i2      : map_II.img
	fileout : map_I+II.img
	type    :
	Reading image map_I.img...
	done
	reading image map_II.img...
	done
	processing...
	done
	writing result...
	done



NOTE: image dimensions must be the same.

NOTE: you can use this command line to add several volumes; first add up map_I and map_II to create map_I+II and if you have a third volume, map_III to fusion with map_I and map_II, then you can use AimsLinearComb with map_I+II and map_III.




Hope that helps.

Isa

Posted: Fri Mar 16, 2007 1:31 pm
by Narly
thank you, this works!
Narly.

Posted: Fri Mar 16, 2007 1:33 pm
by denghien
Great :)

Posted: Mon Mar 19, 2007 4:21 pm
by riviere
Hi,
I guess your problem with AimsAverage was due to the integer output data type: if your input images only contain values 0 (background) and 1 (ROI), the average values should be floating point values (0.5 for instance). But if you write int16 data, the values will be truncated (so you will get 0). Try with the -t FLOAT option to force a floating point output image.
AimsLinearComb will also work, but it only accepts 2 input images, so if you have 3 or more, you will need to call it several times, so AimsAverage should be more convenient in your case.
Denis