Hemispheres merge
Hemispheres merge
Hi,
I have done a segmentation of a MRI picture of brain, so i got two different GIS pictures (one for left, one for right hemisphere).
But i want with to merge those two pictures to make only one with both hemispheres of the brain.
Does someone know if there is an Aims or Vip command able to do that ?
I have done a segmentation of a MRI picture of brain, so i got two different GIS pictures (one for left, one for right hemisphere).
But i want with to merge those two pictures to make only one with both hemispheres of the brain.
Does someone know if there is an Aims or Vip command able to do that ?
- Jean-Francois Mangin
- Posts: 337
- Joined: Mon Mar 01, 2004 10:24 am
- Location: Neurospin, CEA, France
- Contact:
- Jean-Francois Mangin
- Posts: 337
- Joined: Mon Mar 01, 2004 10:24 am
- Location: Neurospin, CEA, France
- Contact:
You can find some grey/white classification images in the pipeline.
A low tech one: L or Rgrey_white_ammon.ima,
A high tech one dedicated to the spherical grey/white interface.
R or Lcortex_ammon.ima.
A priori, the first one is more reliable, but this depends
on the quality of your data.
IF you want only grey matter, you can do a threshold:
"VipSingleThreshold -i image -t value_of_grey -mode eq -color b -o result"
To find more useful commandlines go there:
http://brainvisa.info/doc/html/shfjcomm ... mands.html
A low tech one: L or Rgrey_white_ammon.ima,
A high tech one dedicated to the spherical grey/white interface.
R or Lcortex_ammon.ima.
A priori, the first one is more reliable, but this depends
on the quality of your data.
IF you want only grey matter, you can do a threshold:
"VipSingleThreshold -i image -t value_of_grey -mode eq -color b -o result"
To find more useful commandlines go there:
http://brainvisa.info/doc/html/shfjcomm ... mands.html
- Yann Cointepas
- Posts: 316
- Joined: Tue Jan 20, 2004 2:56 pm
- Location: Neurospin, Saint Aubin, France
- Contact:
I would recomand to use the more up-to-date AimsThreshold command:
Code: Select all
AimsThreshold -i image -t value_of_grey -m eq -b -o result
-
- Posts: 7
- Joined: Tue Mar 27, 2007 2:08 pm
- Location: france
error in execution
hi,
i'm trying to write a code on python to add it like the pipeline of segmentation.
i used the same functions that u said before. but i'm not a good programer, so whenever i excecute they say that it is not working.
this is the code i used:
from neuroProcesses import *
import shfjGlobals, shelltools
name = 'Extract Grey and white matter'
userLevel=0
signature=Signature(
'left_grey_white', ReadDiskItem( 'Left Grey White Mask', 'GIS Image' ),
'right_grey_white', ReadDiskItem( 'Right Grey White Mask', 'GIS Image' ),
'grey', WriteDiskItem( 'Grey White Mask', 'GIS Image' ),
'white', WriteDiskItem( 'Grey White Mask', 'GIS Image' ),
)
# def initialization( self ):
def execution( self, context ):
temp = context.temporary ( 'GIS Image' )
context.system( 'VipMerge', '-i', self.left_grey_white, '-m',
self.right_grey_white, '-c', 's', '-o',
temp )
context.system( 'AimsThreshold', '-i', temp, '-t',
50, '-m', 'eq', '-b', 'o', self.grey() )
context.system( 'AimsThreshold', '-i', temp, '-t',
100, '-m', 'eq', '-b', 'o',
self.white() )
can u tell me what is wrong and what should i do?
with this code, i'm trying to merge 2 images that i got from the pipeline 2004 left anf right grey and white matter, then extract only the white matter and in another image only the grey matter
thank you a lot for ur help
i'm trying to write a code on python to add it like the pipeline of segmentation.
i used the same functions that u said before. but i'm not a good programer, so whenever i excecute they say that it is not working.
this is the code i used:
from neuroProcesses import *
import shfjGlobals, shelltools
name = 'Extract Grey and white matter'
userLevel=0
signature=Signature(
'left_grey_white', ReadDiskItem( 'Left Grey White Mask', 'GIS Image' ),
'right_grey_white', ReadDiskItem( 'Right Grey White Mask', 'GIS Image' ),
'grey', WriteDiskItem( 'Grey White Mask', 'GIS Image' ),
'white', WriteDiskItem( 'Grey White Mask', 'GIS Image' ),
)
# def initialization( self ):
def execution( self, context ):
temp = context.temporary ( 'GIS Image' )
context.system( 'VipMerge', '-i', self.left_grey_white, '-m',
self.right_grey_white, '-c', 's', '-o',
temp )
context.system( 'AimsThreshold', '-i', temp, '-t',
50, '-m', 'eq', '-b', 'o', self.grey() )
context.system( 'AimsThreshold', '-i', temp, '-t',
100, '-m', 'eq', '-b', 'o',
self.white() )
can u tell me what is wrong and what should i do?
with this code, i'm trying to merge 2 images that i got from the pipeline 2004 left anf right grey and white matter, then extract only the white matter and in another image only the grey matter
thank you a lot for ur help
- riviere
- Site Admin
- Posts: 1361
- Joined: Tue Jan 06, 2004 12:21 pm
- Location: CEA NeuroSpin, Saint Aubin, France
- Contact:
Hi,
Well, we normally do not have time to debug everybody's programs... especially if the exact error message is not provided: "it is not working" is just not enough for us to understand where and why your program fails (and here python indentation is not preserved so we cannot see if it is OK or not).
But just at first glance, it seems that you are using processes parameters as functions (or methods): self.grey(), but they are not functions actually: they are variables: self.grey would work better here.
Denis
Well, we normally do not have time to debug everybody's programs... especially if the exact error message is not provided: "it is not working" is just not enough for us to understand where and why your program fails (and here python indentation is not preserved so we cannot see if it is OK or not).
But just at first glance, it seems that you are using processes parameters as functions (or methods): self.grey(), but they are not functions actually: they are variables: self.grey would work better here.
Denis
- Yann Cointepas
- Posts: 316
- Joined: Tue Jan 20, 2004 2:56 pm
- Location: Neurospin, Saint Aubin, France
- Contact:
Whenever you use a DiskItem object in a system call (for instance temp, self.left_grey_white, self.grey, etc. in your process), I would recommand to use fullPath method for Aims commands and fullName method for Vip commands. The difference is that fullName does not include the file extension (Vip commands do not want the extension). Here is a quickly copy/pasted/modified sample of your process:
context.system( 'VipMerge', '-i', self.left_grey_white.fullName(), '-m',
self.right_grey_white.fullName(), '-c', 's', '-o',
temp.fullName() )
context.system( 'AimsThreshold', '-i', temp.fullPath(), '-t',
50, '-m', 'eq', '-b', 'o', self.grey.fullPath() )
context.system( 'AimsThreshold', '-i', temp.fullPath(), '-t',
100, '-m', 'eq', '-b', 'o',
self.white.fullPath() )
However, fullPath usage is not mandatory(since it is impicitely used when a DiskItem is converted to a string to build the command line. In that case you can directly use the DiskItem without parentheses.
context.system( 'VipMerge', '-i', self.left_grey_white.fullName(), '-m',
self.right_grey_white.fullName(), '-c', 's', '-o',
temp.fullName() )
context.system( 'AimsThreshold', '-i', temp.fullPath(), '-t',
50, '-m', 'eq', '-b', 'o', self.grey.fullPath() )
context.system( 'AimsThreshold', '-i', temp.fullPath(), '-t',
100, '-m', 'eq', '-b', 'o',
self.white.fullPath() )
However, fullPath usage is not mandatory(since it is impicitely used when a DiskItem is converted to a string to build the command line. In that case you can directly use the DiskItem without parentheses.
-
- Posts: 7
- Joined: Tue Mar 27, 2007 2:08 pm
- Location: france
bonjour,
premièrement merci pour votre aide.
j'ai fait ce que vous m'aviez dit, j'ai reécrit le code que vous m'avez donné mais ca n'a pas marché, il m'a donné le message d'erreur suivant:
Traitement Extract Grey and white matter 1 démarré sur 2007/05/24 17:35<bound method File.fullPath of 'C:\\Program Files\\SHFJ_pack-stable-win32-3.0.2\\a.ima'> is not a valid number
dans Extract Grey and white matter 1 RuntimeError: Commande système terminée avec une valeur non nulle : 1
neuroProcesses.py (1641) in _processExecution:
result = process.execution( self )
ExtractGreyWhite.py (59) in execution:
50, '-m', 'eq', '-b', 'o', self.grey.fullPath )
neuroProcessesGUI.py (932) in system:
ret = apply( ExecutionContextGUI.system, (self,) + args, kwargs )
neuroProcesses.py (1721) in system:
raise RuntimeError( _t_( 'System command exited with non null value : %s' ) % str( ret ) )
j'ai essayer les 2 methodes avec et sans les parenthèses pres de fullpath, mais il me dit la même chose.
que dois-je faire?
je vous remercie pour l'aide
premièrement merci pour votre aide.
j'ai fait ce que vous m'aviez dit, j'ai reécrit le code que vous m'avez donné mais ca n'a pas marché, il m'a donné le message d'erreur suivant:
Traitement Extract Grey and white matter 1 démarré sur 2007/05/24 17:35<bound method File.fullPath of 'C:\\Program Files\\SHFJ_pack-stable-win32-3.0.2\\a.ima'> is not a valid number
dans Extract Grey and white matter 1 RuntimeError: Commande système terminée avec une valeur non nulle : 1
neuroProcesses.py (1641) in _processExecution:
result = process.execution( self )
ExtractGreyWhite.py (59) in execution:
50, '-m', 'eq', '-b', 'o', self.grey.fullPath )
neuroProcessesGUI.py (932) in system:
ret = apply( ExecutionContextGUI.system, (self,) + args, kwargs )
neuroProcesses.py (1721) in system:
raise RuntimeError( _t_( 'System command exited with non null value : %s' ) % str( ret ) )
j'ai essayer les 2 methodes avec et sans les parenthèses pres de fullpath, mais il me dit la même chose.
que dois-je faire?
je vous remercie pour l'aide
-
- Posts: 7
- Joined: Tue Mar 27, 2007 2:08 pm
- Location: france
excuse me for my mistake, i forgot that i should write in english
hi,
first thank you for all ur help.
i did what u told me to do, i wrote the code that u gave me but it did not work, it gave me the following error message:
Traitement Extract Grey and white matter 1 démarré sur 2007/05/24 17:35<bound method File.fullPath of 'C:\\Program Files\\SHFJ_pack-stable-win32-3.0.2\\a.ima'> is not a valid number
dans Extract Grey and white matter 1 RuntimeError: Commande système terminée avec une valeur non nulle : 1
neuroProcesses.py (1641) in _processExecution:
result = process.execution( self )
ExtractGreyWhite.py (59) in execution:
50, '-m', 'eq', '-b', 'o', self.grey.fullPath )
neuroProcessesGUI.py (932) in system:
ret = apply( ExecutionContextGUI.system, (self,) + args, kwargs )
neuroProcesses.py (1721) in system:
raise RuntimeError( _t_( 'System command exited with non null value : %s' ) % str( ret ) )
i tried the 2 methods with and without the parenteses next to fullpath, but the error messege is the same.
what shoud i do?
thank you for all your help
hi,
first thank you for all ur help.
i did what u told me to do, i wrote the code that u gave me but it did not work, it gave me the following error message:
Traitement Extract Grey and white matter 1 démarré sur 2007/05/24 17:35<bound method File.fullPath of 'C:\\Program Files\\SHFJ_pack-stable-win32-3.0.2\\a.ima'> is not a valid number
dans Extract Grey and white matter 1 RuntimeError: Commande système terminée avec une valeur non nulle : 1
neuroProcesses.py (1641) in _processExecution:
result = process.execution( self )
ExtractGreyWhite.py (59) in execution:
50, '-m', 'eq', '-b', 'o', self.grey.fullPath )
neuroProcessesGUI.py (932) in system:
ret = apply( ExecutionContextGUI.system, (self,) + args, kwargs )
neuroProcesses.py (1721) in system:
raise RuntimeError( _t_( 'System command exited with non null value : %s' ) % str( ret ) )
i tried the 2 methods with and without the parenteses next to fullpath, but the error messege is the same.
what shoud i do?
thank you for all your help
- riviere
- Site Admin
- Posts: 1361
- Joined: Tue Jan 06, 2004 12:21 pm
- Location: CEA NeuroSpin, Saint Aubin, France
- Contact:
There is a mistake in the output file parameter of AimsTheshold:
the '-' is missing on the 'o' switch, should be:
this can explain that self.grey is not understood as the output filename, but here the output filename is 'o' and self.grey is understood as the following parameter not already specified, namely the '-u' parameter: second threshold, which should be a numeric value, hence the error.
Denis
Code: Select all
context.system( 'AimsThreshold', '-i', temp.fullPath(), '-t',
50, '-m', 'eq', '-b', 'o', self.grey.fullPath() )
Code: Select all
context.system( 'AimsThreshold', '-i', temp.fullPath(), '-t',
50, '-m', 'eq', '-b', '-o', self.grey.fullPath() )
Denis
-
- Posts: 7
- Joined: Tue Mar 27, 2007 2:08 pm
- Location: france
hi
hi
thanks for the help it worked without any errors.
but now i have another problem:
for the grey matter the code worked perfectly, i saw the grey matter alone on a window by itself.
but the whithe matter did not work, i only see a black screen.
the code for the white matter was:
context.system( 'AimsThreshold', '-i', temp.fullPath(), '-t',
100, '-m', 'eq', '-b', '-o', self.grey.fullPath() )
instead of the grey value 50 i changed it and replaced it by 100 the value of white matter that i know.
what should i do to make it work for the white matter?
thanks for your help
thanks for the help it worked without any errors.
but now i have another problem:
for the grey matter the code worked perfectly, i saw the grey matter alone on a window by itself.
but the whithe matter did not work, i only see a black screen.
the code for the white matter was:
context.system( 'AimsThreshold', '-i', temp.fullPath(), '-t',
100, '-m', 'eq', '-b', '-o', self.grey.fullPath() )
instead of the grey value 50 i changed it and replaced it by 100 the value of white matter that i know.
what should i do to make it work for the white matter?
thanks for your help