A method of signal processing for medical imaging, the method comprising: providing projection data acquired by one or more gamma detectors of a medical imaging system, the projection data representing detected counts of photons emitted by a radioisotope within a patient, the counts detected for a plurality of projections, the counts for each projection binned into a plurality of time bins to provide respective frames of the projection data; using a computer processor of the medical imaging system, computing a weight factor for each pair of input points among a plurality of input points associated with respective time bins, each input point being an M -dimensional representation of the frame corresponding to the associated time bin for one of the projections, wherein each weight factor is inversely proportional to a distance computed between the corresponding pair of input points according to an adaptive distance measure dependent on the projection data corresponding to said one projection; and using said computer processor, generating an N -dimensional surrogate respiratory signal based on an optimization of a nonlinear objective function using the weight factors, wherein N<M and the surrogate respiratory signal is indicative of respiratory activity by the patient, wherein the weight factors are stored in an adjacency matrix, the method further comprising computing one or more eigenvectors of a Laplacian matrix based on the adjacency matrix; wherein the N-dimensional surrogate respiratory signal is generated based on the one or more eigenvectors, and for each projection p: computing the adjacency matrix based on input points representing a frame of said projection p, computing the one or more eigenvectors of the Laplacian matrix, and generating the N-dimensional surrogate respiratory signal, to generate a surrogate respiratory signal corresponding to said projection p; characterised in that the method further comprises: reversing the polarity of at least one of the surrogate respiratory signals corresponding to a respective projection based on a correlation with a reference signal. providing projection data acquired by one or more gamma detectors of a medical imaging system, the projection data representing detected counts of photons emitted by a radioisotope within a patient, the counts detected for a plurality of projections, the counts for each projection binned into a plurality of time bins to provide respective frames of the projection data; using a computer processor of the medical imaging system, computing a weight factor for each pair of input points among a plurality of input points associated with respective time bins, each input point being an M -dimensional representation of the frame corresponding to the associated time bin for one of the projections, wherein each weight factor is inversely proportional to a distance computed between the corresponding pair of input points according to an adaptive distance measure dependent on the projection data corresponding to said one projection; and using said computer processor, generating an N -dimensional surrogate respiratory signal based on an optimization of a nonlinear objective function using the weight factors, wherein N<M and the surrogate respiratory signal is indicative of respiratory activity by the patient, wherein the weight factors are stored in an adjacency matrix, the method further comprising computing one or more eigenvectors of a Laplacian matrix based on the adjacency matrix; wherein the N-dimensional surrogate respiratory signal is generated based on the one or more eigenvectors, and for each projection p: computing the adjacency matrix based on input points representing a frame of said projection p, computing the one or more eigenvectors of the Laplacian matrix, and generating the N-dimensional surrogate respiratory signal, to generate a surrogate respiratory signal corresponding to said projection p; characterised in that the method further comprises: reversing the polarity of at least one of the surrogate respiratory signals corresponding to a respective projection based on a correlation with a reference signal.