#!/usr/bin/env python from __future__ import print_function from util import logfmt, TemporaryDirectory from plumbum import local, cli, FG from plumbum.cmd import ConvertBetweenFileFormats from util.scripts import activateTensors_py import logging logger = logging.getLogger() logging.basicConfig(level=logging.DEBUG, format=logfmt(__file__)) def nrrd(f): return '.nhdr' in f.suffixes or '.nrrd' in f.suffixes class App(cli.Application): """Runs tract_querier. Output is <out>/*.vtk""" ukf = cli.SwitchAttr( ['-i', '--in'], cli.ExistingFile, help='tractography file (.vtk or .vtk.gz), must be in RAS space', mandatory=True) fsindwi = cli.SwitchAttr( ['-f', '--fsindwi'], cli.ExistingFile, help='Freesurfer labelmap in DWI space (nrrd or nifti)', mandatory=True) query = cli.SwitchAttr(['-q', '--query'], help='tract_querier query file (e.g. wmql-2.0.qry)',
from __future__ import print_function from util import logfmt from plumbum import local, cli, FG from plumbum.cmd import unu, ConvertBetweenFileFormats, ComposeMultiTransform, antsApplyTransforms from util.antspath import antsRegistrationSyN_sh from util import TemporaryDirectory from itertools import zip_longest import pandas as pd import sys import psutil N_CPU = str(psutil.cpu_count()) import logging logger = logging.getLogger() logging.basicConfig(level=logging.INFO, format=logfmt(__file__)) ANTSJOINTFUSION_PARAMS = [ '--search-radius', 5, '--patch-radius', 3, '--patch-metric', 'PC', '--constrain-nonnegative', 1, '--alpha', 0.4, '--beta', 3.0 ] def grouper(iterable, n, fillvalue=None): "Collect data into fixed-length chunks or blocks" # grouper('ABCDEFG', 3, 'x') --> ABC DEF Gxx if n == 1: return [iterable] args = [iter(iterable)] * n return zip_longest(fillvalue=fillvalue, *args)