M.mode.ify theory

M-Mode is a way of demonstrating movement with a still image. This was particularly useful for (the now) archaic archival systems that did not support the viewing or storage of clips.  Nowadays modern ultrasound archival systems allow the storage of clips for easy viewing.  There are still instances, however, when M-Mode is useful.  Examples include measuring an EPSS and IJ distensibility index.  The typical ultrasound system only allows M-Mode measurement contemporaneous with the acquisition of images, but you may find you would like an M-Mode clip post-hoc.  Enter: M.mode.ify.

The process is simple, M.mode.ify takes an ultrasound clip such as this and breaks it down into individual frames.  The user then selects a line of data to be taken out, and M.mode.ify rotates the entire image stack and pulls a 3 pixel wide image from each frame.  Smash them together and you magically have an M-Mode.  In this example there is no rotation necessary:


Frequently Asked Questions

  • I get how the m-mode is created, but how does does the measurement tool work?
    • The simple calibration page maps the distance on your clip in pixels to 4 cm.  When your m-mode is viewed, cm can be calculated with the conversion factor of pixels/cm.
    • As for the time calculation, no calibration is necessary.  This is because I already know that I have taken 3 pixels from each frame, I can determine the total number of frames and total clip duration.  It’s just math to figure out pixels/s.
  • Why do you ask to calibrate over 4 cm, it seems that it would be easier for me to just measure 1 cm?
    • This is to decrease the measurement error.  If you measure 4 cm with the same precision, the error will be a fourth of the 1 cm measurement error.  I suspect this is why u/s manufacturers use a 2 beat peak-to-peak for FHR measurement.
  • My M-Mode is kinda crummy looking, what gives?
    • Clips with low frame rates (<30 fps) show a ton of movement between frames, so the resulting M-Mode will be choppy.  Good example: try running M.mode.ify on a echocardiogram taken in abdominal mode.
  • Can you make a horizontal M.mode.ify (example: for measuring EPSS in the apical view)?
    • Done.  You can now select an m-mode line on any axis.  The possibilities are endless.
  • What tools did you use to create M.mode.ify?
    • the workhorse applications are open source: ImageMagick (mogrify/convert/composite) and ffmpeg.  Front end/GUI coding done in HTML5/PHP/JQuery/CSS/bash.
  • My clip won’t work, I get an error.  WTH?
    • At this time, mp4/H.264, mov/qt, mpeg, avi, and webm clips < 10 MB are supported.