qsirecon.interfaces.converters module

Handle merging and spliting of DSI files.

class qsirecon.interfaces.converters.DSIStudioTrkToTck(from_file=None, resource_monitor=None, **inputs)[source]

Bases: SimpleInterface

Mandatory Inputs:
  • reference_nifti (a pathlike object or string representing an existing file)

  • trk_file (a pathlike object or string representing an existing file)

Outputs:

tck_file (a pathlike object or string representing a file)

class qsirecon.interfaces.converters.FIBGZtoFOD(from_file=None, resource_monitor=None, **inputs)[source]

Bases: SimpleInterface

Mandatory Inputs:
  • fib_file (a pathlike object or string representing an existing file)

  • ref_image (a pathlike object or string representing an existing file)

Optional Inputs:
  • mif_file (a pathlike object or string representing a file)

  • subtract_iso (a boolean) – (Nipype default value: True)

Outputs:

mif_file (a pathlike object or string representing an existing file)

class qsirecon.interfaces.converters.FODtoFIBGZ(from_file=None, resource_monitor=None, **inputs)[source]

Bases: SimpleInterface

Mandatory Inputs:

mif_file (a pathlike object or string representing an existing file)

Optional Inputs:
  • mask_file (a pathlike object or string representing an existing file)

  • num_fibers (an integer) – (Nipype default value: 5)

  • output_fib_file (a pathlike object or string representing a file)

  • unit_odf (a boolean) – (Nipype default value: False)

Outputs:

fib_file (a pathlike object or string representing an existing file)

class qsirecon.interfaces.converters.MergeFODGQIFibs(from_file=None, resource_monitor=None, **inputs)[source]

Bases: SimpleInterface

Merge FOD and GQI fib files.

Mandatory Inputs:
  • csd_fib_file (a pathlike object or string representing an existing file)

  • reference_fib_file (a pathlike object or string representing an existing file)

Optional Inputs:

fibgz_map (a pathlike object or string representing an existing file)

Outputs:
  • fibgz (a pathlike object or string representing an existing file)

  • fibgz_map (a pathlike object or string representing an existing file)

class qsirecon.interfaces.converters.NODDItoFIBGZ(from_file=None, resource_monitor=None, **inputs)[source]

Bases: SimpleInterface

Optional Inputs:
  • directions (a pathlike object or string representing an existing file)

  • icvf (a pathlike object or string representing an existing file)

  • isovf (a pathlike object or string representing an existing file)

  • mask_file (a pathlike object or string representing an existing file)

  • modulated_icvf (a pathlike object or string representing an existing file)

  • modulated_od (a pathlike object or string representing an existing file)

  • od (a pathlike object or string representing an existing file)

Outputs:

fibgz_file (a pathlike object or string representing an existing file)

qsirecon.interfaces.converters.amico_directions_to_fibgz(directions_img, od_img, icvf_img, isovf_img, odf_dirs, odf_faces, output_file, mask_img, modulated_od_img=None, modulated_icvf_img=None)[source]

Convert a NiftiImage of ODF amplitudes to a DSI Studio fib file.

Parameters:

directions_img: nb.Nifti1Image (I x J x K x 3)

peak directions image from NODDI fit

od_img: nb.Nifti1Image

orientation dispersion image

icvf_img: nb.Nifti1Image

icvf image

isovf_img: nb.Nifti1Image

isovf image

odf_dirs: np.ndarray

N x 3 array containing the directions corresponding to the amplitudes in amplitudes_img. The values in amplitudes_img.get_fdata()[..., i] are for the direction in odf_dirs[i].

odf_faces: np.ndarray

triangles connecting the vertices in odf_dirs

output_file: str

Path where the output fib file will be written.

mask_img: nb.Nifti1Image

3d Image that is nonzero where voxels contain brain.

modulated_od_img: nb.Nifti1Image

modulated orientation dispersion image

modulated_icvf_img: nb.Nifti1Image

modulated icvf image

Returns:

None

qsirecon.interfaces.converters.amplitudes_to_fibgz(amplitudes_img, odf_dirs, odf_faces, output_file, mask_img, num_fibers=5, unit_odf=False)[source]

Convert a NiftiImage of ODF amplitudes to a DSI Studio fib file.

Parameters:

amplitudes_img: nb.Nifti1Image

4d NIfTI image that contains amplitudes for the ODFs

odf_dirs: np.ndarray

N x 3 array containing the directions corresponding to the amplitudes in amplitudes_img. The values in amplitudes_img.get_fdata()[..., i] are for the direction in odf_dirs[i].

odf_faces: np.ndarray

triangles connecting the vertices in odf_dirs

output_file: str

Path where the output fib file will be written.

mask_img: nb.Nifti1Image

3d Image that is nonzero where voxels contain brain.

num_fibers: int

The maximum number of fibers/fixels stored in each voxel.

Returns:

None

qsirecon.interfaces.converters.amplitudes_to_sh_mif(amplitudes_img, odf_dirs, output_file, working_dir)[source]

Convert an image of ODF amplitudes to a MRtrix sh mif file.

Parameters:

amplitudes_img: nb.Nifti1Image

4d NIfTI image that contains amplitudes for the ODFs

odf_dirs: np.ndarray

2*N x 3 array containing the directions corresponding to the amplitudes in amplitudes_img. The values in amplitudes_img.get_fdata()[..., i] are for the direction in odf_dirs[i]. Here the second half of the directions are the opposite of the fist and therefore have the same amplitudes.

output_file: str

Path where the output .mif file will be written.

working_dir: str

Path where temp files will be written to

Returns:

None

qsirecon.interfaces.converters.combine_gqi_and_csd_fib_files(path_gqi_fib: str, path_fod_fib: str, merged_fib: str)[source]

Combine the GQI and CSD .fib-files such that the new CSD fib file contains ODF information from the old CSD file and DTI maps from the GQI file.

Args:

path_gqi_file: Full path to the GQI file path_csd_file: Full path to the csd file. This will be overwritten with the updated csd file.

qsirecon.interfaces.converters.fast_load_fibgz(fib_file)[source]

Load a potentially gzipped fibgz file more quickly than using built-in gzip.

qsirecon.interfaces.converters.fib2amps(fib_file, ref_image, subtract_iso=True)[source]
qsirecon.interfaces.converters.get_dsi_studio_ODF_geometry(odf_key)[source]
qsirecon.interfaces.converters.mif2amps(sh_mif_file, working_dir, dsi_studio_odf='odf8')[source]

Convert a MRTrix SH mif file to a NiBabel amplitudes image.

Parameters:

sh_mif_filestr

path to the mif file with SH coefficients

qsirecon.interfaces.converters.peaks_to_odfs(fibdict)[source]

If no ODF data is available, create fake ODFs that will behave properly.

qsirecon.interfaces.converters.popen_run(arg_list)[source]