Code Monkey home page Code Monkey logo

tvb-recon's Introduction


The Virtual Brain
Reconstruction pipeline

This pipeline is offering a solution to build full brain network models starting from standard structural MR scans.

Gitter

Folder structureData structureHow to launchHow to rerunEnvironment


It is used to preprocess the MR scans in order to get actual files that are compatible with TVB. The result can be later uploaded in TVB or used independently for modeling.

The mandatory inputs are DWI and T1 scans. Optionally, CT scans can be given as input, if sensors preprocessing is needed.

We are using the Pegasus WMS in order to connect and automatize the pipeline steps. Pegasus is distributed under the Apache v2.0 license, while our own code is GPL v3.

Illustration of pipeline input and output based on imaging data of one subject.
Image taken from article [2],Bibliography.

Folder structure

  • data
    Here is where we keep some example data files. Some of them are intermediate files generated during the pipeline run. There is also a minimal set of files that defines a TVB head. These files are currently used only for tests.
  • docs
    This folder holds some visual hints of the dependencies between the pipeline steps.
    For example, there is an overview diagram representing the pipeline stages.
    These stages are defined by scripts that can be found inside the bin folder. These scripts are no longer maintained, nor used directly in the pipeline run. They belong under "docs" because they are now used only for documentation purposes, or for some extreme partial debugging.
    On the other hand, there is also an example graph diagram which is displaying more detailed steps. This kind of diagram is automatically generated at each pipeline run.
  • pegasus
    All the configuration files necessary for the software run are kept here.
    At the first level, there are the entry points which are explained below in the Entry Point section.
    Inside the config folder, there is a folder called scripts. This holds bash files with calls to pipeline commands that need some specific environment configuration. These bash files should not be changed, neither their names, because they are mapped inside the workflow.
    The config folder also contains the configuration files which are patient-specific. These are the only files that will change for each run and/or patient. The possible configurations are explained in How to launch section.
  • provision
    Inside this folder, you can find more details about the project dependencies.
  • tvb
    Actual python implementation is kept here.
    Package dax is using the Pegasus API to define a pipeline workflow and generate the jobs graph.
    Inside algo package, we have all the computations, services and algorithms used during the pipeline steps. Here we also have the reconutils.py which defines an API for calls made from the config/scripts bash files.
    The model classes can be found inside model package.
    Package io provides read/write functionalities from/to a variety of file formats.
    We also have a set of tests for this module and they are kept inside the tests package.

Data structure

For an automated pipeline run, the patient data is divided into three categories:

  • raw data
    Usually, scans, that are used as input files for the pipeline (e.g. T1, DWI, CT).
  • configurations
    This is a folder with configuration files. Each configuration file is described in the How to launch section.
    This folder is patient specific. All the files should be filled in by the user or generated automatically with the run_sequential.py described also in How to launch section.
  • output data
    These are the files generated by the pipeline. The output can be structured using the configuration file rc_out.txt.

For a multi-patient sequential run, the data needs to be structured in a similar manner for each patient. Also, it is important to name the patient folders in a predefined manner. As an example, a simple folder structure can be:

	TVB_patients 
		│
		├── TVB1 
		|     |
		|     └── raw  
		|	    |
		|	    └── mri 
		|		  |
		|		  ├── t1_input.nii.gz
		|		  |
		|		  ├── dwi_raw.nii
		|		  |
		|		  ├── dwi.bvec
		|		  |
		|		  └── dwi.bval		
		└── TVB2 
		      |
		      └── raw  
			    |
			    └── mri 
				  |
				  ├── t1_input.nii.gz
				  |
				  ├── dwi_raw.nii
				  |
				  ├── dwi.bvec
				  |
				  └── dwi.bval	

How to launch

Docker image

We provide a docker image which gathers all the dependencies necessary for tvb-recon code to run. The docker image can be found on docker hub at: thevirtualbrain/tvb-recon. Take it using the most recent tag, with:

# import docker image
$ docker pull thevirtualbrain/tvb-recon

Also, it would be good to have tvb-recon code locally, in case some changes are necessary. Take it with:

# Clone this repository
$ git clone https://github.com/the-virtual-brain/tvb-recon.git

# Go into the repository
$ cd tvb-recon

In order to use tvb-recon within the proposed docker image, you will need some details about its configurations and steps to follow for specifying your input data and start a workflow. We recommend new users to start with the default configurations and adjust their data structure as required. After a first workflow run has finished successfully, the configurations and data structure can be chosen by the user.

First of all, we process mostly T1 and DWI data. There is an option to process also CT scans. But, we would advise you to start only with T1 and DWI. In order to access the T1 and DWI input, tvb-recon pipeline expects, by default, a certain folder structure, and file naming. These can be changed later as you wish, but keep the default configurations for a first test. This means you should adjust your input data folder to the following structure (also rename your files as below):

	TVB_patients 
		│
		├── TVB1 
		|     |
		|     └── raw  
		|	    |
		|	    └── mri 
		|		  |
		|		  ├── t1_input.nii.gz
		|		  |
		|		  ├── dwi_raw.nii
		|		  |
		|		  ├── dwi.bvec
		|		  |
		|		  └── dwi.bval		
		└── TVB2 
		      |
		      └── raw  
			    |
			    └── mri 
				  |
				  ├── t1_input.nii.gz
				  |
				  ├── dwi_raw.nii
				  |
				  ├── dwi.bvec
				  |
				  └── dwi.bval	

