Re: A pixel is not a little square

Posted by Mark Cannell on
URL: http://confocal-microscopy-list.275.s1.nabble.com/A-pixel-is-not-a-little-square-tp7468992p7469386.html

*****
To join, leave or search the confocal microscopy listserv, go to:
http://lists.umn.edu/cgi-bin/wa?A0=confocalmicroscopy
*****

I think I see the problem, the spurious frequencies arise from your thinking the _data_  is a continuous function and treating it as such (by "drawing a line ..."), but it is not, it  is discrete and can be faithfully represented by a _discrete_ Fourier transform (which folds at Fs/2). The hiighest frequency in the DFT is Fs, but we know we shouldn't look at that right?  There are _no_  'higher harmonics' present in the data, only in ones 'artistic' interpretation for display purposes.

If it looks jagged, that is because in reality sampled data really is!  The problem really arises because you do not know how to fill in the space between data samples.  You can interpolate (or not). If you interpolate you are making a statement about the model underlying the data and have just carried out a fitting exercise. Fitting is NOT raw data presentation. If you just plot data values you make no assumption about what should join the data, no model has been fit to the data. Every scientist should know the difference between a histogram and a continuous distribution and not be fooled by the vertical lines at the histogram boundaries (which is what you show in a pixel image).

The choice is yours, in one case you faithfully show unadulterated sampled data (the histogram looks less 'pretty' than a curve) or you fit a model and interpolate. The trouble with the latter is that the model is probably wrong and you hide the defects in the data (e.g. camera pixel size) from the keen eyed reviewer... Of course if the data points are really close together, the myopic reviewer can't see defects in you data :-) !  From  Guy's reasoning,  it would be impossible to represent any digitally sampled data because you are always pixelating a continuous function (all pictures get mad up of little squares -the printer dumps blobs of ink etc). So, where does the pixelation become acceptable? This is now aesthetic and has nothing to do with science or mathematics (those with perfect vision will always see discretization 'artifacts' more easily) .

Cheers Mark

On 16/04/2012, at 3:31 AM, Guy Cox wrote:

> *****
> To join, leave or search the confocal microscopy listserv, go to:
> http://lists.umn.edu/cgi-bin/wa?A0=confocalmicroscopy
> *****
>
> OK, having slept on it, I now feel that just maybe I can explain what this is all about.  If only the list would let us include pictures it would be much easier!
>
> Let's assume we have a digital image, from any source, consisting of pixels with a spacing s.  The smallest spacing we can resolve in this image is 2s, and this will correspond, in frequency space, with a frequency f.  f represents the bandpass limit of this system,  no higher frequencies can be passed.  Now imagine we have a row of pixels containing the following values:
>
> 255  0  255  0  255  0  255  0  255
>
> If we represent these pixels by little squares, we'll have something like a chessboard.  Taking a line along this chessboard will give us a square wave.  Now this square wave cannot be represented within the bandpass limit of the system, defined by the frequency f.  To represent a square wave we need an infinite series of sine waves f + 3f + 5f +7f .....    To get even a crude approximation to a square wave we need f + 3f - that is a frequency three times higher than the image can contain.    
>
> In other words, we've introduced a whole series of spurious frequencies into our image that not only were not there to start with, they could not possibly have been there.   Does this matter?  After all, we know they can't be real.  It does matter, because we are talking about a visual representation of our data - that's why we drew the little boxes in the first place.  Our eyes are very sensitive to edges* and the edges will take over if we let these frequencies come within the bandwidth of our eyes.   We will find it very hard to actually see the finest detail in our picture (defined by 2s, remember) because if we enlarge it enough to see this easily we'll also get the edges created by these spurious frequencies.  In everyday terms, the pixellation takes over from the picture.  
>
> Note that in all this discussion I have  not mentioned microscopes, cameras or anything - we are just talking about a digital image from any source.  It applies to confocal, widefield, and electron microscopes, telescopes, X-ray images and your holiday snaps.  Coming back to the microscopic world, if we oversample to the point where r, our minimum resolved distance, is substantially greater than 2s, we may not need to enlarge to the point where we see the spurious frequencies.  This is probably why some contributors to this discussion have advocated considerable levels of oversampling (though they probably didn't realise this, they just knew they got good pictures that way).  But oversampling in fluorescence can be very hard on our specimens.
>
> "But I'm using a CCD detector so my image is made up of little squares".  Yes, you can produce a 'coloured in' picture of your detector that way.  I'm assuming the image is actually what you want to see, though, not the detector.
>
> *Amusingly, the human eye does the same thing to emphasize edges as computer image processing does - it makes the dark side of the edge darker than it is and the light side lighter.
>
>                                                                                                                                   Guy
>
> PS.  This has doubtless confirmed my reputation among some people as an arrogant bastard.  They are probably right, but at least I'm an arrogant bastard who tries to help.  It's taken me two hours to write this.