2-photon intravital microscopy (2P-IVM) is a key technique to investigate cell migration and cell-to-cell interactions in organs and tissues of living organisms. Focusing on immunology, 2P-IVM allowed recording videos of leukocytes during the immune response, highlighting unprecedented mechanisms of the immune system. However, the automatic analysis of the acquired videos remains challenging and poorly reproducible. In fact, both manual curation of results and tuning of bioimaging software parameters among different experiments, are required. One of the most difficult tasks for a user is transferring to a computer the knowledge on what a cell is and how it should appear with respect to the background, other objects, or other cell types. This is possibly due to the low specificity of acquisition channels which may include multiple cell populations and the presence of similar objects in the background. In this work, we propose a method based on semi-supervised machine learning to facilitate colocalization. In line with recently proposed approaches for pixel classification, the method requires the user to draw some lines on the cells of interest and some line on the other objects/background. These lines embed knowledge, not only on which pixel belongs to a class or which pixel belongs to another class but also on how pixels in the same object are connected. Hence, the proposed method exploits the information from the lines to create an additional imaging channel that is specific for the cells fo interest. The usage of this method increased tracking accuracy on a dataset of challenging 2P-IVM videos of leukocytes. Additionally, it allowed processing multiple samples of the same experiment keeping the same mathematical model.