(TVB1, TVB2, etc, being the ID of the patients. If your DWI data is not made of: dwi.nii + dwi.bvec + dwi.bval, let us know and we will tell you how to specify it differently.)

Once you have this folder structure for your data, you can run the tvb-recon docker image with the command below. Please make sure Docker has enough RAM memory assigned, we recommend at least 6 GB.

# To run the tvb-recon docker image
$ docker run -it -v your_path_to_TVB_patients/TVB_patients/:/home/submitter/data -v your_path_to_tvb_recon/tvb-recon/:/opt/tvb-recon thevirtualbrain/tvb-recon /bin/bash

(here you need to replace your_path_to_TVB_patients and your_path_to_tvb_recon with the paths of your local machine)

Now, you will be able to use bash commands inside the tvb-recon container. And here, you need to do the next steps:

# Run the following command and provide the sudo password: 123456
$ sudo condor_master

# Move to pegasus folder 
$ cd pegasus

# Run the pipeline by the following command. The "1" argument is the patient number you want to process. By specifying "1", you choose to process TVB1. For running multiple patients (TVB1, TVB2 and TVB3), the argument should be: "1 2 3".
$ python run_sequentially.py "1"

If everything is correct, some messages will be displayed. Look for the following flow of messages:

*...  
Starting to process the subject: TVB1  
...  
2018.06.28 11:11:40.285 UTC:    Your workflow has been started and is running in the base directory:  
2018.06.28 11:11:40.293 UTC:     /home/submitter/pegasus/submit/submitter/pegasus/TVB-PIPELINE/run0001   
...  

The job that has been started has the id: 0001  
Starting to monitor the submit folder: /home/submitter/pegasus/submit/submitter/pegasus/TVB-PIPELINE/run0001 ...  
Checked at Thu, 28 Jun 2018 11:11:42 and monitord.done file was not generated yet!*

If the messages flow is not similar, let us know what is the error.

Once, you have started the workflow, you should see a new folder, named configs, on your local machine at path:
your_path_to_TVB_patients/TVB_patients/TVB1 Here you will have all the default configurations we need for a patient (these can be changed).

Later on, after some important steps have finished, you will also have an output folder inside:
your_path_to_TVB_patients/TVB_patients/TVB1. Here is where all the output data will be stored, and of more interest will be the folders:

  • output/figs (figures generated during different pipeline steps to check the quality of the data)
  • output/tvb (files that are compatible with TVB and can be uploaded and used there)

We use the Pegasus workflow engine in order to automatize the pipeline steps. This tool will let you check the status of the workflow anytime. In order to check the status of your current workflow:

# You can open a new terminal on the tvb-recon docker container with:
$ docker exec -i -t container_id /bin/bash

# Then run this command
$ pegasus-status -l /home/submitter/pegasus/submit/submitter/pegasus/TVB-PIPELINE/run0001

After you manage to test a first default workflow, we can speak about adjusting the configurations instead of adjusting the data structure.

Entry point

There are 2 available entry points for the pipeline. They are both under the pegasus folder. In order to use these entry points, there are, in both cases, some configurations to be defined first. These configurations are kept as a folder specific to each patient and are explained in the next section.

The pipeline can be started using one of the following entry points:

  • main_pegasus.sh
    This is the most straight-forward one. It starts one pipeline run for a single patient based on a set of predefined configurations. Command to launch the pipeline with this script:

    $ sh main_pegasus.sh path_to_configurations_folder path_to_dax_folder

    The arguments:

    • path_to_configurations_folder represents the path to the patient configuration files (e.g. data_folder/configurations)
    • path_to_dax_folder represents the folder where the dax will be generated (e.g. data_folder/configurations/dax)

    This entry point has the disadvantage that the user should manually fill in all the configuration files under the configurations folder.

  • run_sequential.py
    This is a little more complex. It is used to start pipeline runs for a list of patients with similar configurations. As the name is suggesting, the runs will be started sequentially.
    Command to launch the pipeline with this script:

    $  python run_sequentially.py

    This script does not need arguments, but it needs the user to edit the necessary configurations inside file run_sequential.py. The configurations to edit are described below:

    • PATH_TO_INPUT_SUBJ_FOLDERS:
      path to the folder where you keep your patient raw data (e.g. data_folder/raw_data)
    • PATH_TO_SUBJ_CONFIG_FOLDERS:
      path to the folder where you keep your patient configurations (e.g. data_folder/configurations)
    • PATH_TO_OUTPUT_SUBJ_FOLDER:
      path to the folder where you want your outputs to be saved (e.g. data_folder/outputs)
    • PREFIX_SUBJECT_FOLDER:
      prefix of the patient folder name (e.g. patient in patient1, patient2, patient3)
    • SUBJECTS_TO_BE_PROCESSED:
      suffix of the patient folder name (e.g. [1, 2, 3] in patient1, patient2, patient3)
    • ATLASES:
      a list with all the atlases to be used (e.g. [default])
    • PATH_TO_DEFAULT_PEGASUS_CONFIGURATION:
      path to the folder where you keep the default configuration files. (e.g. tvb-recon/pegasus/config)
      This entry point can be also used to start a single patient run in order for the user to avoid the need to manually fill in all the configuration files. This can be achieved by specifying a single suffix in the SUBJECTS_TO_BE_PROCESSED list (e.g. SUBJECTS_TO_BE_PROCESSED=[1]).

