Using the theory of set-indexed martingales, we develop a general model for survival analysis with censored data which is parameterized by sets instead of time points. We define a set-indexed Nelson--Aalen estimator for the integrated hazard function with the presence of a censoring by a random set which is a stopping set. We prove that this estimator is asymptotically unbiased and consistent. A central limit theorem is given. This model can be applied to cases when censoring occurs in geometrical objects or patterns, and is a generalization of models with multidimensional failure times.