In the past decades the search for neutrinoless double beta decay has driven many developments in all kind of detector technology. A new branch in this field are highly-pixelated semiconductor detectors-such as the CdTe-Timepix detectors. It comprises a cadmium-telluride sensor of 14 mm 14 mm 1 mm size with an ASIC which has 256 256 pixel of 55 A mu m pixel pitch and can be used to obtain either spectroscopic or timing information in every pixel. In regular operation it can provide a two dimensional projection of particle trajectories; however, three dimensional trajectories are desirable for neutrinoless double beta decay search 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 63 A mu m for electrons with an energy of 4.4 GeV.