Configurations

All the configuration files are under pegasus/config at the top level. There are configurations specific to the patient, to the machine where the workflow is running or to the actual run. Some details about each file, are given below:

  • environment_config.sh
    These are the machine-specific configurations. The configurations are mostly paths of the software and other variables that are needed for the pipeline environment setup.
  • patient_flow.properties
    These are the patient-specific configurations.
  • pegasus.properties
    This is a pegasus specific configuration file. It just defined the paths to sites.xml, rc.txt, tc.txt, and rc_out.txt.
  • rc.txt
    Inside this file, the inputs should be defined in a key-value format, where value is the path to the input file.
    During the pipeline run, the rc.txt will be filled in with all the generated files and their paths. This mapping is important to keep especially in case of a partial rerun.
  • rc_out.txt
    Using this file, the output can be structured in a similar way as the input.
  • sites.xml
    This should not change since the configurable variables will be taken from the environment.
  • tc.xml
    This should not be changed since it contains the commands mapping.

How to rerun

There are cases when the user is not satisfied with the obtained results. Maybe the volume overlapping is not correct. Maybe more tracts or longer tracts are needed. Maybe the user has T2 scans and wants to add them.
These are all cases that imply the need to rerun the pipeline. But in the best-case scenario, the user does not need to rerun the whole pipeline again but rerun only the wanted steps.
With Pegasus, the pipeline can be rerun partially. This means that it will rerun only the steps for which the corresponding outputs are missing from the rc.txt

Rerun with different parameters

This is possible with pegasus, but it is not automatized. It needs user input and attention. In order to rerun with different parameters, the user has to:

  • modify the parameters inside the configuration files
  • search the steps that need to rerun inside the main_bnm.dax and identify their output files
  • remove the files (output files above) that need to be regenerated from rc.txt
  • start a pipeline run using one of the entry points

As stated before, the rc.txt contains a mapping between the generated file names and their paths. In order for Pegasus to rerun a group of steps, the user has to remove their output files from rc.txt. During the pipeline rerun, the rc.txt will be once again filled in, by re-running the steps (and all their dependencies) which are meant to produce the missing resources from rc.txt.
Inside the main_bnm.dax file, there is a XML representation of the workflow graph. Here is where the user can check all the pipeline steps and their input/output files.

Recover over shutdown

Pegasus already has support for this. When the machine is started after an unexpected shutdown, it restarts the flow. If the recovery run is not started, there is also the option to force it by calling pegasus-start inside its submit folder.

Environment

The pipeline steps are dependent on the following external tools:

  • Freesurfer
    Freesurfer is used to process the T1 images and generate the anatomy of a patient brain.
  • Mrtrix
    Mrtrix is used to preprocess the DWI images and also to generate the tracts.
  • FSL
    FSL is used to register images from different spaces to a common one.
  • MNE
    MNE is used to generate BEM surfaces.
  • OpenMEEG
    OpenMEEG can be used for sensor computations.

The automatized workflow is based on:

  • HTCondor
    Pegasus uses HTCondor as a job scheduler.
    Download the tarballs (current stable release) from here: http://research.cs.wisc.edu/htcondor/downloads/ Install for MacOS:

     - tar xzf condor-8.6.9-x86_64_MacOSX-stripped.tar.gz
     - cd condor-8.6.9-x86_64_MacOSX10-stripped
     - ./condor_install --type=execute, manager, submit
    

    Prepare environment:

    • optionally, it may need the next lines inside condor_config:
      • use ROLE : Personal
      • NETWORK_INTERFACE = $(CONDOR_HOST)
      • COLLECTOR_NAME = Personal Condor at $(CONDOR_HOST)
    • export CONDOR_CONFIG=../condor-8.6.9-x86_64_MacOSX10-stripped/etc/condor_config
    • source ../condor-8.6.9-x86_64_MacOSX10-stripped/condor.sh
    • start it with: condor_master
    • check it works by running: condor_status
  • Pegasus
    This is the workflow engine we have used for automatizing the pipeline steps.
    Download tarball for MacOSX from here: https://pegasus.isi.edu/downloads/?filename=4.8.1%2Fpegasus-binary-4.8.1-x86_64_macos_10.tar.gz

    Prepare the environment:

     - tar xzf ../pegasus-binary-4.8.1-x86_64_macos_10.tar.gz
     - export PATH=../pegasus-4.8.1/bin/:$PATH
     - check it works by running: pegasus-status
    

Bibliography

[1] Proix T, Spiegler A, Schirner M, Rothmeier S, Ritter P, Jirsa VK, How do parcellation size and short-range connectivity affect dynamics in large-scale brain network models?, Neuroimage (2016).

[2] Schirner M, Rothmeier S, Jirsa VK, McIntosh AR, Ritter P, An automated pipeline for constructing personalized virtual brains from multimodal neuroimaging data, Neuroimage, (2015) Aug 15 117:343-357. Available here

[3] Andre Santos Ribeiro, Luis Miguel Lacerda, Hugo Alexandre Ferreira, Multimodal Imaging Brain Connectivity Analysis (MIBCA) toolbox, 2015 Jul 14. Available here

Build Status Coverage Status

