I had a MRI today, and afterwards I was given a CD of my scan. The data on the CD was stored in DICOM format, and after some searching I was able to find some open source software to view the data. I especially liked Aeskulap which allowed interactive viewing of the data in multiple dimensions.
I don’t know the exact layout, but on the CD I seemed to have 12 different scans, each with a series of images. The name of the files were all 8 digits numbers, with the first three being the scan number (0 to 11), and the following five digits being (0 to whatever). For example:
DICOM/185723/00000000: DICOM medical imaging data DICOM/185723/00000001: DICOM medical imaging data DICOM/185723/00000002: DICOM medical imaging data ... DICOM/185723/00100000: DICOM medical imaging data DICOM/185723/00100001: DICOM medical imaging data DICOM/185723/00100002: DICOM medical imaging data ...
To create videos the first thing I did was to convert the images from DICOM to PNG
sudo apt-get install medcon mkdir png for i in DICOM/185723/*; do medcon -f $i -c png -o png/`basename $i`.png ; done;
Now to batch the images I started by creating animated gifs.
sudo apt-get install imagemagick # Create animated gifs for i in `seq -w 000 011`; do convert -delay 20 -loop 0 png/$i*.png $i.gif; done;
However, those gifs were huge, up to 20mb. So next I created a set of videos (that were a order of magnitude smaller than the gifs):
sudo apt-get install ffmpeg # Create MP4 for i in `seq -w 000 011`; do avconv -r 5 -i png/$i%05d.png -r 24 $i.mp4; done; # Create webm for i in `seq -w 000 011`; do avconv -r 5 -i png/$i%05d.png -r 24 $i.webm; done; # Create ogg video for i in `seq -w 000 011`; do avconv -r 5 -i png/$i%05d.png -r 24 $i.ogg; done;