The way to beat the Depth of Field hoodoo. Or is it?
Focus stacking software can help you to achieve a much better Depth of Field, but it comes with it's own set of challenges.
There are a few focus stacking products out there including CombineZ, Zerene Stacker and Helicon Focus, amongst others. Some are free, some you can try before you buy. There is a list in this Wikipedia article.
I can only comment on two. I first tried CombineZ a few years ago with limited success. It is free, but it is very user unfriendly. I have now purchased a copy of Zerene Stacker after trialling it. Very user friendly, and the results are mostly really good.
All of these challenges can be readily dealt with using functions within the stacking software, or through Image Editing (eg: clone tool). There are numerous tutorials available on the internet, including videos.
Here's two examples of a composite image made up from 10 and 15 images respectively, and using Zerene Stacker.
Example 1: The first image is the first in a stack of ten. Note the quartz crystals towards the back are in focus. The second image is the last in a stack of ten. Note the quartz crystals are well out of focus. The third image is the final product showing the quartz crystals and the rare mineral, gelosaite, from Kingsgate, New South Wales. This image was cropped slightly to remove edge artifacts (caused due to changes in alignment of each image), and to remove the result of one piece of dust on my camera's sensor (this appeared as ten small spots due to the aligning of images).
Example 2: The first image is the first in a stack of fifteen. The second image is the last in a stack of fifteen. The third image is the final product showing the hyalite opal “caps” on conichalcite, from Dome Rock, South Australia. This image had a number of problems as shown in the next lot of images. The dust problems were fixed using Zerene Stacker's Retouching option. The halo was fixed partly through retouching and partly through use of a clone tool. Finally, the image was cropped quite significantly to remove the edge artifacts. This last problem was significant due to the high magnification (40x) and the larger number of images in the stack.