tvb-recon's People

Contributors

dionperd avatar liadomide avatar popaula937 avatar sipv avatar sraghuvanshi avatar umarbrowser avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

tvb-recon's Issues

Brain segmentation template of TVB-recon

Hello
I used the TVB-recon pipeline to process DTI and DWI images, and generated a connectivity.a2009s folder, which including a weights.txt, there are 167 brain nodes in total. I want to know what is the brain segmentation template used to generate this weights.txt , and whether it is aparc.a2009s+aseg?I run my own script using aparc. a2009s+aseg, but the final generated weight matrix has only 163 nodes.

Provisioning

The scripts for setting up a VM are out of date,

https://github.com/ins-amu/bnm-recon-tools/tree/master/docs/setup-vm

and could be rewritten for Ansible to improve robustness. It's probably a good idea for us to be using a Vagrant (VBox) or Docker VM where possible, so that at least across dev machines, the environment is identical:

  • Vagrantfile provides a local VM so everyone's using the same environment
  • same Ansible playbook used to setup VM & cluster env
  • VM sets up environment on secondary (non-OS) disk so we can share to get quick started.

Gain matrix workflow

Gain matrices map source space (neural mass state variables) to sensor space (MEG, EEG and sEEG recordings). They are required for simulating MEG, EEG and sEEG; they are also required for fitting data with those modalities. While most software assumes one single gain matrix, in cases where we have multiple source spaces and sensors spaces (cortical + subcortical; MEG & EEG), then we are computing M * N gain matrices.

Our current scripts on these topics don't work, but they outline the necessary steps, using the OpenMEEG command line utilities. OpenMEEG works primarily with text files for describing head geometry, interface conductance, source geometry & sensor geometry, and MATLAB format data files.

