@@ -133,15 +133,11 @@ public AverageThickness.Result[] analyzeRegions(ImageProcessor image, int[] labe
133133 }
134134 }
135135
136- // convert to array of results
136+ // convert to array of (calibrated) results
137137 AverageThickness .Result [] results = new AverageThickness .Result [nLabels ];
138138 for (int i = 0 ; i < nLabels ; i ++)
139139 {
140- Result res = new Result ();
141- res .meanDist = calib .pixelWidth * (sums [i ] / counts [i ]);
142- res .avgThickness = res .meanDist * 2 - 1 ;
143- res .unit = calib .getUnit ();
144- results [i ] = res ;
140+ results [i ] = new Result (sums [i ] / counts [i ], calib );
145141 }
146142 return results ;
147143 }
@@ -160,20 +156,33 @@ public AverageThickness.Result[] analyzeRegions(ImageProcessor image, int[] labe
160156 public class Result
161157 {
162158 /**
163- * Average distance computed along the skeleton
159+ * Average distance computed along the skeleton, in pixels.
164160 */
165- public double meanDist ;
161+ public final double meanDist_Pixels ;
162+
163+ /**
164+ * Average distance computed along the skeleton, converted in user units.
165+ */
166+ public final double meanDist ;
166167
167168 /**
168169 * Average thickness value computed from the average distance.
169170 * Typically: avgThickness = avgDist * 2 - 1.
170171 */
171- public double avgThickness ;
172+ public final double avgThickness ;
172173
173174 /**
174175 * The unit associated to the measure.
175176 */
176- public String unit = "pixel" ;
177+ public final String unit ;
178+
179+ public Result (double meanDistInPixels , Calibration calib )
180+ {
181+ this .meanDist_Pixels = meanDistInPixels ;
182+ this .meanDist = calib .pixelWidth * this .meanDist_Pixels ;
183+ this .avgThickness = calib .pixelWidth * (this .meanDist_Pixels * 2 - 1 );
184+ this .unit = calib .getUnit ();
185+ }
177186 }
178187
179188}
0 commit comments