Re: [Microscope] Corrected Images
- I started doing some sketchy notes on stacking etc. a wile back, if you can waid through, and understand the excerpt below it might help explain some of the differences between CZ and HF. People generally use CZ's Do Stack macro which is at 3 on my stacking spectrum. From what I have worked out HF is somewhere nearer 5. At 5 the order of the frames is not important but at three it is.
Below are the notes.
The Stacking Method Spectrum
There are two opposing stratagies that can be used when stacking, the first involves taking the best focused pixels from each XY location in the stack this will give a depthmap of Z values i.e. frame numbers from which the pixels in the finished picture should come, this Montage method is like cutting the best bits from a set of photographs and sticking them next to each other. The second method involves adding all of the frames together and deviding by the number of frames and then sharpening the result, this is called Averageing. (For the more technically minded, adding the frames preserves the high frequency components, including noise, then High Pass filtering reduces the low frequencies thus making detail visible again, but the more frames there are the more noise is accumulated).
There are disadvantages to both methods and some sort of a compromize is necessary to get best results. The following spectrum of possibilities exists.
1. Strict Montage
2. Montage with feathered featureless areas
3. Montage with feathered edges and featureless areas
4. Montage as in 1., 2. or 3. with weighted Average Correction
5. weighted Average
Of these 3. is implemented in the Do Stack macro, 4 is the Do Stack followed by Weighted Average Correction and 5. is the Do Weighted Average macro.
There are several factors which dictate the best choice of method, here are some and what happens as you move down the above list.
1. The appearance of areas which are without detail or are out of focus improves
2a. The 'Faithfullness' of the result for non overlapping features decreases
2b. The 'Faithfullness' of the result for overlapping features generally increases.
3. The 'Halo' artifact is at a minimum at 4.
4. 'Ambiguity' artifacts minimum at 4.
5. 'Deep Stack' problems are worst for 6. and 1.
6. 'Noise' problems 6. best for small stacks, worst for large.
7. A 'Depthmap' is produced by 1-3.
Faithfullness is a measure of how similar the result is to the original frames, obviously if two or more frames are blended together in some way the result will be like neither but somewhere between.
The Halo artifact appears when there are areas next to each other in the result which come from different frames and have contrasting colours. It is a result of there being an out of focus area on each frame of the other frame which may be included in the resultant image. This might also include flairs next to highlights.
Ambiguity occurs when there is something in focus at the same point on two or more frames, which frame should appear in the result? You may say it is simple, the one on top. But what if that is noise, is transparent, is just a less well focused version of the one underneath, or the stack is upside down. A property of a Montage is that only one pixel from just one input frame can contribute to one pixel in the output frame. A property of an averaged pixel in the output frame is that it is the average of every pixel at this XY location. The corresponding property for a weighted average is that it is the average of all pixels at this XY location but greater emphasis is placed on those pixels that might be in focus based on a comparison of them with their neighbours. From these three properties it can be deduced that if there are no crossing/overlapping elements in the scene the montage method is best, but if a combination of pixels from different frames is needed, as often happens in transmitted light microscopy, the weighted average method might be best.
Deep Stacks, i.e. those with a lot of frames in which much of the detail is out of focus in most of the frames have several problems. Noise while barely noticeable in individual frames can be accumulated in both montaged and averaged frames. There are always a few pixels that come above the noise threshold and are recognized as detail, usually this is of little consequence, but with large numbers of frames a lot of errors of this type can spoil a Montage image. When a lot of frames are averaged together the detail in them becomes very dilute and consequently the amount of sharpening to restore it is great this in turn amplifies any noise which will spoil the result. It is clear that the image of an object spreads as it goes out of focus, this spreading is obviously greater with deep stacks. Thus an out of focus image of a foreground object may be superimposed on an in focus image of an object deeper into the scene thus spoiling its appearance. The ambiguity problem outlined above is especially important with deep stacks, you can often see right through a small or narrow object to another object that is much deeper into the stack.
There are two problems caused by noise in the frames. First when doing a montage noise may be detected as false detail especially in areas of the scene which should have little or no detail. Second when sharpening the average of a stack the noise is amplified.
A depthmap is a two dimentional array of frame numbers, there is one number at each XY location in the stacked image. This single number is allowed to take fractional values i.e. it can refer to a point in the Z direction between two frames, for this to be meaningful the frames must be in sequential order, randomly arranged frames will give unpredictable results. The single valuedness of the depthmap means that two frames that are not neighbours in the stack cannot contribute to the same pixel, neighbours can be blended to arrive at intermediate values.