You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
DICOM converter never copies files to temp_dir — dcm2niix subprocess is never called #40
The convert() method creates a temp_dir and iterates over DICOM files to read headers, but never actually copies the DICOM files into temp_dir. The os.listdir(temp_dir) check on line 50 always finds an empty directory and returns early. The dcm2niix subprocess is never called.
Reproduction (on main branch)
Reproducible Code (Python)
# reproduce_bug7.py — Run: .venv\Scripts\python.exe bug_7\reproduce_bug7.pyimportinspectfrompyaslreport.converters.dicom_to_nifti_converterimportDICOM2NiFTIConverter# Inspect the convert() source — no shutil.copy anywheresrc=inspect.getsource(DICOM2NiFTIConverter.convert)
print("shutil.copy in source:", "shutil.copy"insrc) # False on main (bug)# The module doesn't even import shutilmodule_file=inspect.getfile(DICOM2NiFTIConverter)
withopen(module_file, 'r') asf:
print("import shutil:", "import shutil"inf.read()) # False on main (bug)
API Endpoint Reproduction
# api_reproduce_bug7.py — Shows converter returns early with "No DICOM files found"importtempfile, pydicomfrompyaslreport.converters.dicom_to_nifti_converterimportDICOM2NiFTIConverter# Create 2 valid DICOM files and call converterwithtempfile.TemporaryDirectory() astest_dir:
# ... (create minimal DICOM files with pydicom)result=DICOM2NiFTIConverter.convert(
dcm_files=[dcm_path1, dcm_path2], nifti_file=None
)
_, _, _, _, error_msg=resultprint(f"error_msg: {error_msg}")
# On main: "No DICOM files found." — despite valid input!# After fix: (attempts dcm2niix — files were copied to temp_dir)
Automated Results on main branch
#
Test
Status
Detail
T1
convert() copies DICOM files into temp_dir
FAIL
No file copy operation found
T2
temp_dir receives files before dcm2niix
FAIL
Loop reads headers but writes nothing
T3
os.listdir check doesn't cause false early return
FAIL
Always returns early — temp_dir empty
T4
Module imports shutil
FAIL
shutil not imported
Summary: PASSED=0 FAILED=4
API/Converter Output on main
Input: 2 valid DICOM files
Converter Output:
converted_files: None
converted_filenames: None
nifti_file: None
file_type: nifti
error_msg: No DICOM files found.
>> BUG PRESENT: Converter returned 'No DICOM files found.' despite valid DICOM input.
Root cause: Files were never copied to temp_dir.
Activity