Calling "Import FreeSurfer grey/white segmentation to Morphologist" from a script

Questions about BrainVisa usage and installation

Moderators: riviere, denghien

francois
Posts: 61
Joined: Tue Jul 25, 2017 9:37 am

Calling "Import FreeSurfer grey/white segmentation to Morphologist" from a script

Postby francois » Fri May 18, 2018 5:57 pm

Hello,

I'm trying to call "Import FreeSurfer grey/white segmentation to Morphologist" from a Python script, but I don't know how to get the links propagated.
If I use the BrainVISA interface, I can select T1_orig and T1_output only, and all the other linked parameters are filled automatically.
How do I get the same thing from a script, using runProcess?

Code: Select all

self.brainvisaContext.runInteractiveProcess(None, 'Import FreeSurfer grey/white segmentation to Morphologist', T1_orig=..., T1_output=...)
self.brainvisaContext.runProcess('Import FreeSurfer grey/white segmentation to Morphologist', T1_orig=..., T1_output=...)

Exception: Mandatory argument <em>ribbon_image</em> has no value

Code: Select all

processImport = getProcessInstance('Import FreeSurfer grey/white segmentation to Morphologist')
processImport.setValue('T1_orig', ...)
processImport.setValue('T1_output', ...)
self.brainvisaContext._processExecution(processImport)

This seems to fill all the parameters correctly, but crashes at the first call to launchFreesurferCommand():

Code: Select all

Process Import FreeSurfer grey/white segmentation to Morphologist started on
2018/05/18 18:52
Convert .mgz to .nii with FreeSurfer
ERROR in Import FreeSurfer grey/white segmentation to Morphologist 1 FreeSurfer
not available or one freesurfer command line has failed. Please see the log file
in the main menu of BrainVISA for more information.


I tried so many different combinations of things, and couldn't get this to work. But if I run it interactively from BrainVISA, it works...

Thanks
François

User avatar
riviere
Site Admin
Posts: 1358
Joined: Tue Jan 06, 2004 12:21 pm
Location: CEA NeuroSpin, Saint Aubin, France
Contact:

Re: Calling "Import FreeSurfer grey/white segmentation to Morphologist" from a script

Postby riviere » Mon May 21, 2018 10:34 pm

Hi,
It should normally work as you had expected but it may behave differently if databases have been disabled at startup in your script. As I don't know how it starts, I cannot really tell...
If databases are enabled and setup (you need a Freesurfer database and a Morphologist database for the process you want to use), completion should take place in any of the following uses:

Code: Select all

contex.runProcess('Import_FROM_FreeSurfer_TO_Morpho', T1_orig=..., T1_output=...)

Code: Select all

proc = getProcessInstance('Import_FROM_FreeSurfer_TO_Morpho')
proc.T1_orig = ...
proc.T1_output = ...
# at this point other parameters should be already filled and can be print
context.runProcess(proc)

Code: Select all

proc = getProcessInstance('Import_FROM_FreeSurfer_TO_Morpho')
context.runProcess(proc, , T1_orig=..., T1_output=...)

The paths you are using should be valid within the selected databases (and should not be symlinks with different paths even if they end up to the same files).
Denis

francois
Posts: 61
Joined: Tue Jul 25, 2017 9:37 am

Re: Calling "Import FreeSurfer grey/white segmentation to Morphologist" from a script

Postby francois » Tue May 22, 2018 3:08 pm

I found my error:
I was passing the orig.mgz from a folder that was not in the local freesurfer database. No wonder it was not finding the associated files...

Well, at least now I know in details all the ways to call processes and pass them parameters :)

Thanks
Francois


Return to “BrainVISA”

Who is online

Users browsing this forum: No registered users and 2 guests