We can certainly format all our data to such files, but note that we want to work with corresponding time series data: we should consider using the MNE-Python library for this, as MNE data structures coordinate time series data with geometry information about source and sensor spaces (though MNE's use of OpenMEEG needs to be built). In general, for any sort of time series we have, it'd be good to build on MNE instead of recoding (badly) their functionality.

Our workflow looks like

  • loading time series datasets
  • extracting geometry information
  • aligning with T1 coord sys (has to be done manually, but MNE has some visual tools for this)
  • building the head, sensor, source head models
  • inverting head model
  • computing gain matrix per (source space, sensor space) pair
  • saving for later use

Airflow

Airflow is Airbnb's workflow system. It's another management system based around DAGs, distributed computing etc, has a nice CLI and GUI. It's also all in Python, a plus IMO.

I'm not saying we should use it, but if we ever need to scale up, this and Pegasus are both worth looking at.

About average_orientations.txt

Hello, in the output/connectivity.a2009s file generated by TVB-recon, there is a file called average_ orientations.txt, I want to know what this is. Recently, I want to use openmeeg to generate the gain matrix of SEEG. I want to take the center of the brain region as a point dipole, but only the location of the center of the brain region, and openmeeg needs the orientation of the dipole, so I want to know whether the average_orientations.txt can be used as the orientation of the dipole in the center of the brain region.

run_sequentially.py Error

Hello, I'm running run_ sequentially. py, but I didn't use docker. I installed the required environment according to the requirements, but the following errors occurred. Can anyone help me?
Screenshot from 2022-02-10 16-39-33

NumPy style docstrings

As a project in the scientific community, docstrings are expected to be in NumPy format. PyCharm defaults to :param: style, but it will do NumPy for you, just take a look in the right place:

  • File | Settings | Tools | Python Integrated Tools for Windows and Linux
  • PyCharm | Preferences | Tools | Python Integrated Tools for OS X

and change "Docstring Format" to "NumPy". If it's not present, upgrade PyCharm.

This task is to rewrite the existing ones and add a pre-commit check.

bash: cd:pegasus: No such file or directory

Hello, I'm running tvb-recon with docker. I use git clone to download the code locally. The saved path is / home / nana / downloads /tvb-recon. The patient folder structure is also constructed according to the requirements of readme. The saved path is / home / nana / downloads / TVB_ Patients,I pull the docker image,and successfully entered it, but when I cd pegasus, no such file or directory is displayed, and the local folder exists in this folder, Can you help me see what's wrong
Screenshot from 2022-02-13 16-35-48
?

Unable to run tvb-recon docker image

I tried to run the docker image on my local machine using the command given in readme.

docker run -it -v your_path_to_TVB_patients/TVB_patients/:/home/submitter/data -v your_path_to_tvb_recon/tvb-recon/:/opt/tvb-recon popaula937/tvb-recon:master-pr50 /bin/bash

However it shows the following error:-

Unable to find image 'popaula937/tvb-recon:master-pr50' locally
docker: Error response from daemon: pull access denied for popaula937/tvb-recon, repository does not exist or may require 'docker login': denied: requested access to the resource is denied.

Please look into it.

run_sequentially.py error

Hi, I am trying to run run_sequentially inside the docker container but getting this error.

How should I proceed?

submitter@ome/tvb-recon/:/opt/tvb-recon:/opt/tvb-recon/pegasus$ python run_sequentially.py "1"
Starting to process the following subjects: %s [1]
Starting to process the subject: TVB1
Configured atlas default for patient inside folder /home/submitter/data/TVB1/configs
Checking currently running job ids...
Currently running job ids are: []
Starting pegasus run for subject: TVB1with atlas: default
main_pegasus.sh: 7: main_pegasus.sh: Bad substitution
/opt/tvb-recon
2021-06-12 18:33:29,386 - tvb.recon.dax.configuration - INFO - Parsing patient configuration file /home/submitter/data/TVB1/configs/patient_flow.properties
Traceback (most recent call last):
File "/opt/conda/lib/python2.7/runpy.py", line 174, in _run_module_as_main
"main", fname, loader, pkg_name)
File "/opt/conda/lib/python2.7/runpy.py", line 72, in _run_code
exec code in run_globals
File "/opt/tvb-recon/tvb/recon/dax/main.py", line 55, in
tracts_generation = TractsGeneration(config.props[ConfigKey.DWI_MULTI_SHELL], config.props[ConfigKey.MRTRIX_THRDS],
KeyError: <ConfigKey.DWI_MULTI_SHELL: 'dwi.multi.shell'>
Traceback (most recent call last):
File "/usr/bin/pegasus-graphviz", line 507, in
main()
File "/usr/bin/pegasus-graphviz", line 497, in main
dag = parse_daxfile(dagfile, options.files)
File "/usr/bin/pegasus-graphviz", line 225, in parse_daxfile
f = open(fname,"r")
IOError: [Errno 2] No such file or directory: '/home/submitter/data/TVB1/configs/dax/main_bnm.dax'
Error: dot: can't open /home/submitter/data/TVB1/configs/dax/main_bnm.dot
2021.06.12 18:33:29.784 UTC: [ERROR] Problem while determining the version of dax class java.lang.RuntimeException: java.io.FileNotFoundException: The file (/home/submitter/data/TVB1/configs/dax/main_bnm.dax ) specified does not exist
2021.06.12 18:33:29.787 UTC: [FATAL ERROR]
[1]: Instantiating DAXParser at edu.isi.pegasus.planner.parser.DAXParserFactory.loadDAXParser(DAXParserFactory.java:235)
[2]: Invalid static initializer method name for DAXParser3 at edu.isi.pegasus.common.util.DynamicLoader.instantiate(DynamicLoader.java:131)
ERROR while logging metrics The metrics file location is not yet initialized
Checking currently running job ids...
Currently running job ids are: []
Traceback (most recent call last):
File "run_sequentially.py", line 185, in
current_job_id = new_job_ids[0]
IndexError: list index out of range

Error in running "run_sequentially.py" "1"

Hi support team,

I am trying to run: python run__sequentially.py" "1" using the docker but I am getting the following error and couldnt solve it. how can I proceed?

(base) D:\TVB\connectivity\tvb-recon>docker run -it -v D:/TVB/connectivity/tvb-recon/TVB_patients/:/home/submitter/data -v D:/TVB/connectivity/tvb-recon/:/opt/tvb-recon thevirtualbrain/tvb-recon /bin/bash
submitter@bfcd7c0961c0:/opt/tvb-recon$ sudo condor_master

We trust you have received the usual lecture from the local System
Administrator. It usually boils down to these three things:

#1) Respect the privacy of others.
#2) Think before you type.
#3) With great power comes great responsibility.

[sudo] password for submitter:
submitter@bfcd7c0961c0:/opt/tvb-recon$ condor_status
Name OpSys Arch State Activity LoadAv Mem ActvtyTime

slot1@bfcd7c0961c0 LINUX X86_64 Unclaimed Benchmar 0.110 496 0+00:00:04
slot2@bfcd7c0961c0 LINUX X86_64 Unclaimed Idle 0.000 496 0+00:00:05
slot3@bfcd7c0961c0 LINUX X86_64 Unclaimed Idle 0.000 496 0+00:00:06
slot4@bfcd7c0961c0 LINUX X86_64 Unclaimed Idle 0.000 496 0+00:00:07
Total Owner Claimed Unclaimed Matched Preempting Backfill

    X86_64/LINUX     4     0       0         4       0          0        0

           Total     4     0       0         4       0          0        0

submitter@bfcd7c0961c0:/opt/tvb-recon$ cd pegasus/
submitter@bfcd7c0961c0:/opt/tvb-recon/pegasus$ python run_sequentially.py "1"
Starting to process the following subjects: %s [1]
Starting to process the subject: TVB1
/home/submitter/data/TVB1/configs
Configured atlas default for patient inside folder /home/submitter/data/TVB1/configs
Checking currently running job ids...
Currently running job ids are: []
Starting pegasus run for subject: TVB1with atlas: default
: not founds.sh: 6: main_pegasus.sh:
main_pegasus.sh: 7: main_pegasus.sh: Bad substitution
: not founds.sh: 8: main_pegasus.sh:
/..n_pegasus.sh: 9: cd: can't cd to /opt/tvb-recon/pegasus
: not founds.sh: 10: main_pegasus.sh:
: not founds.sh: 11: main_pegasus.sh: pwd
: not founds.sh: 12: main_pegasus.sh:
bash: pegasus/generate_dax.sh: No such file or directory
: not founds.sh: 15: main_pegasus.sh:
Traceback (most recent call last):
File "/usr/bin/pegasus-graphviz", line 507, in
main()
File "/usr/bin/pegasus-graphviz", line 497, in main
dag = parse_daxfile(dagfile, options.files)
File "/usr/bin/pegasus-graphviz", line 225, in parse_daxfile
f = open(fname,"r")
IOError: [Errno 2] No such file or directory: '/home/submitter/data/TVB1/configs/dax/main_bnm.dax\r'
: not founds.sh: 18: main_pegasus.sh:
Error: dot: can't open /home/submitter/data/TVB1/configs/dax/main_bnm.dot
: not founds.sh: 21: main_pegasus.sh:
bash: pegasus/plan_dax.sh: No such file or directory
Checking currently running job ids...
Currently running job ids are: []
Traceback (most recent call last):
File "run_sequentially.py", line 187, in
current_job_id = new_job_ids[0]
IndexError: list index out of range
submitter@bfcd7c0961c0:/opt/tvb-recon/pegasus$

thank you for your help and support.

Bash runner

Instead of invoking commands immediately, generate Bash script, for comparison with existing Bash scripts.

Which T1 file to use

Hello, I used mricron to convert DICOM format into NIFT files, but finally generated three t1.nii files, including source files and files beginning with o and co. I checked the relevant materials. Among them, the files beginning with o are mainly reorient, while co is cut the neck. If I want to use tvb-recon to generate connection matrix, which file should I use?
b2a2bf2e2a1c62b26a45ba008109f16

Consider xarray for improved data handling

I usually avoided enhancements over standard ndarray, but I think xarray [1] makes a good case, in combining both Pandas like convenience with labeled dimensions. Specifically, it seems like a step forward in making it easy to write correct code, especially when we might want it to be agnostic to layout. A trivial example is summing over time: with a plain array, you have to know which axis is time, then it's data.sum(axis=time_axis), whereas a labeled array knows that for you, so it's just data.sum('time'). It also helps coordinate work between multiple arrays sharing one or more axes, see [1] for more.

The plain, typed alternative is to write a full wrapping class around every data type, and operations for all their interactions, but this is a lot of boilerplate code for the classes themselves and the tests.

[1] http://xarray.pydata.org/en/stable/why-xarray.html

Error in running "run_sequentially.py"

After loading the docker image "tvb-recon" along with path of input data folder

Input: python run_sequentially.py "1"

Output

Starting to process the following subjects: %s [1]
Starting to process the subject: TVB1
Configured atlas default for patient inside folder /home/submitter/data/TVB1/configs
Checking currently running job ids...
Error:

Extra Info: You probably saw this error because the condor_schedd is not
running on the machine you are trying to query. If the condor_schedd is not
running, the Condor system will not be able to find an address and port to
connect to and satisfy this request. Please make sure the Condor daemons are
running and try again.

Extra Info: If the condor_schedd is running on the machine you are trying to
query and you still see the error, the most likely cause is that you have
setup a personal Condor, you have not defined SCHEDD_NAME in your
condor_config file, and something is wrong with your SCHEDD_ADDRESS_FILE
setting. You must define either or both of those settings in your config
file, or you must use the -name option to condor_q. Please see the Condor
manual for details on SCHEDD_NAME and SCHEDD_ADDRESS_FILE.
Currently running job ids are: []
Starting pegasus run for subject: TVB1with atlas: default
main_pegasus.sh: 7: main_pegasus.sh: Bad substitution
/opt/tvb-recon
Traceback (most recent call last):
File "/opt/conda/lib/python2.7/runpy.py", line 174, in _run_module_as_main
"main", fname, loader, pkg_name)
File "/opt/conda/lib/python2.7/runpy.py", line 72, in _run_code
exec code in run_globals
File "/opt/tvb-recon/tvb/recon/dax/main.py", line 7, in
from tvb.recon.dax.configuration import Configuration, ConfigKey, SensorsType
File "tvb/recon/dax/configuration.py", line 4, in
LOGGER = get_logger(name)
File "tvb/recon/logger.py", line 25, in get_logger
_ensure_log_folder_exists()
File "tvb/recon/logger.py", line 14, in _ensure_log_folder_exists
os.mkdir(OUTPUT_FOLDER)
OSError: [Errno 13] Permission denied: 'output'
Removing Generate 5tt MIF -> Tracts SIFT
Removing gen_mapping_details -> convert_output
Removing Convert APARC+ASEG to NIFTI with good orientation -> convert_output
Removing Recon-all for T1 -> qc_snapshot
Removing Recon-all for T1 -> qc_snapshot
Traceback (most recent call last):
File "/usr/bin/pegasus-graphviz", line 507, in
main()
File "/usr/bin/pegasus-graphviz", line 504, in main
emit_dot(dag, options.label, options.outfile, options.width, options.height)
File "/usr/bin/pegasus-graphviz", line 412, in init
self.out = open(outfile, 'w')
IOError: [Errno 13] Permission denied: '/home/submitter/data/TVB1/configs/dax/main_bnm.dot'
Error: Could not open "/home/submitter/data/TVB1/configs/dax/main_bnm.png" for writing : Permission denied
2022.06.21 08:02:52.726 UTC:
2022.06.21 08:02:52.732 UTC: -----------------------------------------------------------------------
2022.06.21 08:02:52.737 UTC: File for submitting this DAG to Condor : TVB-PIPELINE-0.dag.condor.sub
2022.06.21 08:02:52.744 UTC: Log of DAGMan debugging messages : TVB-PIPELINE-0.dag.dagman.out
2022.06.21 08:02:52.750 UTC: Log of Condor library output : TVB-PIPELINE-0.dag.lib.out
2022.06.21 08:02:52.756 UTC: Log of Condor library error messages : TVB-PIPELINE-0.dag.lib.err
2022.06.21 08:02:52.762 UTC: Log of the life of condor_dagman itself : TVB-PIPELINE-0.dag.dagman.log
2022.06.21 08:02:52.768 UTC:
2022.06.21 08:02:52.785 UTC: -----------------------------------------------------------------------
2022.06.21 08:02:58.964 UTC: Created Pegasus database in: sqlite:////home/submitter/.pegasus/workflow.db
2022.06.21 08:02:58.969 UTC: Your database is compatible with Pegasus version: 4.8.2
2022.06.21 08:02:59.114 UTC: Submitting to condor TVB-PIPELINE-0.dag.condor.sub
2022.06.21 08:02:59.128 UTC: [ERROR]
2022.06.21 08:02:59.133 UTC: [ERROR] ERROR: Can't find address of local schedd
2022.06.21 08:02:59.139 UTC: [ERROR] ERROR: Running condor_submit /usr/bin/condor_submit TVB-PIPELINE-0.dag.condor.sub failed with exit code 1 at /usr/bin/pegasus-run line 327.
2022.06.21 08:02:59.145 UTC: [FATAL ERROR]
[1] java.lang.RuntimeException: Unable to submit the workflow using pegasus-run at edu.isi.pegasus.planner.client.CPlanner.executeCommand(CPlanner.java:695)
Checking currently running job ids...
Error:

