Export nrrd file from mhd file for 600 patients

Operating system: mac os python 3.12
Slicer version:4.8.1
Expected behavior:I’ve 600 patients’ segmentation results of mhd/zraw files. I want to export them to NRRD files in 3D Slicer. However, applying this operation to each patient individually would be too time-consuming. Do you have any suggestions? I want use python to solve this problem.

This would be a pretty simple script - have you looked at examples in the script repository? Or you could ask a chatbot for advice and the come back here if you have specific questions.

I have read the script repository, but I still have some problems. Could you please point out the specific script to me from the script repository, I will add the loops to it later. Thanks so much.

This looks like what you need.

Read the files and write them to the new format and loop over your file list.

Thanks! It helps a lot!