Indeed, there are a number of focus stacking programs available, both commercial, as 'Helicon Focus' and 'Zerene Stacker', and free, as 'Picolay' und 'Combine ZP'.
The sticking point, however, when you use focus stacked images for photogrammetry, is perspective: The photogrammetric process requires a unique perspective for all parts of the image, which usually is not present in a focus stack, whether you capture the images with a macro rail or by adjusting the focal plane with the focal ring. In the "stacked" image with extended focal depth, the slight perspective errors are not noticable to the human eye, but they deteriorate the quality of a 3d model calculated with PhotoScan or any other photogrammetric software. The models may be acceptable for compact subjects, but for delicate subjects as insects, the results are mostly disappointing.
A way to overcome the persprcective problem, is a calibration of the camera motion used for the image capturing, together with an algorithm for the correction of the perspective change, see for this our publication
zookeys.pensoft.net/articles.php?id=24584 on insect 3d modelling with PhotoScan.
Best regards,
Twister