Extra Info: You probably saw this error because the condor_schedd is not
running on the machine you are trying to query. If the condor_schedd is not
running, the Condor system will not be able to find an address and port to
connect to and satisfy this request. Please make sure the Condor daemons are
running and try again.

Extra Info: If the condor_schedd is running on the machine you are trying to
query and you still see the error, the most likely cause is that you have
setup a personal Condor, you have not defined SCHEDD_NAME in your
condor_config file, and something is wrong with your SCHEDD_ADDRESS_FILE
setting. You must define either or both of those settings in your config
file, or you must use the -name option to condor_q. Please see the Condor
manual for details on SCHEDD_NAME and SCHEDD_ADDRESS_FILE.
Currently running job ids are: []
Traceback (most recent call last):
File "run_sequentially.py", line 185, in
current_job_id = new_job_ids[0]
IndexError: list index out of range
submitter@5637a3c2a40e:/opt/tvb-recon/pegasus$ condor_ststus
bash: condor_ststus: command not found
submitter@5637a3c2a40e:/opt/tvb-recon/pegasus$ condor_status
Error: communication error
CEDAR:6001:Failed to connect to <172.17.0.3:9618>

** I am inside a proxy network and has configured docker to run in the proxy network.

Missing config file errors

Hey all,

This is my first time using tvb-recon. I have my dataset directory structure organized as described in the readme. I run the docker command like so:

