nipy / nipype

Workflows and interfaces for neuroimaging packages
https://nipype.readthedocs.org/en/latest/
Other
748 stars 530 forks source link

Fsl FAST outputs segmentation but yields issue with tissue_class_map #3311

Open vaeat opened 3 years ago

vaeat commented 3 years ago

Summary

When I run FSL FAST, I get my segmentations output, but have an error which stops me from running FAST in a loop.

Actual behavior

When I run FSL FAST, my segmentation outputs well, but I get the error: "FileNotFoundError: No such file or directory '/home/vaeat/Documents/sub-S01_ses-J0_maskedresult_order0_seg.nii.gz' for output 'tissue_class_map' of a FAST interface" I found a similar problem in the issue #2262, but haven't been able to solve the problem using either relative or absolute paths: the problem persists.

Expected behavior

this error shouldn't happen, as I do not specify any path for the tissue class map.

How to replicate the behavior

Running the script below with any nii.gz image yields the same problem.

Script/Workflow details

This is the script I am using:

in_gauss_list = [] out_gauss_list = [] path = "/home/vaeat/Documents/Stage_GIN/Data/BIDS_Unofficial_database/derivatives/SkullStripping/"

path = "BIDS_Unofficial_database/derivatives/SkullStripping/"

for sigma_val in np.linspace(0.6, 0.7, 12): in_gauss_list.append(path+"sub-S0"+"1"+"_ses-J0_masked"+'result_order'+str(round(sigma_val,3))+'_mirror.nii.gz') out_gauss_list.append(path+"sub-S0"+"1"+"_ses-J0_masked"+'result_order'+str(round(sigma_val,3))+'_mirror')

for in_image, out_image in zip(in_gauss_list, out_gauss_list):

  data_path = in_image 
  img_type_value = 1 #T1 weighted
  number_classes_value = 3 #(1 <= an integer <= 10)
  hyper_value = 0.1 #Main MRF parameter 
  bias_iters_value = 4 #nb of iterations for bias field removal 
  bias_lowpass_value = 20 #bias field smoothing 
  segments_value = True #also output one image per class 
  out_basename_value = out_image  

  #Fast segmentation  
  fastr = fsl.FAST()
  #Inputs Specs
  fastr.inputs.in_files = data_path
  fastr.inputs.img_type = img_type_value
  fastr.inputs.number_classes = number_classes_value  #(1 <= an integer <= 10)
  fastr.inputs.hyper = hyper_value
  fastr.inputs.bias_iters = bias_iters_value
  fastr.inputs.bias_lowpass = bias_lowpass_value 
  fastr.inputs.segments = segments_value
  fastr.inputs.out_basename = out_basename_value
  fastr.cmdline
  #out = fastr.run()
  pool.apply_async(out = fastr.run())
  #assert os.path.dirname(out.outputs.tissue_class_map) == os.path.dirname(data_path)

pool.close() pool.join()

this is the error I get: image

Platform details:

{'commit_hash': '54f502940',
 'commit_source': 'installation',
 'networkx_version': '2.5',
 'nibabel_version': '3.2.1',
 'nipype_version': '1.6.0',
 'numpy_version': '1.20.1',
 'pkg_path': '/home/vaeat/.local/lib/python3.8/site-packages/nipype',
 'scipy_version': '1.6.1',
 'sys_executable': '/usr/bin/python3.8',
 'sys_platform': 'linux',
 'sys_version': '3.8.5 (default, Jan 27 2021, 15:41:15) \n[GCC 9.3.0]',
 'traits_version': '6.2.0'}
luyiyun commented 2 years ago

I have the same error without any nii.gz files.