Sensitivity is calculated as the number of true positives divided by the sum of true positives and false negatives. Specificity is calculated as the number of true negatives divided by the sum of true negatives and false positives. These calculations provide a quantitative measure of a test’s performance in distinguishing between diseased and healthy tissues.