<commit_before>#!/usr/bin/env python
#########################################################################################
#
# Warp spinal cord atlas to metric (DTI, MT, etc.).
#
# See Usage() below for more information.
#
#
# DEPENDENCIES
# ---------------------------------------------------------------------------------------
# EXTERNAL PYTHON PACKAGES
# none
#
# EXTERNAL SOFTWARE
# - itksnap/c3d <http://www.itksnap.org/pmwiki/pmwiki.php?n=Main.HomePage>
# - ants <http://stnava.github.io/ANTs/>
#
#
# ---------------------------------------------------------------------------------------
# Copyright (c) 2013 Polytechnique Montreal <www.neuro.polymtl.ca>
# Author: <NAME>
# Modified: 2014-05-03
#
# About the license: see the file LICENSE.TXT
#########################################################################################


# DEFAULT PARAMETERS
class param:
    ## The constructor
    def __init__(self):
        self.debug              = 0
        self.verbose            = 0 # verbose

import re
import sys
import getopt
import os
import time
import sct_utils as sct

# MAIN
# ==========================================================================================
def main():

    # Initialization
    path_script = os.path.dirname(__file__)
    # THIS DOES NOT WORK IN MY LAPTOP: path_sct = os.environ['SCT_DIR'] # path to spinal cord toolbox
    path_sct = path_script[:-8] # TODO: make it cleaner!
    fname_src = ''
    fname_transfo = ''
    path_out = 'atlas'
    verbose = param.verbose
    start_time = time.time()

    # Parameters for debug mode
    if param.debug:
        fname_src = os.path.expanduser("~")+'/code/spinalcordtoolbox_dev/testing/data/errsm_23/mt/mtr.nii.gz'
        fname_transfo = os.path.expanduser("~")+'/code/spinalcordtoolbox_dev/testing/data/errsm_23/template/warp_template2mt.nii.gz'
        verbose = 1

    # Check input parameters
    try:
        opts, args = getopt.getopt(sys.argv[1:],'hd:w:o:v:')
    except getopt.GetoptError:
        usage()
    for opt, arg in opts:
        if opt == '-h':
            usage()
        elif opt in ("-d"):
            fname_src = arg
        elif opt in ("-o"):
            path_out = arg
        elif opt in ("-w"):
            fname_transfo = arg
        elif opt in ('-v'):
            verbose = int(arg)<commit_msg>REF: cleaner way to get path of the toolbox<commit_after>#!/usr/bin/env python
#########################################################################################
#
# Warp spinal cord atlas to metric (DTI, MT, etc.).
#
# See Usage() below for more information.
#
#
# DEPENDENCIES
# ---------------------------------------------------------------------------------------
# EXTERNAL PYTHON PACKAGES
# none
#
# EXTERNAL SOFTWARE
# - itksnap/c3d <http://www.itksnap.org/pmwiki/pmwiki.php?n=Main.HomePage>
# - ants <http://stnava.github.io/ANTs/>
#
#
# ---------------------------------------------------------------------------------------
# Copyright (c) 2013 Polytechnique Montreal <www.neuro.polymtl.ca>
# Author: <NAME>
# Modified: 2014-05-03
#
# About the license: see the file LICENSE.TXT
#########################################################################################


# DEFAULT PARAMETERS
class param:
    ## The constructor
    def __init__(self):
        self.debug              = 0
        self.verbose            = 0 # verbose

import re
import sys
import commands
import getopt
import os
import time
import sct_utils as sct

# MAIN
# ==========================================================================================
def main():

    # Initialization
    fname_src = ''
    fname_transfo = ''
    path_out = 'atlas'
    verbose = param.verbose
    start_time = time.time()

    # get path of the toolbox
    status, path_sct = commands.getstatusoutput('echo $SCT_DIR')
    print path_sct

    # Parameters for debug mode
    if param.debug:
        fname_src = os.path.expanduser("~")+'/code/spinalcordtoolbox_dev/testing/data/errsm_23/mt/mtr.nii.gz'
        fname_transfo = os.path.expanduser("~")+'/code/spinalcordtoolbox_dev/testing/data/errsm_23/template/warp_template2mt.nii.gz'
        verbose = 1

    # Check input parameters
    try:
        opts, args = getopt.getopt(sys.argv[1:],'hd:w:o:v:')
    except getopt.GetoptError:
        usage()
    for opt, arg in opts:
        if opt == '-h':
            usage()
        elif opt in ("-d"):
            fname_src = arg
        elif opt in ("-o"):
            path_out = arg
        elif opt in ("-w"):
            fname_transfo = arg
        elif opt in ('-v'):
            verbose = int(arg)
{'fraction_non_alphanumeric': 0.29327548806941434, 'fraction_numerical': 0.009761388286334056, 'mean_word_length': 2.2244755244755243, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 4, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6518184', 'n_tokens_mistral': 1413, 'n_tokens_neox': 1330, 'n_words': 320}