The dose of radiation therapy is calculated based on several factors, including the type and stage of cancer, the patient's overall health, and the location of the tumor. Advanced imaging techniques and computer algorithms help in planning the treatment and determining the optimal dose distribution, ensuring that the tumor receives the required number of Grays while sparing healthy tissues as much as possible.