3
d                 @   s   d Z ddlZddlmZ ddlmZmZmZmZm	Z	 G dd deZ
G d	d
 d
eZG dd deZG dd deZG dd deZG dd deZdS )zDProvides interfaces to various commands provided by Camino-Trackvis.    N   )split_filename   )CommandLineInputSpecCommandLinetraitsTraitedSpecFilec            
   @   s   e Zd ZeddddddZeddddd	Zejd
ddddZej	ej
ddddddddZej	ejddddddddZedddddZedddddZdS ) Camino2TrackvisInputSpecTz-i %s   z The input .Bfloat (camino) file.)existsargstr	mandatorypositiondescz-o %sr   z8The filename to which to write the .trk (trackvis) file.)r   genfiler   r   z-l %dr   mmz&The minimum length of tracts to output)r   r   Zunitsr   z-d %s,   zdThree comma-separated integers giving the number of voxels along each dimension of the source scans.)r   sepr   r   Zminlenmaxlenr   z-x %s   zBThree comma-separated numbers giving the size of each voxel in mm.z--voxel-order %s   a~  Set the order in which various directions were stored.        Specify with three letters consisting of one each          from the pairs LR, AP, and SI. These stand for Left-Right,         Anterior-Posterior, and Superior-Inferior.          Whichever is specified in each position will          be the direction of increasing order.          Read coordinate system from a NIfTI file.)r   r   r   r   z
--nifti %s   z)Read coordinate system from a NIfTI file.)r   r   r   r   N)__name__
__module____qualname__r	   in_fileout_filer   ZFloatZ
min_lengthListZIntZ	data_dimsZ
voxel_dimsZvoxel_orderZ
nifti_file r    r    K/tmp/pip-build-7vycvbft/nipype/nipype/interfaces/camino2trackvis/convert.pyr
   
   sX   r
   c               @   s   e Zd ZedddZdS )Camino2TrackvisOutputSpecTz8The filename to which to write the .trk (trackvis) file.)r   r   N)r   r   r   r	   trackvisr    r    r    r!   r"   M   s   r"   c               @   s4   e Zd ZdZdZeZeZdd Z	dd Z
dd Zd	S )
Camino2Trackvisa.  Wraps camino_to_trackvis from Camino-Trackvis

    Convert files from camino .Bfloat format to trackvis .trk format.

    Example
    -------

    >>> import nipype.interfaces.camino2trackvis as cam2trk
    >>> c2t = cam2trk.Camino2Trackvis()
    >>> c2t.inputs.in_file = 'data.Bfloat'
    >>> c2t.inputs.out_file = 'streamlines.trk'
    >>> c2t.inputs.min_length = 30
    >>> c2t.inputs.data_dims = [128, 104, 64]
    >>> c2t.inputs.voxel_dims = [2.0, 2.0, 2.0]
    >>> c2t.inputs.voxel_order = 'LAS'
    >>> c2t.run()                  # doctest: +SKIP
    Zcamino_to_trackvisc             C   s$   | j  j }tjj| j |d< |S )Nr#   )output_specgetospathabspath_gen_outfilename)selfoutputsr    r    r!   _list_outputsj   s    zCamino2Trackvis._list_outputsc             C   s   |dkr| j  S d S d S )Nr   )r*   )r+   namer    r    r!   _gen_filenameo   s    zCamino2Trackvis._gen_filenamec             C   s   t | jj\}}}|d S )Nz.trk)r   inputsr   )r+   _r.   r    r    r!   r*   u   s    z Camino2Trackvis._gen_outfilenameN)r   r   r   __doc___cmdr
   
input_specr"   r%   r-   r/   r*   r    r    r    r!   r$   S   s   r$   c               @   sB   e Zd ZdZeddddddZedddd	d
ZedddddZdS )Trackvis2CaminoInputSpeca  Wraps trackvis_to_camino from Camino-Trackvis

    Convert files from camino .Bfloat format to trackvis .trk format.

    Example
    -------

    >>> import nipype.interfaces.camino2trackvis as cam2trk
    >>> t2c = cam2trk.Trackvis2Camino()
    >>> t2c.inputs.in_file = 'streamlines.trk'
    >>> t2c.inputs.out_file = 'streamlines.Bfloat'
    >>> t2c.run()                  # doctest: +SKIP
    Tz-i %sr   zThe input .trk (trackvis) file.)r   r   r   r   r   z-o %sr   z4The filename to which to write the .Bfloat (camino).)r   r   r   r   z-a %sz-A file to which the append the .Bfloat data. )r   r   r   r   N)r   r   r   r2   r	   r   r   Zappend_filer    r    r    r!   r5   z   s"   r5   c               @   s   e Zd ZedddZdS )Trackvis2CaminoOutputSpecTz4The filename to which to write the .Bfloat (camino).)r   r   N)r   r   r   r	   caminor    r    r    r!   r6      s   r6   c               @   s0   e Zd ZdZeZeZdd Zdd Z	dd Z
dS )	Trackvis2CaminoZtrackvis_to_caminoc             C   s$   | j  j }tjj| j |d< |S )Nr7   )r%   r&   r'   r(   r)   r*   )r+   r,   r    r    r!   r-      s    zTrackvis2Camino._list_outputsc             C   s   |dkr| j  S d S d S )Nr   )r*   )r+   r.   r    r    r!   r/      s    zTrackvis2Camino._gen_filenamec             C   s   t | jj\}}}|d S )Nz.Bfloat)r   r0   r   )r+   r1   r.   r    r    r!   r*      s    z Trackvis2Camino._gen_outfilenameN)r   r   r   r3   r5   r4   r6   r%   r-   r/   r*   r    r    r    r!   r8      s   r8   )r2   r'   Zutils.filemanipr   baser   r   r   r   r	   r
   r"   r$   r5   r6   r8   r    r    r    r!   <module>   s   C'&