# System Theory – Introduction to Sampling and Quantization

These are the lecture notes for FAU’s YouTube Lecture “Medical Engineering“. This is a full transcript of the lecture video & matching slides. We hope, you enjoy this as much as the videos. Of course, this transcript was created with deep learning techniques largely automatically and only minor manual modifications were performed. Try it yourself! If you spot mistakes, please let us know!

Welcome back to Medical Engineering: medical imaging systems and today we want to talk about another very very important concept and this is sampling and quantization.

So this is the process that is involved to convert a signal from the analog domain into the digital domain. It is very important and you will see that everything we do in medical imaging systems as soon as it gets digital you have to know about the concepts of digitization and sampling quantization. So I hope you will enjoy the next couple of videos this won’t be too long of a video. It will have fundamental concepts that you really need to know about if you want to make a career in medical engineering and in particular you’re interested in digitization of any kind of signals.

Sampling is the process of getting a signal essentially into a digital computer. So sampling is the reduction of a continuous signal onto a discrete signal. We want to do it in a way that we don’t lose any information. So this means that we have to discretize along the time axis. So this is shown here on the right-hand side. We have to essentially figure out the continuous signal at certain points. So these are indicated with the arrows here on the right-hand side. So we have to sample the signal at these time points and this is of course discrete because we cannot store infinitely many variables or observations in our computer. The other thing is we need to quantize and this means that we also have to assign discrete values on the value axis. So we cannot just save infinitely many values in our computer. So we also have to have a step size here in the quantization. This is the main problem of sampling and digitization. The key problem that we’re actually facing is how do we select the parameters essentially the step size in between the samples and the step size in between the value such that we don’t lose any information. On the other hand, we also want to be able to use as little space as required. So we don’t want to have excessively many of these sampling steps because if I have to sample twice as often I need twice as much space. I also need to process twice as much data. So this is really crucial to set these spacings here correctly such that nothing really goes wrong. Things can go wrong quite a bit.

This is what I want to show you guys here in this plot. So here I have an input signal and this is the red curve. Now I decide to sample at the black dots and you see that I chose them at some arbitrary spacing. What you can see in this example is I always have the same distance between the black dots. So I get some values and the values are created exactly where the sampling frequency then hits again our red curve. So I produce those black dots. Now I have the black dots and I want to restore the original signal. If you look very closely you see that these black dots can be explained by a different sine wave. They actually can be explained by a sine wave of a much lower frequency and this effect is called aliasing. As soon as you do a wrong sampling what will happen is aliasing. So you’re no longer able to reconstruct the original signal and it’s not just that there are faint mistakes or something if you do the sampling wrong you get completely different signals. So they look entirely different because you didn’t obey the sampling frequency. This is also an effect that emerges if your visual system is being oversampled then there are certain effects that you can’t explain. I think the most frequent analogy that we find in the human visual system is the sampling of a spinning wheel. If a wheel rotates too quickly you can see that the actual wheel seems to be turning backward. This is because your visual system is exposed to a frequency that is higher than something that it can actually explain. It will then reconstruct in your brain a signal that doesn’t make sense. The fast-spinning wheel then looks like it’s turning backward. This is because it is rotating at a frequency that your perception is not able to comprehend and then you’re reconstructing something that doesn’t make sense.

So this is crucial and it’s very important. There is the Nyquist-Shannon sampling theorem which tells us how to pick the sampling frequency correctly.

It states if a function x(t) contains no frequencies higher than B Hz it is completely determined by giving its ordinance at a series of points spaced 1/(2B) seconds apart. So if we sample at a frequency that is twice as high as the highest frequency in the signal, we are able to restore the entire signal without any loss. So this means that our sampling distance ∆x must be equal to or smaller than half of the size of the shortest wavelength. So the shortest wavelength divided by 2 gives you the step size on your x-axis. So this is the sampling step size ∆t or if you convert it to frequency domain it would be the sampling frequency. This is quite important and this has several implications. In particular, if you have a digital signal that has been sampled at a certain frequency then there is no way that you can reconstruct frequencies from this that are higher than half of the sampling frequency. They will simply be lost. They will be mapped to lower frequencies. So if you have a digital signal then there is no way how to figure out what the highest frequency is in this digital signal unless you know that it was correctly sampled. It’s very very important and if you already have digital data and it wasn’t digitized properly you don’t bring this back but you will get those aliasing artifacts. Well, there’s one way how you can bring it back. That is the process of so-called super-resolution and this is something that is an advanced class. We won’t talk about super-resolution here in this course but we have other image processing courses where we talk about image super-resolution. Here the idea is that you know the system’s relations to each other and you have multiple observations of the same original system. For example, you know that the sampling pattern was shifted to each other and then you’re able to reconstruct the super-resolved signal from the information that is contained in the aliasing artifacts. Of course, you get a big problem if you used a filter before the digitization that gets rid of higher frequencies. Because that would mean that there is no aliasing or effects. So be careful with super-resolution but we don’t discuss it here. By the way, if you see things like CSI, where they reconstruct suddenly super sharp images from very old video footage, it’s all nonsense. It doesn’t work and well if it would work then you probably would have to embed prior knowledge and that then just means that you’re reconstructing something that comes from a different source but for sure not from this video footage.

Anyway, we have a couple of implications that we’ve seen by this sampling frequency. Now I want to show you a couple of sampling frequencies that are quite common in several applications.

Okay, so I think this is a key learning that you have here that digitization is driven by the purpose. Whenever you digitize something you need to know the purpose. This also drives us when we’re building medical imaging systems. We want to have a diagnostic purpose. So when we do medical images it’s not like with cameras or with you know human-computer interfaces where the human perception is the factor. But in medical imaging, the diagnosis is the relevant factor. So here all sampling and system design is done with respect to performing an optimal diagnosis. This is also why we use these many different systems and many different mechanisms. So here we have another purpose but generally, digitization is always driven by purpose. If the purpose changes you want to digitize it in a different way.

If you have further questions send me a note, leave comments and get in contact with the online forums. It’s no problem we try to keep up with that as quickly as possible. Of course, I also have some further readings for you in particular in our textbook the chapter on systems theory by Peter Fischer.