1

I have a MacOS 10.13.4 and I want to write a GUI in python3 able to measure measure intervals on a scanned Electrocardiogram or ECG (hear rhythm of a patient). I have some programming knowledge in python but I'm not a professional computer scientist

For this I need to do the following steps:

  1. Rotation: Rotate the image so that the ECG baseline is pefectly horizontal (because the ECG on the scan can be a little rotated by a few degrees of angle). Here is an image of an ECG which needs to be rotated: enter image description here

  2. Set the scale: As an ECG paper has always a system of grid squares which defines the time on the horizontal axis (40ms for a small square and 200ms for a big square) and the the amplitude of the signal in mV in the vertical axis (0.1mv for a big square). I want to measure unit time an unit amplitude and set it as reference. Here is an image of the scale enter image description here

  3. Measure intervals: Measure the different in terms of time interval and amplitude difference of the difference ECG points (P Wave, QRS, T Wave). Here is an image of the different intervals: enter image description here

For the GUI, I'm thinking using Tkinter (any other thoughts)

What would be a simple Solution for this in terms of image processing: - I tried to install openCV but got stuck in the install openCV - Is Python Imaging Library - PIL a good alternative - Any other thoughts?

Many thanks in advance!

ecjb
  • 5,169
  • 12
  • 43
  • 79
  • Maybe you could share a sample image or two. And mention your Operating System. – Mark Setchell May 02 '18 at 09:33
  • Thank you for the comment @MarkSetchell. I added An image of an ECG and the operating system (MacOS 10.13.4). Is it clearer or would you like other info? – ecjb May 02 '18 at 10:22
  • That's a diagram which is useful as an explanation, but doesn't start to show up any problems that you might encounter with a real images - such as poor illumination, noise, camera movement, misalignment... – Mark Setchell May 02 '18 at 10:26
  • @MarkSetchell: I added an image of an ECG which needs to be rotated. Please let me know if you need other infos – ecjb May 02 '18 at 10:56
  • If that is the quality of your images, you are going to have hard time indeed. – Mark Setchell May 02 '18 at 13:01
  • The quality of the images is indeed probably better in reality. I added the image of a more representative sample @MarkSetchell. Do you have any recommendations for packages to use `Python Imaging Library - PIL`, openCV, others?? – ecjb May 02 '18 at 13:54
  • Are you expecting the software to identify peaks and measure all those things itself and tell you the answers in beat per second or average millivolts per beat or somesuch? Or are you expecting to draw lines on the image with your mouse between peaks and the software to tell you how long the line is? – Mark Setchell May 02 '18 at 14:04
  • @MarkSetchell Definitely the second option at least in a first time. The first option would be an option but would be probably less precise – ecjb May 02 '18 at 14:18
  • How did you solve the problem? – Dandelion Jun 01 '20 at 10:02
  • 1
    @Dandelion, I finally used Pyside2 and not Tkinter and used a template provided by ekhumoro in his answer of this question `https://stackoverflow.com/questions/50209879/how-to-load-an-image-with-qlabel-in-pyside2`. I used open cv to rotate the image and clicked on squares to convert pixels into mm – ecjb Jun 01 '20 at 10:38
  • @ecjb Thank you very much. – Dandelion Jun 01 '20 at 19:08

0 Answers0