/** * Represents the input parameters and calculated results for a single eye undergoing LASIK surgery. */ class Eye { // --- Input Parameters --- private double sphere; private double cylinder; private int axis; private int centralCornealThickness; // CCT in microns private double opticalZone; // OZ in mm private int flapThickness; // in microns private double transitionZoneAblation; // in microns // --- Calculated Results --- private double totalDioptricCorrection; private double munnerlynAblation; private double totalAblation; private double residualStromalBed; // RSB in microns private double ablationRatio; /** * Constructor for the Eye class. * @param sphere The spherical refractive error in diopters. * @param cylinder The cylindrical refractive error (astigmatism) in diopters. * @param axis The axis of the astigmatism in degrees. * @param cct The central corneal thickness in microns. * @param oz The optical zone diameter in millimeters. * @param ft The flap thickness in microns. * @param tza The transition zone ablation in microns. */ public Eye(double sphere, double cylinder, int axis, int cct, double oz, int ft, double tza) { this.sphere = sphere; this.cylinder = cylinder; this.axis = axis; this.centralCornealThickness = cct; this.opticalZone = oz; this.flapThickness = ft; this.transitionZoneAblation = tza; } /** * Executes all the calculation steps in the correct order. */ public void performCalculations() { calculateTotalDioptricCorrection(); calculateMunnerlynAblation(); calculateTotalAblation(); calculateResidualStromalBed(); calculateAblationRatio(); } /** * Calculates the total dioptric correction by summing sphere and cylinder. * Note: This is a simplification as seen in the spreadsheet. */ private void calculateTotalDioptricCorrection() { this.totalDioptricCorrection = Math.abs(this.sphere) + Math.abs(this.cylinder); } /** * Calculates the ablation depth for myopia using Munnerlyn's formula. * Formula: Ablation Depth (microns) = (Optical Zone^2 * Diopters) / 3 */ private void calculateMunnerlynAblation() { if (this.opticalZone > 0) { this.munnerlynAblation = (Math.pow(this.opticalZone, 2) * this.totalDioptricCorrection) / 3.0; } else { this.munnerlynAblation = 0; } } /** * Calculates the total ablation by adding the transition zone ablation to the Munnerlyn formula result. */ private void calculateTotalAblation() { this.totalAblation = this.munnerlynAblation + this.transitionZoneAblation; } /** * Calculates the Residual Stromal Bed (RSB). * RSB = CCT - Flap Thickness - Total Ablation */ private void calculateResidualStromalBed() { this.residualStromalBed = this.centralCornealThickness - this.flapThickness - this.totalAblation; } /** * Calculates the ablation ratio. * Ratio = Total Ablation / CCT */ private void calculateAblationRatio() { if (this.centralCornealThickness > 0) { this.ablationRatio = this.totalAblation / this.centralCornealThickness; } else { this.ablationRatio = 0; } } /** * Displays the results for the eye in a formatted string. * @param eyeName The name of the eye (e.g., "RIGHT EYE"). */ public void displayResults(String eyeName) { System.out.println("-------------------------------------------------"); System.out.printf(" RESULTS FOR %S\n", eyeName); System.out.println("-------------------------------------------------"); System.out.println("INPUTS:"); System.out.printf(" - Sphere (SPH): %.2f D\n", sphere); System.out.printf(" - Cylinder (CYL): %.2f D\n", cylinder); System.out.printf(" - Axis: %d°\n", axis); System.out.printf(" - Central Corneal Thickness (CCT): %d µm\n", centralCornealThickness); System.out.printf(" - Optical Zone (OZ): %.1f mm\n", opticalZone); System.out.printf(" - Flap Thickness: %d µm\n", flapThickness); System.out.println("\nCALCULATIONS:"); System.out.printf(" - Total Dioptric Correction: %.2f D\n", totalDioptricCorrection); System.out.printf(" - Munnerlyn's Formula Ablation: %.2f µm\n", munnerlynAblation); System.out.printf(" - Transition Zone Ablation: %.2f µm\n", transitionZoneAblation); System.out.println(" ------------------------------------"); System.out.printf(" - TOTAL ABLATION: %.2f µm\n", totalAblation); System.out.println(" ------------------------------------"); System.out.printf(" - Residual Stromal Bed (RSB): %.2f µm\n", residualStromalBed); System.out.printf(" - Ablation Ratio: %.4f\n", ablationRatio); System.out.println("-------------------------------------------------\n"); } } /** * Main class to run the LASIK ablation calculations. * It simulates the data from the provided CSV file. */ public class LasikCalculator { public static void main(String[] args) { System.out.println("=== LASIK ABLATION CALCULATOR (MYOPIA) ===\n"); // --- Data for RIGHT Eye from the CSV file --- Eye rightEye = new Eye( -6.0, // Sphere -2.0, // Cylinder 177, // Axis 543, // CCT 6.0, // Optical Zone 100, // Flap Thickness 8.0 // Transition Zone Ablation ); rightEye.performCalculations(); rightEye.displayResults("RIGHT EYE"); // --- Data for LEFT Eye from the CSV file --- Eye leftEye = new Eye( -5.5, // Sphere -1.5, // Cylinder 180, // Axis 547, // CCT 6.0, // Optical Zone 100, // Flap Thickness 8.0 // Transition Zone Ablation ); leftEye.performCalculations(); leftEye.displayResults("LEFT EYE"); } }
top of page

Subscribe Form

Thanks for submitting!

info @ 19 eye . net

+254 792 111 888 

LIONS SIGHTFIRST EYE HOSPITAL, Kaptagat Road, Loresho, Nairobi.

Copy Left :-)  @ 2021 by 19 EYE . NET   

bottom of page