In the past 20 years the search for neutrinoless double beta decay has driven many developements in all kind of detector technology. A new branch in this field are highly-pixelated semiconductor detectors - such as the CdTe-Timepix detectors. It compromises a cadmium-telluride sensor of 14 mm x 14 mm x 1 mm size with an ASIC which has 256 x 256 pixel of 55 \textmu m pixel pitch and can be used to obtain either spectroscopic or timing information in every pixel. In regular operation it can provide a 2D projection of particle trajectories; however, three dimensional trajectories are desirable for neutrinoless double beta decay and other applications. In this paper we present a method to obtain such trajectories. The method was developed and tested with simulations that assume some minor modifications to the Timepix ASIC. Also, we were able to test the method experimentally and in the best case achieved a position resolution of about 90 \textmu m with electrons of 4.4 GeV.