docker run -it -v /Users/rafi/Documents/Stanford/Saggar_Lab/HPI_Reflect/TVB_patients/:/home/submitter/data -v /Users/rafi/Documents/Stanford/Saggar_Lab/tvb-recon/:/opt/tvb-recon thevirtualbrain/tvb-recon /bin/bash

Yet after I run sudo condor_master and cd into pegasus and run run_sequentially.py, I get the following error:

Starting to process the following subjects: %s [1]
Starting to process the subject: TVB1
Traceback (most recent call last):
  File "run_sequentially.py", line 172, in <module>
    prepare_config_for_new_atlas(current_dir, atlas)
  File "run_sequentially.py", line 97, in prepare_config_for_new_atlas
    with open(current_patient_props_path, "r") as current_patient_props_file:
IOError: [Errno 2] No such file or directory: '/home/submitter/data/TVB1/configs/patient_flow.properties'

I thought the pipeline would automatically create the default configuration files from what I understood. Then I tried copying the configuration files from the pegasus/configs folder into the TVB1/configs folder. I reran and I'm still getting missing file errors.

Starting to process the following subjects: %s [1]
Starting to process the subject: TVB1
Configured atlas default for patient inside folder /home/submitter/data/TVB1/configs
Checking currently running job ids...
Currently running job ids are: []
Starting pegasus run for subject: TVB1with atlas: default
main_pegasus.sh: 7: main_pegasus.sh: Bad substitution
/opt/tvb-recon
2018-08-29 23:01:39,473 - tvb.recon.dax.configuration - INFO - Parsing patient configuration file /home/submitter/data/TVB1/configs/patient_flow.properties
Traceback (most recent call last):
  File "/opt/conda/lib/python2.7/runpy.py", line 174, in _run_module_as_main
    "__main__", fname, loader, pkg_name)
  File "/opt/conda/lib/python2.7/runpy.py", line 72, in _run_code
    exec code in run_globals
  File "/opt/tvb-recon/tvb/recon/dax/__main__.py", line 81, in <module>
    job_aparc_aseg_in_d, job_mapping_details)
  File "tvb/recon/dax/tracts_generation.py", line 86, in add_tracts_generation_steps
    gm_mif = File(DWIFiles.GM_MIF.value)
  File "/usr/lib/python2.7/dist-packages/enum/__init__.py", line 390, in __getattr__
    raise AttributeError(name)
