In this tutorial I’m going to post some example code and walk you through converting a DICOM multi-frame image (CINE Loop) into an mp4 video file. I chose MP4 because it works well with Apple and Microsoft products.
You’ll need ffmpeg installed with the ability to do x264. The ffmpeg site has many guides on how to do this. I used this guide for CentOS 6 for this tutorial.
Once you’ve got the prerequisites out of the way, run the commands below to download and run a copy of the example files.
wget http://www.deanvaughan.org/projects/multi-frame-to-mp4.tar.gz tar zxvf multi-frame-to-mp4.tar.gz cd Mutli-Frame_to_MP4/ ./dcm2mp4.php sample.dcm
Your freshly created MP4 file is ./video_temp/sample.dcm.mp4, a copy is playing below:
Now take a look at dcm2mp4.php, it should be commented well enough to make it easy to understand what it is doing.