qsiprep.interfaces.utils module

Miscellaneous utilities

class qsiprep.interfaces.utils.AddTSVHeader(from_file=None, resource_monitor=None, **inputs)[source]

Bases: SimpleInterface

Add a header row to a TSV file

>>> import os
>>> import pandas as pd
>>> import numpy as np
>>> from tempfile import TemporaryDirectory
>>> tmpdir = TemporaryDirectory()
>>> os.chdir(tmpdir.name)

An example TSV:

>>> np.savetxt('data.tsv', np.arange(30).reshape((6, 5)), delimiter='       ')

Add headers:

>>> from qsiprep.interfaces import AddTSVHeader
>>> addheader = AddTSVHeader()
>>> addheader.inputs.in_file = 'data.tsv'
>>> addheader.inputs.columns = ['a', 'b', 'c', 'd', 'e']
>>> res = addheader.run()
>>> pd.read_csv(res.outputs.out_file, sep='\s+', index_col=None,
...             engine='python')  
      a     b     c     d     e
0   0.0   1.0   2.0   3.0   4.0
1   5.0   6.0   7.0   8.0   9.0
2  10.0  11.0  12.0  13.0  14.0
3  15.0  16.0  17.0  18.0  19.0
4  20.0  21.0  22.0  23.0  24.0
5  25.0  26.0  27.0  28.0  29.0
>>> tmpdir.cleanup()
Mandatory Inputs:
  • columns (a list of items which are a string) – Header for columns.

  • in_file (a pathlike object or string representing an existing file) – Input file.

Outputs:

out_file (a pathlike object or string representing an existing file) – Output average file.

class qsiprep.interfaces.utils.ConcatAffines(num_affines=0, *args, **kwargs)[source]

Bases: SimpleInterface

Optional Inputs:

invert (a boolean) – Invert output transform. (Nipype default value: False)

Outputs:

out_mat (a pathlike object or string representing an existing file) – Output transform.

class qsiprep.interfaces.utils.TestInput(from_file=None, resource_monitor=None, **inputs)[source]

Bases: SimpleInterface

Optional Inputs:

test1 (any value)