It is aspect ratio of your voxels, which was used to calculate size of the volume with isotropic dimension. I assume that it is needed as the procedure works with binary 3D arrays (binary 3D arrays have no information about physical coordinates of your original dataset)
Your image is 512 x 512, which corresponds to 3 um. As result, pixel size is 3000/512=5.86 nm/pixel. Your heights are up to 100 nm, which corresponds to 100/5.86 = 17 pixels. In this sense, your final volume with isotropic voxels will be 512x512x17 and instead of “round(maxVal*zRatio)” you can put value 17 in the code.
Naturally 17 is quite small variation and I think that digitization of your signal is way better.
One possible solution is to work with anisotropic voxels and make a volume as 512x512x100, where your x/y resolution is 5.86 nm/pixel and the z-resolution 1 nm/pixel. Perhaps, procedure will still generate correct result (fractal dimension). I do not know in which way the result is expressed, if made of coordinates, the z-coordinate needs to be adjusted, i.e. divided by 5.86.
But I have not worked with that kind of data, so my suggestions are just general thoughts on how it may potentially be implemented.