Command AimsZcat
Command AimsZcat
Hello,
I write a script which permit to concat two files .mesh and display the result it in Anatomist Window but it 's wrong and I don't know why. Someone could help me
that it's my script:
from neuroProcesses import *
import shfjGlobals
import Anatomist
name = 'Dipole'
userLevel = 0
def validation():
Anatomist.validation()
signature = Signature(
'cyl_mesh',
ReadDiskItem( "Mesh", shfjGlobals.anatomistMeshFormats ),
'sph_mesh', ReadDiskItem( "Mesh", shfjGlobals.anatomistMeshFormats ),
'dip_mesh', WriteDiskItem( "Mesh",shfjGlobals.anatomistMeshFormats ),
)
def initialization( self ):
pass
def execution(delf,context):
a = Anatomist.anatomist()
context.system( 'AimsZcat', '-i', self.cyl_mesh, self.sph, '-o', self.dip_mesh)
cyl_mesh = a.loadObject( self.cyl_mesh )
sph_mesh = a.loadObject( self.sph_mesh )
dip_mesh = a.loadObject( self.dip_mesh )
win = a.createWindow( '3D' )
win.addObject( dip_mesh)
please help me
I write a script which permit to concat two files .mesh and display the result it in Anatomist Window but it 's wrong and I don't know why. Someone could help me
that it's my script:
from neuroProcesses import *
import shfjGlobals
import Anatomist
name = 'Dipole'
userLevel = 0
def validation():
Anatomist.validation()
signature = Signature(
'cyl_mesh',
ReadDiskItem( "Mesh", shfjGlobals.anatomistMeshFormats ),
'sph_mesh', ReadDiskItem( "Mesh", shfjGlobals.anatomistMeshFormats ),
'dip_mesh', WriteDiskItem( "Mesh",shfjGlobals.anatomistMeshFormats ),
)
def initialization( self ):
pass
def execution(delf,context):
a = Anatomist.anatomist()
context.system( 'AimsZcat', '-i', self.cyl_mesh, self.sph, '-o', self.dip_mesh)
cyl_mesh = a.loadObject( self.cyl_mesh )
sph_mesh = a.loadObject( self.sph_mesh )
dip_mesh = a.loadObject( self.dip_mesh )
win = a.createWindow( '3D' )
win.addObject( dip_mesh)
please help me
Could you please give the error message or describe your problem ?
I see two problems here : there is no indentation (but I assume there is in your actual process), and you wrote "def execution(delf,context): " instead of "def execution(self,context): ".
If you want to see the objects after the end of the "execution" function, you should also add "return [cyl_mesh,sph_mesh,dip_mesh,win]" at the end of it, so BrainVisa will not destroy these items.
I see two problems here : there is no indentation (but I assume there is in your actual process), and you wrote "def execution(delf,context): " instead of "def execution(self,context): ".
If you want to see the objects after the end of the "execution" function, you should also add "return [cyl_mesh,sph_mesh,dip_mesh,win]" at the end of it, so BrainVisa will not destroy these items.
Manik Bhattacharjee
INSERM U836
INSERM U836
thank you I changed delf instead of self and I forgot sph_mesh in my script too so now my new script is that:
from neuroProcesses import *
import shfjGlobals
import Anatomist
name = 'Dipole'
userLevel = 0
def validation():
Anatomist.validation()
signature = Signature(
'cyl_mesh',
ReadDiskItem( "Mesh", shfjGlobals.anatomistMeshFormats ),
'sph_mesh', ReadDiskItem( "Mesh", shfjGlobals.anatomistMeshFormats ),
'dip_mesh', WriteDiskItem( "Mesh", shfjGlobals.anatomistMeshFormats ),
# 'head_mesh', ReadDiskItem( "Mesh", shfjGlobals.anatomistMeshFormats ),
# 'dip_head_mesh', WriteDiskItem( "Mesh", shfjGlobals.anatomistMeshFormats )
)
def initialization( self ):
pass
def execution(self,context):
a = Anatomist.anatomist()
context.system( 'AimsZcat', '-i', self.cyl_mesh, self.sph_mesh, '-o', self.dip_mesh)
#context.system( 'AimsZcat', '-i', self.dip_mesh, self.head_mesh, '-o', self.dip_head_mesh )
cyl_mesh = a.loadObject( self.cyl_mesh )
sph_mesh = a.loadObject( self.sph_mesh )
dip_mesh = a.loadObject( self.dip_mesh )
#head_mesh = a.loadObject( self.head_mesh )
#dip_head_mesh = a.loadObject( self.dip_head_mesh )
context.write( 'dipole: ', dip_mesh )
#context.write( 'head_dipole:', dip_head_mesh )
win = a.createWindow( '3D' )
win.addObject( dip_mesh )
return [cyl_mesh, sph_mesh, dip_mesh, win ]
and my error message is
Exception: argument dip_mesh is mandatory
neuroProcessesGUI.py (559) in _startCurrentProcess: apply( self._startProcess, ( self.process, distributed), d)
neuroProcesses.py (820) in _startProcess:
apply( self._setArguments, (_process,)+args, kwargs )
neuroProcesses.py (815) in _setArguments:
_process.checkArguments()
neuroProcesses.py (255) in checkArguments:
raise Exception( _t_('argument <em>%s</em> is mandatory') % p )
Could you help to solve this problem.
from neuroProcesses import *
import shfjGlobals
import Anatomist
name = 'Dipole'
userLevel = 0
def validation():
Anatomist.validation()
signature = Signature(
'cyl_mesh',
ReadDiskItem( "Mesh", shfjGlobals.anatomistMeshFormats ),
'sph_mesh', ReadDiskItem( "Mesh", shfjGlobals.anatomistMeshFormats ),
'dip_mesh', WriteDiskItem( "Mesh", shfjGlobals.anatomistMeshFormats ),
# 'head_mesh', ReadDiskItem( "Mesh", shfjGlobals.anatomistMeshFormats ),
# 'dip_head_mesh', WriteDiskItem( "Mesh", shfjGlobals.anatomistMeshFormats )
)
def initialization( self ):
pass
def execution(self,context):
a = Anatomist.anatomist()
context.system( 'AimsZcat', '-i', self.cyl_mesh, self.sph_mesh, '-o', self.dip_mesh)
#context.system( 'AimsZcat', '-i', self.dip_mesh, self.head_mesh, '-o', self.dip_head_mesh )
cyl_mesh = a.loadObject( self.cyl_mesh )
sph_mesh = a.loadObject( self.sph_mesh )
dip_mesh = a.loadObject( self.dip_mesh )
#head_mesh = a.loadObject( self.head_mesh )
#dip_head_mesh = a.loadObject( self.dip_head_mesh )
context.write( 'dipole: ', dip_mesh )
#context.write( 'head_dipole:', dip_head_mesh )
win = a.createWindow( '3D' )
win.addObject( dip_mesh )
return [cyl_mesh, sph_mesh, dip_mesh, win ]
and my error message is
Exception: argument dip_mesh is mandatory
neuroProcessesGUI.py (559) in _startCurrentProcess: apply( self._startProcess, ( self.process, distributed), d)
neuroProcesses.py (820) in _startProcess:
apply( self._setArguments, (_process,)+args, kwargs )
neuroProcesses.py (815) in _setArguments:
_process.checkArguments()
neuroProcesses.py (255) in checkArguments:
raise Exception( _t_('argument <em>%s</em> is mandatory') % p )
Could you help to solve this problem.
Hi,
If you don't want to give the path like this, how do you want the process to know where to write the file? (is it because you want the file to be created in the same directory as the other files?)
There are several possibilities :
- you will always create the file at the same place with the same name, so you can give a default value to the paramter, but if you don't move the file, it will be overwritten everytime you trigger the process,
- you want the process to guess the path according to the other parameters:
*using the brainvisa hierarchy (located in brainvisa/shfjHierarchy.py), but I don't think it will work because there's no type difference between your arguments,
* extracting the path from the files, working on strings (it's very easy in python to seperate the file name and the path with function like 'split'),
- and last, if you still have problems and if I have some time, I can have a look in the processes to see if this hasn't ever been done,
Bye
If you don't want to give the path like this, how do you want the process to know where to write the file? (is it because you want the file to be created in the same directory as the other files?)
There are several possibilities :
- you will always create the file at the same place with the same name, so you can give a default value to the paramter, but if you don't move the file, it will be overwritten everytime you trigger the process,
- you want the process to guess the path according to the other parameters:
*using the brainvisa hierarchy (located in brainvisa/shfjHierarchy.py), but I don't think it will work because there's no type difference between your arguments,
* extracting the path from the files, working on strings (it's very easy in python to seperate the file name and the path with function like 'split'),
- and last, if you still have problems and if I have some time, I can have a look in the processes to see if this hasn't ever been done,
Bye
Alexis Barbot
CNRS UPR640 LENA
CNRS UPR640 LENA
Hi,
thanks for your replay.
In my script I decide to give a default value the parameter, so I writed in the initialization :
def initialization( self ):
self.dip_mesh('C:\Documents and Settings\Lili\Mes documents\stage canada\dipoles\dip_mesh.mesh')
But I have two error messages:
in hierarchy file C:/Documents and Settings/Lili/Mes documents/stage canada/brainvisa/Brainvisa Data/hierarchy.py IOError: [Errno 2] No such file or directory: 'C:/Documents and Settings/Lili/Mes documents/stage canada/brainvisa/Brainvisa Data/hierarchy.py'
neuroHierarchy.py (1377) in readHierarchies: execfile( p[ 1 ], globals(), hContent )
in hierarchy file C:/Documents and Settings/Lili/Mes documents/stage canada/brainvisa/Brainvisa Data/hierarchy.py IOError: [Errno 2] No such file or directory: 'C:/Documents and Settings/Lili/Mes documents/stage canada/brainvisa/Brainvisa Data/hierarchy.py'
neuroHierarchy.py (1377) in readHierarchies: execfile( p[ 1 ], globals(), hContent )
But I don't anderstand why. So if you have any time could you help me to solve my problem
thanks for your replay.
In my script I decide to give a default value the parameter, so I writed in the initialization :
def initialization( self ):
self.dip_mesh('C:\Documents and Settings\Lili\Mes documents\stage canada\dipoles\dip_mesh.mesh')
But I have two error messages:
in hierarchy file C:/Documents and Settings/Lili/Mes documents/stage canada/brainvisa/Brainvisa Data/hierarchy.py IOError: [Errno 2] No such file or directory: 'C:/Documents and Settings/Lili/Mes documents/stage canada/brainvisa/Brainvisa Data/hierarchy.py'
neuroHierarchy.py (1377) in readHierarchies: execfile( p[ 1 ], globals(), hContent )
in hierarchy file C:/Documents and Settings/Lili/Mes documents/stage canada/brainvisa/Brainvisa Data/hierarchy.py IOError: [Errno 2] No such file or directory: 'C:/Documents and Settings/Lili/Mes documents/stage canada/brainvisa/Brainvisa Data/hierarchy.py'
neuroHierarchy.py (1377) in readHierarchies: execfile( p[ 1 ], globals(), hContent )
But I don't anderstand why. So if you have any time could you help me to solve my problem
I don't think this the right way to write a default value, you should do it like that :
Code: Select all
def initialization( self ):
self.dip_mesh='C:\Documents and Settings\Lili\Mes documents\stage canada\dipoles\dip_mesh.mesh'
Alexis Barbot
CNRS UPR640 LENA
CNRS UPR640 LENA
- riviere
- Site Admin
- Posts: 1361
- Joined: Tue Jan 06, 2004 12:21 pm
- Location: CEA NeuroSpin, Saint Aubin, France
- Contact:
Hi,
For the anatomist problem:
Are you sure you have not mixed two incompatible brainvisa/anatomist versions ? (maybe you changed the anatomistExecutable setting ?)
Or it might be a communication problem between BV and anatomist (it has sometimes been reported on computers with "strange" network settings).
Does anatomist work with other data using "standard" viewers from brainvisa ?
Anyway you could check the log, in the "communications with anatomist" section, you may have some information there.
Denis
For the anatomist problem:
Are you sure you have not mixed two incompatible brainvisa/anatomist versions ? (maybe you changed the anatomistExecutable setting ?)
Or it might be a communication problem between BV and anatomist (it has sometimes been reported on computers with "strange" network settings).
Does anatomist work with other data using "standard" viewers from brainvisa ?
Anyway you could check the log, in the "communications with anatomist" section, you may have some information there.
Denis