Sikerdebaard / dcmrtstruct2nii

DICOM RT-Struct to mask
MIT License
91 stars 27 forks source link

Packaged as an exe and opened with an error #48

Closed SuperLuckyKris closed 6 months ago

SuperLuckyKris commented 6 months ago

I want to package it as an exe, and then call it through matlab, but it reports an error, ModuleNotFoundError: No module named 'pydicom.encoders.gdcm' But the pydicom moudle I've pip installed but it still gives me an error after it's packaged.

Here's the py file I packed;

from dcmrtstruct2nii import dcmrtstruct2nii, list_rt_structs
import sys

def main(rtstruct_file, dicom_file, output_path):
    structures = list_rt_structs(rtstruct_file)
    print("Structures found in RTStruct file:", structures)
    dcmrtstruct2nii(rtstruct_file, dicom_file, output_path, structures=structures)

if __name__ == "__main__":
    if len(sys.argv) != 4:
        print("Usage: python script.py rtstruct_file dicom_file output_path")
        sys.exit(1)

    rtstruct_file = sys.argv[1]
    dicom_file = sys.argv[2]
    output_path = sys.argv[3]
    main(rtstruct_file, dicom_file, output_path)