3
d                 @   sr   d Z ddlZddlmZ ddlmZ ddlmZ ddlm	Z	 ddl
Z
ejd	ZG d
d deZG dd deZdS )a  The dtitk module provides classes for interfacing with the `DTITK
<http://dti-tk.sourceforge.net/pmwiki/pmwiki.php>`_ command line tools.

These are the base tools for working with DTITK.
Preprocessing tools are found in dtitk/preprocess.py
Registration tools are found in dtitk/registration.py

Currently these tools are supported:

* Rigid Tensor Registration
* Affine Tensor Registration
* Diffeomorphic Tensor Registration
* Combine affiine and diffeomorphic transforms
* Application of transform to tensor and scalar volumes
* Threshold and Binarize
* Adjusting the voxel space of tensor and scalar volumes
* Resampling tensor and scalar volumes
* Calculation of tensor metrics from tensor volume

Examples
--------
See the docstrings of the individual classes for examples.

    N   )logging)fname_presuffix   )CommandLine)Infoznipype.interfacec                   s   e Zd Z fddZ  ZS )DTITKRenameMixinc                s\   dd | j j D }|d }|jd}||d  }tjdj||t tt| j	|| d S )Nc             S   s   g | ]
}|j qS  )__name__).0clsr	   r	   >/tmp/pip-build-7vycvbft/nipype/nipype/interfaces/dtitk/base.py
<listcomp>)   s    z-DTITKRenameMixin.__init__.<locals>.<listcomp>r   r      zThe {} interface has been renamed to {}
Please see the documentation for DTI-TK interfaces, as some inputs have been added or renamed for clarity.)
	__class__mroindexwarningswarnformatDeprecationWarningsuperr   __init__)selfargskwargsclassesZdep_nameZ
rename_idxnew_name)r   r	   r   r   (   s    
zDTITKRenameMixin.__init__)r
   
__module____qualname__r   __classcell__r	   r	   )r   r   r   '   s   r   c               @   s   e Zd ZdddZdS )CommandLineDtitkNTc             C   s   |dkr"d| j  }|d7 }t||dkr2tj }|dkrHtj| jj}|rd|r`dj||f}n|}|dkrpd}t	||d|d}|S )a  Generate a filename based on the given parameters.

        The filename will take the form: cwd/basename<suffix><ext>.
        If change_ext is True, it will use the extentions specified in
        <instance>intputs.output_type.

        Parameters
        ----------
        basename : str
            Filename to base the new filename on.
        cwd : str
            Path to prefix to the new filename. (default is os.getcwd())
        suffix : str
            Suffix to add to the `basename`.  (defaults is '' )
        change_ext : bool
            Flag to change the filename extension to the FSL output type.
            (default True)

        Returns
        -------
        fname : str
            New filename based on given parameters.

         z,Unable to generate filename for command %s. zbasename is not set!NF)suffixZuse_extnewpath)
cmd
ValueErrorosgetcwdr   Zoutput_type_to_extinputsoutput_typejoinr   )r   basenamecwdr#   Z
change_extextmsgfnamer	   r	   r   
_gen_fname9   s     
zCommandLineDtitk._gen_fname)NNTN)r
   r   r   r1   r	   r	   r	   r   r!   8   s   r!   )__doc__r'   r"   r   Zutils.filemanipr   baser   Znipype.interfaces.fsl.baser   r   	getLoggerZLOGGERobjectr   r!   r	   r	   r	   r   <module>   s   
