Image guided external beam radiation therapy (EBRT) for the treatment of cancer enables accurate placement of radiation dose to the cancerous region. However, the deformation of soft tissue during the course of treatment, such as in cervical cancer, presents significant challenges. Furthermore, the presence of pathologies such as tumors may violate registration constraints and cause registration errors. In this paper, we present a unified MAP framework that performs automatic segmentation, nonrigid registration and tumor detection simultaneously. It can generate a tumor probability map while progressively identifing the boundary of an organ of interest based on the achieved transformation. We demonstrate the approach on a set of 30 T2-weighted MR images, and the results show that the approach performs better than similar methods which separate the registration and segmentation problems. In addition, the detection result generated by the proposed method has a high agreement with the manual delineation by a qualified clinician.