Added detector distance auto detection.
Merge commit '1e50dcd944f9b6b4af19f0b29ec932eb3371129b'