#!/usr/bin/env python import os, glob, shutil, sys, inspect, errno from distutils.spawn import find_executable from mrtrix3 import app, fsl, file, image, path, run print('Hello') app.init( 'Lea Vinokur ([email protected])', 'Calculate a fixel-template based on 100 HCP subjects. ' 'The analysis pipeline relies primarily on the MRtrix3 software package (www.mrtrix.org).' ) app.cmdline.add_argument('in_dir', help='The directory with the input dataset ') app.cmdline.add_argument( 'output_dir', help='The directory where the output files ' 'should be stored. If you are running group level analysis ' 'this folder should be prepopulated with the results of the ' 'participant level analysis.') analysis_level_choices = [ 'participant1', 'group1', 'participant2', 'group2', 'participant3', 'group3', 'participant4', 'group4' ] app.cmdline.add_argument( 'analysis_level', help='Level of the analysis that will be performed. '
import matlab.engine import os PATH = os.environ['PATH'].split(":") mrtrixbin = [s for s in PATH if "mrtrix3" in s][0] if not mrtrixbin: print("cannot find path to mrtrix3, please make sure <path/to/mrtrix3/bin> is in your PATH") quit() mrtrixlib = "".join(mrtrixbin)[:-3]+'lib' print(mrtrixlib) import inspect, sys, numpy as np, math, gzip, shutil from distutils.spawn import find_executable sys.path.insert(0, mrtrixlib) from mrtrix3 import app, file, fsl, image, path, phaseEncoding, run app.init('Benjamin Ades-Aron ([email protected])', 'DWI processing with DESIGNER') app.cmdline.addDescription("""1. pre-check: concatenate all dwi series and make sure the all diffusion AP images and PA image have the same matrix dimensions/orientations 2. denoise the complete dataset\n 3. gibbs ringing correction on complete dataset\n 4. If multiple diffusion series are input, do rigid boy alignment\n 5. topup + eddy, rotate output bvecs\n 6. perform b1 bias correction on each dwi subset\n 7. CSF excluded smoothing\n 8. Rician bias correction\n
for row in mean_RF: f.write(' '.join([str(v) for v in row]) + '\n') progress.increment() with open(os.path.join(output_dir, 'mean_connectome.csv'), 'w') as f: for row in mean_connectome: f.write(' '.join([str(v) for v in row]) + '\n') progress.done() # End of runGroup() function analysis_choices = ['participant', 'group'] parcellation_choices = ['aal', 'aal2', 'fs_2005', 'fs_2009'] app.init( 'Robert E. Smith ([email protected])', 'Generate structural connectomes based on diffusion-weighted and T1-weighted image data using state-of-the-art reconstruction tools, particularly those provided in MRtrix3' ) # If running within a container, erase existing standard options, and fill with only desired options if is_container: for option in reversed(app.cmdline._actions): app.cmdline._handle_conflict_resolve( None, [(option.option_strings[0], option)]) # app.cmdline._action_groups[2] is "Standard options" that was created earlier app.cmdline._action_groups[2].add_argument( '-d', '--debug', dest='debug', action='store_true', help= 'In the event of encountering an issue with the script, re-run with this flag set to provide more useful information to the developer'
PATH = os.environ['PATH'].split(":") mrtrixbin = [s for s in PATH if "mrtrix3" in s][0] if not mrtrixbin: print( "cannot find path to mrtrix3, please make sure <path/to/mrtrix3/bin> is in your PATH" ) quit() mrtrixlib = "".join(mrtrixbin)[:-3] + 'lib' print(mrtrixlib) import inspect, sys, numpy as np, math, gzip, shutil from distutils.spawn import find_executable sys.path.insert(0, mrtrixlib) from mrtrix3 import app, file, fsl, image, path, phaseEncoding, run app.init('Benjamin Ades-Aron ([email protected])', 'DWI processing with DESIGNER') app.cmdline.addDescription( """1. pre-check: concatenate all dwi series and make sure the all diffusion AP images and PA image have the same matrix dimensions/orientations 2. denoise the complete dataset\n 3. gibbs ringing correction on complete dataset\n 4. If multiple diffusion series are input, do rigid boy alignment\n 5. topup + eddy, rotate output bvecs\n 6. perform b1 bias correction on each dwi subset\n 7. CSF excluded smoothing\n 8. Rician bias correction\n
#!/usr/bin/env python import os, glob, shutil, sys, inspect, errno, json from distutils.spawn import find_executable from mrtrix3 import app, fsl, file, image, path, run print ('Hello') app.init ('Lea Vinokur ([email protected])','Receive HCP unprocessed data and output HCP minimally pre-processed data' 'The analysis pipeline relies primarily on the MRtrix3 software package (www.mrtrix.org).') app.cmdline.add_argument('in_dir', help='The directory with the input dataset, with HCP data compliant hirarchy ') app.cmdline.add_argument('output_dir', help='The directory where the output files ') app.cmdline.add_argument('-grad_coeffs', help='Provide the path to the gradient coefficients, if not default ') app.cmdline.add_argument('-participant_label', help='The label(s) of the participant(s) that should be analyzed. The label ' 'corresponds to sub-<participant_label> from the BIDS spec ' '(so it does not include "sub-"). If this parameter is not ' 'provided all subjects should be analyzed. Multiple ' 'participants can be specified with a space separated list.', nargs='+') app.cmdline.add_argument('-group_subset', help='Define a subset of participants to be used when generating the group-average FOD template and response functions. The subset is to be supplied as a comma separate list. Note the subset should be representable of your entire population and not biased towards one particular group. For example in a patient-control comparison, choose equal numbers of patients and controls. Used in group1 and group2 analysis levels.', nargs=1) app.cmdline.add_argument('-extra_eddy_args', help='generic string of arguments to be passed to the DiffPreprocPipeline_Eddy.sh script' ' and and subsequently to the run_eddy.sh script and finally to the command ' ' that actually invokes the eddy binary') app.parse()