View Javadoc

1   package de.desy.acop.video.analysis;
2   
3   import de.desy.acop.video.Definitions;
4   import de.desy.tine.structUtils.TTaggedStructure;
5   import de.desy.tine.types.IMAGE;
6   
7   /**
8    * 
9    * <code>AImage</code> is the object that is transferred across the
10   * system from the video analysis server to the video client.
11   * This object carries with it the raw tine IMAGE and analysis results
12   * and parameters. For details on parameters see the constructor
13   * documentation.
14   *
15   * @author <a href="mailto:jaka.bobnar@cosylab.com">Jaka Bobnar</a>
16   *
17   */
18  public class AImage extends TTaggedStructure {
19  
20  	private final IMAGE[] image = new IMAGE[1];
21  	private final int[] imageW = new int[1];
22  	private final int[] imageH = new int[1];
23  	private final int[] roiX = new int[1];
24  	private final int[] roiY = new int[1];
25  	private final int[] roiW = new int[1];
26  	private final int[] roiH = new int[1];
27  	private final int[] roi2X = new int[1];
28  	private final int[] roi2Y = new int[1];
29  	private final int[] roi2W = new int[1];
30  	private final int[] roi2H = new int[1];
31  	private final int[] thresholdPoints = new int[1];
32  	private final double[] threshold = new double[1];
33  	private final double[] sideViewX = new double[Definitions.MAX_WIDTH];
34  	private final double[] sideViewY = new double[Definitions.MAX_HEIGHT];
35  	private final double[] sideViewAmplitudeX = new double[1];
36  	private final double[] sideViewAmplitudeY = new double[1];
37  	private final double[] sideViewConstX = new double[1];
38  	private final double[] sideViewConstY = new double[1];
39  	private final double[] stdX = new double[1];
40  	private final double[] stdY = new double[1];
41  	private final double[] meanX = new double[1];
42  	private final double[] meanY = new double[1];
43  	private final double[] stdA = new double[1];
44  	private final double[] stdB = new double[1];
45  	private final double[] amplitude2D = new double[1];
46  	private final double[] angle2D = new double[1];
47  	private final double[] const2D = new double[1];
48  	private final double[] meanXFit = new double[1];
49  	private final double[] stdXFit = new double[1];
50  	private final double[] amplitudeXFit = new double[1];
51  	private final double[] constXFit = new double[1];
52  	private final double[] slopeXFit = new double[1];
53  	private final double[] meanYFit = new double[1];
54  	private final double[] stdYFit = new double[1];
55  	private final double[] amplitudeYFit = new double[1];
56  	private final double[] constYFit = new double[1];
57  	private final double[] slopeYFit = new double[1];
58  	private final byte[] calculateThreshold = new byte[1];
59  	private final byte[] performFit = new byte[1];
60  	private final byte[] performSmoothing = new byte[1];
61  	
62  	private final int width;
63  	private final int height;
64  	/**
65  	 * Constructs a new AImage, with default values (empty image and 0 value parameters
66  	 * and results).
67  	 */
68  	public AImage() {
69  		super("AISr4");
70  		image[0] = new IMAGE();
71  //		sideViewX = new double[0];
72  //		sideViewY = new double[0];
73  		width = 0;
74  		height = 0;
75  		initStructure();
76  	}
77  	
78  	/**
79  	 * Constructs a new AImage from the given AImage. This method creates a clone
80  	 * of the given image.
81  	 * 
82  	 * @param image the image
83  	 */
84  	public AImage(AImage image) {
85  		this(image.getImage(),image.getRoiX(),image.getRoiY(),image.getRoiW(),image.getRoiH(),
86  				image.getRoi2X(), image.getRoi2Y(), image.getRoi2W(), image.getRoi2H(), image.getThreshold(),
87  				image.getSideViewX(), image.getMeanX(), image.getStdX(), image.getSideViewAmplitudeX(),image.getSideViewConstX(),
88  				image.getMeanXFit(), image.getStdXFit(), image.getAmplitudeXFit(), image.getConstXFit(), image.getSlopeXFit(),
89  				image.getSideViewY(), image.getMeanY(), image.getStdY(), image.getSideViewAmplitudeY(), image.getSideViewConstY(),
90  				image.getMeanYFit(), image.getStdYFit(), image.getAmplitudeYFit(), image.getConstYFit(), image.getSlopeYFit(),
91  				image.getStdA(), image.getStdB(), image.getAngle2D(), image.getAmplitude2D(), image.getConst2D(),
92  				image.getThresholdPoints(),image.isCalculateThreshold(),image.isPerformFit(),image.isPerformSmoothing());
93  	}
94  	
95  	/**
96  	 * Constructs a new AImage.
97  	 *  
98  	 * @param image the raw image, which was analyzed and all data was obtained from
99  	 * @param roiX the region of interest right coordinate (image is analyzed inside region of interest)
100 	 * @param roiY the region of interest upper coordinate (image is analyzed inside region of interest)
101 	 * @param roiW the width of region of interest (image is analyzed inside region of interest)
102 	 * @param roiH the height of region of interest (image is analyzed inside region of interest)
103 	 * @param roi2X the region of interest used for automatic threshold calculation right coordinate
104 	 * @param roi2Y the region of interest used for automatic threshold calculation upper coordinate
105 	 * @param roi2W the region of interest used for automatic threshold calculation width
106 	 * @param roi2H the region of interest used for automatic threshold calculation height
107 	 * @param threshold the used threshold value (calculated or user defined)
108 	 * @param sideViewX horizontal side view values
109 	 * @param meanX horizontal statistical mean value 
110 	 * @param stdX horizontal statistical standard deviation value
111 	 * @param sideAmplitudeX horizontal statistical amplitude value 
112 	 * @param sideConstX horizontal statistical constant value
113 	 * @param meanXFit horizontal fitted mean value
114 	 * @param stdXFit horizontal fitted standard deviation value 
115 	 * @param sideAmplitudeXFit horizontal fitted amplitude value
116 	 * @param sideConstXFit horizontal fitted constant value
117 	 * @param slopeXFit the slope of the linear function in the fit
118 	 * @param sideViewY vertical side view values
119 	 * @param meanY vertical statistical mean value 
120 	 * @param stdY vertical statistical standard deviation value
121 	 * @param sideAmplitudeY vertical statistical amplitude value 
122 	 * @param sideConstY vertical statistical constant value
123 	 * @param meanYFit vertical fitted mean value
124 	 * @param stdYFit vertical fitted standard deviation value 
125 	 * @param sideAmplitudeYFit vertical fitted amplitude value
126 	 * @param sideConstYFit vertical fitted constant value
127 	 * @param slopeYFit the slope of the linear function in the fit
128 	 * @param stdA main 2D axis statistical standard deviation
129 	 * @param stdB secondary 2D axis statistical standard deviation
130 	 * @param angle2D the statistical rotation angle of the main axis according to x-y coordinate system
131 	 * @param amplitude2D the statistical 2D amplitude  
132 	 * @param const2D the statistical 2D constant (minimum value)
133 	 * @param thresholdPoints the number of points on which the threshold was calculated
134 	 * @param calculateThreshold flag indicating if threshold calculation is automatic
135 	 * @param performFit flag indicating if fitting was performed (if false the 'fit' parameters
136 	 * 			are a-priori invalid)
137 	 * @param performSmoothing flag indicating if smoothing should be performed
138 	 */
139 	public AImage(IMAGE image, int roiX, int roiY, int roiW, int roiH, int roi2X, int roi2Y,
140 			int roi2W, int roi2H, double threshold,
141 			double[] sideViewX, double meanX, double stdX, double sideAmplitudeX, double sideConstX,
142 			double meanXFit, double stdXFit, double sideAmplitudeXFit, double sideConstXFit, double slopeXFit,
143 			double[] sideViewY, double meanY, double stdY, double sideAmplitudeY, double sideConstY,
144 			double meanYFit, double stdYFit, double sideAmplitudeYFit, double sideConstYFit, double slopeYFit,
145 			double stdA, double stdB, double angle2D, double amplitude2D, double const2D, 
146 			int thresholdPoints, boolean calculateThreshold, boolean performFit, boolean performSmoothing) {
147 		super("AISr4");
148 		
149 		int width = image.getFrameHeader().sourceWidth;
150 		int height = image.getFrameHeader().sourceHeight;
151 		int aoiWidth = image.getFrameHeader().aoiWidth;
152 		int aoiHeight = image.getFrameHeader().aoiHeight;
153 		
154 		if (aoiWidth != -1 || aoiHeight != -1) {
155 			if (sideViewX.length != aoiWidth) throw new IllegalArgumentException("Incompatible size of X side view array.");
156 			if (sideViewY.length != aoiHeight) throw new IllegalArgumentException("Incompatible size of Y side view array.");
157 			if (roiX < 0 || roiY < 0 || roiW < 0 || roiH < 0 || roiX+roiW > aoiWidth || roiY+roiH > aoiHeight) throw new IllegalArgumentException("Illegal region of interest specified.");
158 			if (roi2X < 0 || roi2Y < 0 || roi2W < 0 || roi2H < 0 || roi2X+roi2W > aoiWidth || roi2Y+roiH > aoiHeight) throw new IllegalArgumentException("Illegal region of interest 2 specified.");
159 			this.width = aoiWidth;
160 			this.height = aoiHeight;
161 		}
162 		else {
163 			if (sideViewX.length != width) throw new IllegalArgumentException("Incompatible size of X side view array.");
164 			if (sideViewY.length != height) throw new IllegalArgumentException("Incompatible size of Y side view array.");
165 			if (roiX < 0 || roiY < 0 || roiW < 0 || roiH < 0 || roiX+roiW > width || roiY+roiH > height) throw new IllegalArgumentException("Illegal region of interest specified.");
166 			if (roi2X < 0 || roi2Y < 0 || roi2W < 0 || roi2H < 0 || roi2X+roi2W > width || roi2Y+roi2H > height) throw new IllegalArgumentException("Illegal region of interest 2 specified.");
167 			this.width = width;
168 			this.height = height;
169 		}
170 		
171 //		this.sideViewX = new double[sideViewX.length];
172 //		this.sideViewY = new double[sideViewY.length];
173 		for (int i = 0; i < sideViewX.length; i++) {
174 			this.sideViewX[i] = sideViewX[i];
175 		}
176 		this.stdX[0] = stdX;
177 		this.meanX[0] = meanX;
178 		this.sideViewAmplitudeX[0] = sideAmplitudeX;
179 		this.sideViewConstX[0] = sideConstX;
180 		
181 		for (int i = 0; i < sideViewY.length; i++) {
182 			this.sideViewY[i] = sideViewY[i];
183 		}
184 		this.stdY[0] = stdY;
185 		this.meanY[0] = meanY;
186 		this.sideViewAmplitudeY[0] = sideAmplitudeY;
187 		this.sideViewConstY[0] = sideConstY;
188 		this.stdA[0] = stdA;
189 		this.stdB[0] = stdB;
190 		this.amplitude2D[0] = amplitude2D;
191 		this.angle2D[0] = angle2D;
192 		this.const2D[0] = const2D;
193 		this.roiX[0] = roiX;
194 		this.roiY[0] = roiY;
195 		this.roiW[0] = roiW;
196 		this.roiH[0] = roiH;
197 		this.roi2X[0] = roi2X;
198 		this.roi2Y[0] = roi2Y;
199 		this.roi2W[0] = roi2W;
200 		this.roi2H[0] = roi2H;
201 		this.imageW[0] = width;
202 		this.imageH[0] = height;
203 		this.threshold[0] = threshold;
204 		this.meanXFit[0] = meanXFit;
205 		this.stdXFit[0] = stdXFit;
206 		this.amplitudeXFit[0] = sideAmplitudeXFit;
207 		this.constXFit[0] = sideConstXFit;
208 		this.slopeXFit[0] = slopeXFit;
209 		this.meanYFit[0] = meanYFit;
210 		this.stdYFit[0] = stdYFit;
211 		this.amplitudeYFit[0] = sideAmplitudeYFit;
212 		this.constYFit[0] = sideConstYFit;
213 		this.slopeYFit[0] = slopeYFit;
214 		this.thresholdPoints[0] = thresholdPoints;
215 		this.calculateThreshold[0] = calculateThreshold ? (byte)1 : (byte)0;
216 		this.performFit[0] = performFit ? (byte)1 : (byte)0;
217 		this.performSmoothing[0] = performSmoothing ? (byte)1 : (byte)0;
218 		//assign directly, but make sure you pass in a clean copy
219 		this.image[0] = image;
220 //		loadImage(this.image, image);
221 		
222 		initStructure();
223 		initDone();
224 	}
225 	
226 	private void initStructure() {
227 		addField(image,"image");
228 		addField(imageW,"imageW");
229 	    addField(imageH,"imageH");
230 		addField(roiX,"roiX");
231 		addField(roiY,"roiY");
232 		addField(roiW,"roiW");
233 	    addField(roiH,"roiH");
234 	    addField(roi2X,"roi2X");
235 		addField(roi2Y,"roi2Y");
236 		addField(roi2W,"roi2W");
237 	    addField(roi2H,"roi2H");
238 	    addField(threshold,"threshold");
239 	    addField(sideViewX, "sideViewX");
240 	    addField(sideViewY, "sideViewY");
241 	    addField(sideViewAmplitudeX,"sideViewAmplitudeX");
242 	    addField(sideViewAmplitudeY,"sideViewAmplitudeY");
243 	    addField(sideViewConstX, "sideViewConstX");
244 	    addField(sideViewConstY, "sideViewConstY");
245 	    addField(stdX,"stdX");    	  
246 	    addField(stdY,"stdY");
247 	    addField(meanX,"meanX");
248 	    addField(meanY,"meanY");
249 	    addField(stdA,"stdA");
250 	    addField(stdB,"stdB");
251 	    addField(amplitude2D,"amplitude2D");
252 	    addField(angle2D,"angle2D");
253 	    addField(const2D, "const2D");
254 	    addField(meanXFit, "meanXFit");
255 	    addField(stdXFit, "stdXFit");
256 	    addField(amplitudeXFit, "amplitudeXFit");
257 	    addField(constXFit, "constXFit");
258 	    addField(slopeXFit, "slopeXFit");
259 	    addField(meanYFit, "meanYFit");
260 	    addField(stdYFit, "stdYFit");
261 	    addField(amplitudeYFit, "amplitudeYFit");
262 	    addField(constYFit, "constYFit");
263 	    addField(slopeYFit, "slopeYFit");
264 	    addField(thresholdPoints, "thresholdPoints");
265 	    addField(performFit, "performFit");
266 	    addField(performSmoothing, "performSmoothing");
267 	    addField(calculateThreshold, "calculateThreshold");
268 	    
269 	}
270 	
271 	/**
272 	 * Returns the image which was analyzed.
273 	 * 
274 	 * @return the original image
275 	 */
276 	public IMAGE getImage() {
277 		return image[0];
278 	}
279 	
280 	/**
281 	 * The width of the image.
282 	 * 
283 	 * @return the width
284 	 * 
285 	 * @see {@link #getImage()}
286 	 */
287 	public int getImageW() {
288 		return imageW[0];
289 	}
290 
291 	/** 
292 	 * The height of the image.
293 	 * 
294 	 * @return the height
295 	 * 
296 	 * @see {@link #getImage()}
297 	 */
298 	public int getImageH() {
299 		return imageH[0];
300 	}
301 	
302 	/**
303 	 * Left coordinate of the region of interest.
304 	 * 
305 	 * @return the left coordinate
306 	 */
307 	public int getRoiX() {
308 		return roiX[0];
309 	}
310 
311 	/**
312 	 * Upper coordinate of the region of interest.
313 	 * 
314 	 * @return the upper coordinate
315 	 */
316 	public int getRoiY() {
317 		return roiY[0];
318 	}
319 
320 	/**
321 	 * The width of the region of interest.
322 	 * 
323 	 * @return the width
324 	 */
325 	public int getRoiW() {
326 		return roiW[0];
327 	}
328 
329 	/**
330 	 * The height of the region of interest.
331 	 * 
332 	 * @return the height
333 	 */
334 	public int getRoiH() {
335 		return roiH[0];
336 	}
337 	
338 	/**
339 	 * Left coordinate of the second region of interest.
340 	 * 
341 	 * @return the left coordinate
342 	 */
343 	public int getRoi2X() {
344 		return roi2X[0];
345 	}
346 
347 	/**
348 	 * Upper coordinate of the second region of interest.
349 	 * 
350 	 * @return the upper coordinate
351 	 */
352 	public int getRoi2Y() {
353 		return roi2Y[0];
354 	}
355 
356 	/**
357 	 * The width of the second region of interest.
358 	 * 
359 	 * @return the width
360 	 */
361 	public int getRoi2W() {
362 		return roi2W[0];
363 	}
364 
365 	/**
366 	 * The height of the second region of interest.
367 	 * 
368 	 * @return the height
369 	 */
370 	public int getRoi2H() {
371 		return roi2H[0];
372 	}
373 	
374 	/**
375 	 * The threshold value used for analysis of the image.
376 	 * 
377 	 * @return the threshold value
378 	 */
379 	public double getThreshold() {
380 		return threshold[0];
381 	}
382 
383 	/**
384 	 * Returns the standard deviation of the 2-dimensional intensity image in the
385 	 * direction of the "a" axis of the profile (assuming an elliptical profile).
386 	 * 
387 	 * @return the standard deviation in a direction
388 	 * 
389 	 * @see {@link #getImage()}
390 	 */
391 	public double getStdA() {
392 		return stdA[0];
393 	}
394 
395 	/**
396 	 * Returns the standard deviation of the 2-dimensional intensity image in the
397 	 * direction of the "b" axis of the profile (assuming an elliptical profile).
398 	 *  
399 	 * @return the standard deviation in b direction
400 	 * 
401 	 * @see {@link #getImage()}
402 	 */
403 	public double getStdB() {
404 		return stdB[0];
405 	}
406 	
407 	/**
408 	 * Returns the maximum amplitude of pixel value (as returned by </code>ColorDecoder</code> 
409 	 * assigned to this </code>AnalyzedImage</code>) across the entire image.
410 	 * Maximum pixel value is amplitude2D plus const2D.
411 	 * 
412 	 * @return the amplitude
413 	 * 
414 	 * @see {@link #getImage()}
415 	 */
416 	public double getAmplitude2D() {
417 		return amplitude2D[0];
418 	}
419 
420 	/**
421 	 * Returns the angle of rotation of the 2-dimensional intensity profile around
422 	 * its center (the angle between x and a and y and b axes).
423 	 * 
424 	 * @return the angle of rotation of the 2-dimensional intensity profile
425 	 * 
426 	 * @see {@link #getImage()}
427 	 */
428 	public double getAngle2D() {
429 		return angle2D[0];
430 	}
431 	
432 	/**
433 	 * Returns the minimum pixel value (as returned by <code>ColorDecoder</code> 
434 	 * assigned to this <code>AnalyzedImage</code>) across the entire image. This
435 	 * value indicates the background level of the image.
436 	 * 
437 	 * @return the constant value of the intensity profile
438 	 * 
439 	 * @see {@link #getImage()}
440 	 */
441 	public double getConst2D() {
442 		return const2D[0];
443 	}
444 
445 	/**
446 	 * Returns the array representing the side projection of the intensity image
447 	 * on the X axis.
448 	 * 
449 	 * @return the projection on the x axis
450 	 * 
451 	 * @see {@link #getImage()}
452 	 */
453 	public double[] getSideViewX() {
454 		double[] result = new double[width];
455 		System.arraycopy(sideViewX, 0, result, 0, result.length);
456 		return result;
457 	}
458 
459 	/**
460 	 * Returns the array representing the side projection of the intensity image
461 	 * on the Y axis.
462 	 * 
463 	 * @return the projection on the y axis
464 	 * 
465 	 * @see {@link #getImage()}
466 	 */
467 	public double[] getSideViewY() {
468 		double[] result = new double[height];
469 		System.arraycopy(sideViewY, 0, result, 0, result.length);
470 		return result;
471 	}
472 
473 	/**
474 	 * Returns the standard deviation of the side view projection
475 	 * of the image on the x axis. This is calculated from the values
476 	 * returned by the {@link #getSideViewX()}.
477 	 * 
478 	 * @return the standard deviation
479 	 */
480 	public double getStdX() {
481 		return stdX[0];
482 	}
483 
484 	/**
485 	 * Returns the standard deviation of the side view projection
486 	 * of the image on the y axis. This is calculated from the values
487 	 * returned by the {@link #getSideViewY()}.
488 	 * 
489 	 * @return the standard deviation
490 	 */
491 	public double getStdY() {
492 		return stdY[0];
493 	}
494 
495 	/**
496 	 * Returns the mean value of the side view projection of the
497 	 * image on the x axis. This is calculated from the values
498 	 * returned by the {@link #getSideViewX()}.
499 	 * 
500 	 * @return the mean value
501 	 */
502 	public double getMeanX() {
503 		return meanX[0];
504 	}
505 
506 	/**
507 	 * Returns the mean value of the side view projection of the
508 	 * image on the y axis. This is calculated from the values
509 	 * returned by the {@link #getSideViewY()}.
510 	 * 
511 	 * @return the mean value
512 	 */
513 	public double getMeanY() {
514 		return meanY[0];
515 	}
516 
517 	/**
518 	 * Returns the amplitude (maximum minus minimum) value of the side view 
519 	 * projection of the image on the x axis. This is calculated from the values
520 	 * returned by the {@link #getSideViewX()}.
521 	 * 
522 	 * @return the amplitude
523 	 */
524 	public double getSideViewAmplitudeX() {
525 		return sideViewAmplitudeX[0];
526 	}
527 
528 	/**
529 	 * Returns the amplitude (maximum minus minimum) value of the side view 
530 	 * projection of the image on the y axis. This is calculated from the values
531 	 * returned by the {@link #getSideViewY()}.
532 	 * 
533 	 * @return the amplitude
534 	 */
535 	public double getSideViewAmplitudeY() {
536 		return sideViewAmplitudeY[0];
537 	}
538 	
539 	/**
540 	 * Returns the constant (minimum) value of the side view projection of
541 	 * the image on the x axis. This is calculated from the values
542 	 * returned by the {@link #getSideViewX()}.
543 	 * 
544 	 * @return the constant
545 	 */
546 	public double getSideViewConstX() {
547 		return sideViewConstX[0];
548 	}
549 	
550 	/**
551 	 * Returns the constant (minimum) value of the side view projection of
552 	 * the image on the y axis. This is calculated from the values
553 	 * returned by the {@link #getSideViewY()}.
554 	 * 
555 	 * @return the constant
556 	 */
557 	public double getSideViewConstY() {
558 		return sideViewConstY[0];
559 	}
560 	
561 	/**
562 	 * Returns true if the calculation of threshold was automatic or false if
563 	 * threshold was user defined.
564 	 * 
565 	 * @return true if calculation of threshold is automatic
566 	 */
567 	public boolean isCalculateThreshold() {
568 		return calculateThreshold[0] == 1;
569 	}
570 	
571 	/**
572 	 * Returns true if the fitting algorithm was used during analysis.
573 	 * 
574 	 * @return true if fitting was performed
575 	 */
576 	public boolean isPerformFit() {
577 		return performFit[0] == 1;
578 	}
579 	
580 	/**
581 	 * Returns true if the smoothing algorithm was used during analysis.
582 	 * 
583 	 * @return true if fitting was performed
584 	 */
585 	public boolean isPerformSmoothing() {
586 		return performSmoothing[0] == 1;
587 	}
588 	
589 	/**
590 	 * Returns the fitted amplitude in x axis.
591 	 *  
592 	 * @return
593 	 */
594 	public double getAmplitudeXFit() {
595 		return amplitudeXFit[0];
596 	}
597 	
598 	/**
599 	 * Returns the fitted constant in x axis.
600 	 * 
601 	 * @return
602 	 */
603 	public double getConstXFit() {
604 		return constXFit[0];
605 	}
606 	
607 	/**
608 	 * Returns the fitted mean value in x axis.
609 	 *  
610 	 * @return
611 	 */
612 	public double getMeanXFit() {
613 		return meanXFit[0];
614 	}
615 	
616 	/**
617 	 * Returns the fitted std value in x axis.
618 	 * 
619 	 * @return
620 	 */
621 	public double getStdXFit() {
622 		return stdXFit[0];
623 	}
624 	
625 	/**
626 	 * Returns the fitted amplitude in y axis.
627 	 *  
628 	 * @return
629 	 */
630 	public double getAmplitudeYFit() {
631 		return amplitudeYFit[0];
632 	}
633 	
634 	/**
635 	 * Returns the slope of the linear function in the fit.
636 	 * 
637 	 * @return the slope
638 	 */
639 	public double getSlopeXFit() {
640 		return slopeXFit[0];
641 	}
642 	
643 	/**
644 	 * Returns the fitted constant in y axis.
645 	 * 
646 	 * @return
647 	 */
648 	public double getConstYFit() {
649 		return constYFit[0];
650 	}
651 	
652 	/**
653 	 * Returns the fitted mean value in y axis.
654 	 *  
655 	 * @return
656 	 */
657 	public double getMeanYFit() {
658 		return meanYFit[0];
659 	}
660 	
661 	/**
662 	 * Returns the fitted std value in y axis.
663 	 * 
664 	 * @return
665 	 */
666 	public double getStdYFit() {
667 		return stdYFit[0];
668 	}
669 	
670 	/**
671 	 * Returns the slope of the linear function in the fit.
672 	 * 
673 	 * @return
674 	 */
675 	public double getSlopeYFit() {
676 		return slopeYFit[0];
677 	}
678 	
679 	/**
680 	 * Returns the number of points on which the threshold was calculated.
681 	 * 
682 	 * @return the number of points threshold was calculated on
683 	 */
684 	public int getThresholdPoints() {
685 		return thresholdPoints[0];
686 	}
687 	
688 //	private void loadImage(IMAGE destination, IMAGE input) {
689 //		int headerSize = TFormat.getFormatHeaderSize(TFormat.CF_IMAGE);
690 //		
691 //		byte[] byteArray = new byte[headerSize+Definitions.MAX_SIZE];
692 //		byte[] allData = input.toByteArray();
693 //		
694 //		// TODO workaround for some unusually long allData arrays...
695 //		int length = (allData.length > byteArray.length) ? byteArray.length : allData.length;
696 //		System.arraycopy(allData, 0, byteArray, 0, length);
697 //		
698 //		destination.setByteArray(byteArray);
699 //		destination.toStruct();
700 //		
701 //	}
702 //	
703 //	private IMAGE extractImage(IMAGE source) {
704 //		byte[] allData = source.toByteArray();
705 //		int headerSize = TFormat.getFormatHeaderSize(TFormat.CF_IMAGE);
706 //		byte[] headerArray = new byte[headerSize];
707 //		
708 //		System.arraycopy(allData, 0, headerArray, 0, headerSize);
709 //		
710 //		IMAGE result = new IMAGE();
711 //		result.setByteArray(headerArray);
712 //		result.toStruct();
713 //		
714 //		// TODO workaround for some unusually long allData arrays...
715 //		int length = (result.getFrameHeader().appendedFrameSize < Definitions.MAX_SIZE) ? result.getFrameHeader().appendedFrameSize : Definitions.MAX_SIZE;
716 //		byte[] imageBuffer = new byte[length];
717 //		System.arraycopy(allData, headerSize, imageBuffer, 0, length);
718 //		
719 //		result.setImageFrameBuffer(imageBuffer);
720 //		
721 //		return result;
722 //	}
723 }