nipype icon indicating copy to clipboard operation
nipype copied to clipboard

FSL FAST output PATH problems

Open Ede1994 opened this issue 2 years ago • 0 comments
trafficstars

Summary

When using fsl.FAST() the outout files are written to a completely different output dir than specified. For other FSL tools like BET or FLIRT everything works without problems, with the same paths.

Actual behavior

The output of FAST is currently not generated because an unspecified path is used for the output. Reason unknown.

Expected behavior

All outputs should be stored in dstFilePath as specified.

Script/Workflow details

from nipype.interfaces import fsl

def fast(src_path, dst_path, img_type=1):
    fast = fsl.FAST()
    fast.inputs.in_files = src_path
    fast.inputs.img_type = img_type # (1 or 2 or 3)
    fast.inputs.hyper = 0.3
    fast.inputs.bias_iters = 1
    fast.inputs.number_classes = 3
    fast.inputs.out_basename = dst_path
    logging.info('FSL FAST cmd line: {}'.format(fast.cmdline))
    res = fast.run()
    return

for niiGzFile, stripFile in zip(niiGzPaths, stripFiles):
        path, file = os.path.split(stripFile)
        print('strip file: ', stripFile)

        ### Run FAST segmentation ###
        dstFile = file.split('.')[0]
        dstFilePath = path + '/' + dstFile
        print(dstFile)
        print(dstFilePath)
        segFiles.append(dstFilePath)
        logging.info('FAST Segmentation on: {} and {}'.format(niiGzFile, stripFile))
        try:
            fast(stripFile, dstFilePath)
            logging.info('Saved FAST Segmentation results: {}'.format(dstFilePath))
        except RuntimeError:
            logging.warning('Failed on: {}'.format(niiGzFile))

Platform details:

Output:

strip file:  /tmp/tmplb2q897b/12_dzne_flair_1iso_strip.nii.gz
12_mprage_1iso
/tmp/tmplb2q897b/12_mprage_1iso

FileNotFoundError: No such file or directory '/home/einspaennere/Documents/GitHub/mri_qc_pipeline/12_mprage_1iso_seg.nii.gz' for output 'tissue_class_map' of a FAST interface

Execution environment

  • Win11
  • WSL Ubuntu 20.04
  • VSCode WSL Remote

Ede1994 avatar Jul 25 '23 11:07 Ede1994