AttributeError: GM_MIF
Traceback (most recent call last):
  File "/usr/bin/pegasus-graphviz", line 507, in <module>
    main()
  File "/usr/bin/pegasus-graphviz", line 497, in main
    dag = parse_daxfile(dagfile, options.files)
  File "/usr/bin/pegasus-graphviz", line 225, in parse_daxfile
    f = open(fname,"r")
IOError: [Errno 2] No such file or directory: '/home/submitter/data/TVB1/configs/dax/main_bnm.dax'
Error: dot: can't open /home/submitter/data/TVB1/configs/dax/main_bnm.dot
2018.08.29 23:01:39.741 UTC: [FATAL ERROR]
 [1]: Unable to instantiate Site Catalog  at edu.isi.pegasus.planner.catalog.site.SiteFactory.loadInstance(SiteFactory.java:234)
 [2]: edu.isi.pegasus.planner.catalog.site.impl.XML caught edu.isi.pegasus.planner.catalog.site.SiteCatalogException Cannot read or access file $path/sites.xml at edu.isi.pegasus.planner.catalog.site.impl.XML.connect(XML.java:146)
ERROR while logging metrics The metrics file location is not yet initialized
Checking currently running job ids...
Currently running job ids are: []
Traceback (most recent call last):
  File "run_sequentially.py", line 185, in <module>
    current_job_id = new_job_ids[0]
IndexError: list index out of range

I'm not really sure what to do at this point and would really appreciate any help!

Sample Input Data Files

As in the readme it is mentioned that the input data folder must be made of:-

mri

  • t1_input.nii.gz
  • dwi_raw.nii
  • dwi.bvec
  • dwi.bval

However the sample mri files given in the repository are different.
They are- aparc+aseg.nii , brain.nii and T1.nii.
I want to run a test so as to see its working.
So please tell me how I have to specify them in the folder.
Thanks.

TVB compatible datasets

Current bash scripts based pipeline (https://github.com/the-virtual-brain/tvb-recon/blob/94d7cd25aaf257a70e965d85adaa278901512511/bin/main.sh) does not produce TVB compatible structural datasets (i.e. files areas.txt, average_orientations.txt, weights.txt, tract_lengths.txt, cortical.txt, centres.txt), but stops with the connectome.

Some code meant to generate this TVB dataset is in the old scripts pipeline, but it is somehow out-of-date (considering the versions of the software in the virtual machine). Furthermore, it is quite complex: it depends on at least six python scripts, remesher in C and some region mapping code in MATLAB.

I would need this functionality ASAP, but before I start playing with this (either dusting off the original python scripts, or rewriting them to the new python library) can you summarize the status of the related work in the new python version of the pipeline? @maedoc @dionperd

For example, some of the code related to remeshing (https://github.com/the-virtual-brain/tvb-recon/blob/94d7cd25aaf257a70e965d85adaa278901512511/tvb/recon/algo/head_sensors.py) and subparcellation (https://github.com/the-virtual-brain/tvb-recon/blob/94d7cd25aaf257a70e965d85adaa278901512511/tvb/recon/algo/service/subparcellation.py) is ported to the python library. Does it work, and is it a final version?

show_aparc_aseg_with_new_values fails w/ -1 index

Testing locally, I see a failure in test_show_aparc_aseg_with_new_values(), where in

            for i in xrange(aparc_aseg_matrix.shape[0]):
                for j in xrange(aparc_aseg_matrix.shape[1]):
                    if aparc_aseg_matrix[i][j] > 0:
                        if fs_to_conn_indices_mapping.has_key(aparc_aseg_matrix[i][j]):
                            aparc_aseg_matrix[i][j] = conn_measure[
                                fs_to_conn_indices_mapping.get(aparc_aseg_matrix[i][j])]
                        else:
                            aparc_aseg_matrix[i][j] = -1

I've fs_to_conn_indices_mapping.get(aparc_aseg_matrix[i][j]) returning -1.0, which is not a valid index. I don't see why this would pass on Travis but not locally (macos 10 10).

Migrate TVB to support Python 3

Hi there.

I came across some post on medium and i saw that the python software foundation are going to stop supporting python 2 on 2020, Then i came with the idea why not start porting the virtual brain from now to start supporting the latest version of python 3.

Please core developers see that issue, I will like to offer my contribution.

@liadomide @bogdanneacsa @maedoc @pausz @twotribes @liadomide

Thanks you.

References:
https://legacy.python.org/dev/peps/pep-0373/
https://pythonclock.org/

Missing documentation

This repo is largely undocumented. Getting new users up and running is a huge effort. Once the library and workflows have stabilized, we should set up Sphinx API docs, overview and worked examples.

Move datasets into an LFS

Git doesn't handle large files well. This repo has a bunch of it; let's move it into a LFS store.

FS6 new features

There are some other features we could take advantage of in FS6

  • Better hippocampal subfields segmentation would improve both connectivity & lead field info
  • Idem, for improvements in brain stem segmentation.
  • -parallel flags enables coarse & fine (OpenMP) grained parallelism

Need to review the release notes further.

Tests run depends on working directory

It would be convenient if the tests could find test data regardless of the current working directory.

Also, take inspiration from MNE's approach to handling test data.

Lost functions

In prior reorganization, several functions were lost, including ones to generate head model files for OpenMEEG. These need to be recovered from Git history.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.