Skip to content

nipype issues with calling dcm2nii #3302

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
Gresliebear opened this issue Feb 16, 2021 · 7 comments
Open

nipype issues with calling dcm2nii #3302

Gresliebear opened this issue Feb 16, 2021 · 7 comments

Comments

@Gresliebear
Copy link

Gresliebear commented Feb 16, 2021

nipype noob here thank you for developing this software packages its very help but I am running to into simply problem by reading in a source_dir PAT001 containing 201 dcm files convert into nii file for developing pipeline for a deeplearning model

OSError: [WinError 10038] An operation was attempted on something that is not a socket

Summary

# change these for your system
dcm_folder = 'D:\L_pipe\DataScienceDeck\DataScienceDeck\Data\Data_input\PAT001' ## our input is the number 201 dcm files 
output_folder = 'D:\L_pipe\DataScienceDeck\DataScienceDeck\Data\Data_output\output_nifti'

def convert_dcm_2_nii_x(dcm_folder, output_folder):
    converter = Dcm2niix()

    print(len(dcm_folder))

    converter.inputs.source_dir = dcm_folder
    converter.inputs.output_dir = output_folder
    converter.inputs.compress = 'i'
    converter.run()
    return print("done")

from nipype.interfaces.dcm2nii import Dcm2nii

Actual behavior

210216-11:28:56,30 nipype.interface INFO:
         [WinError 10038] An operation was attempted on something that is not a socket
Traceback (most recent call last):
  File ".\dcm2nifti.py", line 50, in <module>
    convert_dcm_2_nii_x(dcm_folder, output_folder)
  File ".\dcm2nifti.py", line 26, in convert_dcm_2_nii_x
    converter.run()
  File "D:\L_pipe\pipeline_env\lib\site-packages\nipype\interfaces\base\core.py", line 434, in run
    runtime = self._run_interface(runtime)
  File "D:\L_pipe\pipeline_env\lib\site-packages\nipype\interfaces\dcm2nii.py", line 445, in _run_interface
    runtime, correct_return_codes=(0, 1,)
  File "D:\L_pipe\pipeline_env\lib\site-packages\nipype\interfaces\base\core.py", line 827, in _run_interface
    runtime = run_command(runtime, output=self.terminal_output)
  File "D:\L_pipe\pipeline_env\lib\site-packages\nipype\utils\subprocess.py", line 137, in run_command
    _process()
  File "D:\L_pipe\pipeline_env\lib\site-packages\nipype\utils\subprocess.py", line 124, in _process
    res = select.select(streams, [], [], timeout)
OSError: [WinError 10038] An operation was attempted on something that is not a socket

I am pretty sure dcm2nii code is running because it generates a bunch of .nii files
image

Expected behavior

image

Script/Workflow details

taking 200 DICOM files into a single nii file

Platform details:

Windows 10 VScode python 3.7


Execution environment

Choose one

  • Container [Tag: ???]
  • My python environment inside container [Base Tag: ???]
  • My python environment outside container
@athertya
Copy link

I have the same issue and error,windows socket error. How to solve ?

@effigies
Copy link
Member

Hi, the problem is that we don't support Windows (this is issue #3277). We'd be happy to accept a patch from someone with a Windows machine. You can also try using the Windows Subsystem for Linux (WSL), but I don't have any experience there.

@Gresliebear
Copy link
Author

it will be a weekend project for me when I get around to it after work.

@athertya
Copy link

Thank you for getting back on this issue. @Gresliebear That would be great. Please do keep me posted.

@TamerGezici
Copy link

Hi. Is there any news on the compatibility of dcm2niix for windows? The socket error still persists for me.
As I mentioned in this issue: rordenlab/dcm2niix#609

@effigies
Copy link
Member

effigies commented Jun 5, 2022

I have recently come into possession of a Windows machine, so when I have the opportunity, I can try to debug this. Making nipype Windows compatible will be a major effort, though. Have you looked into Pydra? Or using the WSL?

@yarikoptic
Copy link
Member

any luck ? it seems there are more users hitting this: https://neurostars.org/t/dcm2niix-error-using-heudiconv/26759

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants