| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465 |
- package com.imt.intimamedia.helpers
- {
- import cmodule.c1.CLibInit;
-
- import com.imt.intimamedia.vo.ImtResultVo;
-
- import flash.display.Sprite;
- import flash.geom.Point;
- import flash.utils.ByteArray;
- import mx.controls.Alert;
-
- public class AlchemyCaller extends Sprite
- {
- protected static const loader : cmodule.c1.CLibInit = new cmodule.c1.CLibInit();
- protected static const lib : * = loader.init();
-
- public function AlchemyCaller()
- {
- }
- public static function imtCalculate( scale : Number, width : int, height : int, startX : int, startY : int, endX : int, endY : int, data : ByteArray, colors : int = 24 ) : ImtResultVo
- {
- var point : Point;
- var diameter: int;
- diameter = 0;
- // Comment by C. Jacquelin : Appel 2 fois sinon le 1er clic la mesure se fait pas : provisoire
-
- // line below commented by J.Deppe : useless and with it imt calculation fail sometimes
- //lib.AlchemyinitializeFromRaw( startX, startY, endX, endY, width, height, colors, 0, scale, scale, data );
- var result : Array = lib.AlchemyinitializeFromRaw( diameter, startX, startY, endX, endY, width, height, colors, 0, scale, scale, data );
-
- var imtResultVo : ImtResultVo = new ImtResultVo();
-
- imtResultVo.max = result[0][0];
- imtResultVo.mean = result[0][1];
- imtResultVo.standardDeviation = result[0][2];
- imtResultVo.qualityIndex = result[0][3];
- imtResultVo.distance = result[0][4];
- imtResultVo.numberOfPoints = result[0][5];
-
- for ( var i : int = 0; i < imtResultVo.numberOfPoints; i++ )
- {
- point = new Point();
- point.x = result[i+1][0];
- point.y = result[i+1][1];
-
- imtResultVo.intima.push( point );
-
- point = new Point();
- point.x = result[i+1][2];
- point.y = result[i+1][3];
-
- imtResultVo.adventitia.push( point );
- }
-
- return imtResultVo;
- }
-
- public static function initAlchemy( scale : Number, width : int, height : int, startX : int, startY : int, endX : int, endY : int, data : ByteArray, colors : int = 24 ) : void
- {
- lib.AlchemyinitializeFromRaw( startX, startY, endX, endY, width, height, colors, 0, scale, scale, data );
- var result : Array = lib.AlchemyinitializeFromRaw( startX, startY, endX, endY, width, height, colors, 0, scale, scale, data );
- }
- }
- }
|