|
@@ -14,8 +14,8 @@ import 'package:vid/us/vid_us_unit.dart';
|
|
|
|
|
|
import 'calculator.dart';
|
|
|
|
|
|
-class URMCal extends Calculator<URMRect, double> {
|
|
|
- URMCal(URMRect ref, this.type) : super(ref);
|
|
|
+class URMRectCal extends Calculator<URMRect, double> {
|
|
|
+ URMRectCal(URMRect ref, this.type) : super(ref);
|
|
|
String type = '';
|
|
|
@override
|
|
|
void calculate() {
|
|
@@ -28,262 +28,124 @@ class URMCal extends Calculator<URMRect, double> {
|
|
|
final URMApplication urmApplication = ref.application as URMApplication;
|
|
|
urmResultSize = Size(urmApplication.resultWidth.toDouble(),
|
|
|
urmApplication.resultHeight.toDouble());
|
|
|
- // urmResultWidth = urmApplication.resultWidth;
|
|
|
- // urmResultHeight = urmApplication.resultHeight;
|
|
|
- } catch (e) {
|
|
|
- logger.e('URM Measure error: $e');
|
|
|
- return;
|
|
|
- }
|
|
|
- final p1 = ref.feature!.startPoint;
|
|
|
- final p2 = ref.feature!.endPoint;
|
|
|
- //左上顶点
|
|
|
- final leftTopPercent =
|
|
|
- DPoint(p1.x < p2.x ? p1.x : p2.x, p1.y < p2.y ? p1.y : p2.y);
|
|
|
- //右下顶点
|
|
|
- final rightBottomPercent =
|
|
|
- DPoint(p1.x > p2.x ? p1.x : p2.x, p1.y > p2.y ? p1.y : p2.y);
|
|
|
- //画布尺寸
|
|
|
- final canavsSize = ref.application.displaySize;
|
|
|
-
|
|
|
- final startPoint = leftTopPercent.scale2Size(urmResultSize);
|
|
|
- final endPoint = rightBottomPercent.scale2Size(urmResultSize);
|
|
|
+ final p1 = ref.feature!.startPoint;
|
|
|
+ final p2 = ref.feature!.endPoint;
|
|
|
+ //左上顶点
|
|
|
+ final leftTopPercent =
|
|
|
+ DPoint(p1.x < p2.x ? p1.x : p2.x, p1.y < p2.y ? p1.y : p2.y);
|
|
|
+ //右下顶点
|
|
|
+ final rightBottomPercent =
|
|
|
+ DPoint(p1.x > p2.x ? p1.x : p2.x, p1.y > p2.y ? p1.y : p2.y);
|
|
|
+ //画布尺寸
|
|
|
+ final canavsSize = ref.application.displaySize;
|
|
|
|
|
|
- print("URM Measure canavsSize: $canavsSize");
|
|
|
- print("URM Measure type: $type");
|
|
|
+ final startPoint = leftTopPercent.scale2Size(urmResultSize);
|
|
|
+ final endPoint = rightBottomPercent.scale2Size(urmResultSize);
|
|
|
|
|
|
- String description = "URM\n Calculating...";
|
|
|
- updateStringValue(description);
|
|
|
+ print("URM Measure canavsSize: $canavsSize");
|
|
|
+ print("URM Measure type: $type");
|
|
|
|
|
|
- /// [URM] ✅在此处通知 Server 计算,获取 description
|
|
|
- switch (type) {
|
|
|
- case MeasureTypes.SRCurvature:
|
|
|
- getSRCurvatureResult(startPoint, endPoint);
|
|
|
- break;
|
|
|
- case MeasureTypes.SRRoiDensity:
|
|
|
- getSRRoiDensityResult(startPoint, endPoint);
|
|
|
- break;
|
|
|
- case MeasureTypes.SRRoiFractalDim:
|
|
|
- getSRRoiFractalDimResult(startPoint, endPoint);
|
|
|
- break;
|
|
|
- case MeasureTypes.SRTraceDensity:
|
|
|
- getSRTraceDensityResult([startPoint, endPoint]);
|
|
|
- // callServerMethodToGetResult();
|
|
|
- break;
|
|
|
- case MeasureTypes.SRTraceFD:
|
|
|
- getSRTraceFDResult([startPoint, endPoint]);
|
|
|
- // callServerMethodToGetResult();
|
|
|
- break;
|
|
|
- case MeasureTypes.SRLoactionVel:
|
|
|
- getSRLoactionVelResult(startPoint);
|
|
|
- // callServerMethodToGetResult();
|
|
|
- break;
|
|
|
- case MeasureTypes.SRRoiVel:
|
|
|
- getSRRoiVelResult(startPoint, endPoint);
|
|
|
- // callServerMethodToGetResult();
|
|
|
- break;
|
|
|
- case MeasureTypes.URMDensityMeasure:
|
|
|
- getURMDensityMeasureResult(startPoint, endPoint);
|
|
|
- // callServerMethodToGetResult();
|
|
|
- break;
|
|
|
- case MeasureTypes.URMVelMeasure:
|
|
|
- getURMVelMeasureResult(startPoint, endPoint);
|
|
|
- // callServerMethodToGetResult();
|
|
|
- break;
|
|
|
- default:
|
|
|
- }
|
|
|
- }
|
|
|
+ String description = "URM\n Calculating...";
|
|
|
+ updateStringValue(description);
|
|
|
|
|
|
- // URM 测量项 1
|
|
|
- void getSRCurvatureResult(DPoint startPoint, DPoint endPoint) async {
|
|
|
- bool success = false;
|
|
|
- String description = "URM\n Measuring";
|
|
|
- try {
|
|
|
- // TODO 换成真实接口
|
|
|
- // var result = await RPCBridge.ins.rpc.lab.getFileListByFolderAsync( );
|
|
|
+ /// [URM] ✅在此处通知 Server 计算,获取 description
|
|
|
+ switch (type) {
|
|
|
+ case MeasureTypes.SRRoiDensity:
|
|
|
+ getSRRoiDensityResult(urmApplication, startPoint, endPoint);
|
|
|
+ break;
|
|
|
+ case MeasureTypes.SRRoiFractalDim:
|
|
|
+ getSRRoiFractalDimResult(urmApplication, startPoint, endPoint);
|
|
|
+ break;
|
|
|
+ case MeasureTypes.SRRoiVel:
|
|
|
+ getSRRoiVelResult(urmApplication, startPoint, endPoint);
|
|
|
+ break;
|
|
|
+ case MeasureTypes.URMVelMeasure:
|
|
|
+ getURMVelMeasureResult(urmApplication, startPoint, endPoint);
|
|
|
+ break;
|
|
|
+ default:
|
|
|
+ }
|
|
|
} catch (e) {
|
|
|
- success = false;
|
|
|
- description = " ";
|
|
|
+ logger.e('URM Measure error: $e');
|
|
|
return;
|
|
|
}
|
|
|
- description = "${(12.34567).toStringAsFixed(2)}mm/s";
|
|
|
- updateStringValue(description);
|
|
|
- ref.application.updateRenderReady.emit(this, null);
|
|
|
}
|
|
|
|
|
|
// URM 测量项 2
|
|
|
- void getSRRoiDensityResult(DPoint startPoint, DPoint endPoint) async {
|
|
|
- bool success = false;
|
|
|
+ void getSRRoiDensityResult(
|
|
|
+ URMApplication app, DPoint startPoint, DPoint endPoint) async {
|
|
|
String description = "URM\n Measuring";
|
|
|
try {
|
|
|
- // TODO 换成真实接口
|
|
|
- // var result = await RPCBridge.ins.rpc.lab.getFileListByFolderAsync( );
|
|
|
+ GetSRRoiVelResult? result =
|
|
|
+ await app.getSRRoiVelResult(startPoint, endPoint);
|
|
|
+ if (result != null) {
|
|
|
+ print("URM Measure output: ${result.output} ");
|
|
|
+ description = "${(result.output).toStringAsFixed(2)}mm/s";
|
|
|
+ }
|
|
|
} catch (e) {
|
|
|
- success = false;
|
|
|
description = " ";
|
|
|
return;
|
|
|
}
|
|
|
- description = "${(12.34567).toStringAsFixed(2)}mm/s";
|
|
|
updateStringValue(description);
|
|
|
ref.application.updateRenderReady.emit(this, null);
|
|
|
}
|
|
|
|
|
|
// URM 测量项 3
|
|
|
- void getSRRoiFractalDimResult(DPoint startPoint, DPoint endPoint) async {
|
|
|
- bool success = false;
|
|
|
- String description = "URM\n Measuring";
|
|
|
- try {
|
|
|
- // TODO 换成真实接口
|
|
|
- // var result = await RPCBridge.ins.rpc.lab.getFileListByFolderAsync( );
|
|
|
- } catch (e) {
|
|
|
- success = false;
|
|
|
- description = " ";
|
|
|
- return;
|
|
|
- }
|
|
|
- description = "${(12.34567).toStringAsFixed(2)}mm/s";
|
|
|
- updateStringValue(description);
|
|
|
- ref.application.updateRenderReady.emit(this, null);
|
|
|
- }
|
|
|
-
|
|
|
- // URM 测量项 4
|
|
|
- void getSRTraceDensityResult(List<DPoint> points) async {
|
|
|
- bool success = false;
|
|
|
- String description = "URM\n Measuring";
|
|
|
- try {
|
|
|
- // TODO 换成真实接口
|
|
|
- // var result = await RPCBridge.ins.rpc.lab.getFileListByFolderAsync( );
|
|
|
- } catch (e) {
|
|
|
- success = false;
|
|
|
- description = " ";
|
|
|
- return;
|
|
|
- }
|
|
|
- description = "${(12.34567).toStringAsFixed(2)}mm/s";
|
|
|
- updateStringValue(description);
|
|
|
- ref.application.updateRenderReady.emit(this, null);
|
|
|
- }
|
|
|
-
|
|
|
- // URM 测量项 5
|
|
|
- void getSRTraceFDResult(List<DPoint> points) async {
|
|
|
- bool success = false;
|
|
|
- String description = "URM\n Measuring";
|
|
|
- try {
|
|
|
- // TODO 换成真实接口
|
|
|
- // var result = await RPCBridge.ins.rpc.lab.getFileListByFolderAsync( );
|
|
|
- } catch (e) {
|
|
|
- success = false;
|
|
|
- description = " ";
|
|
|
- return;
|
|
|
- }
|
|
|
- description = "${(12.34567).toStringAsFixed(2)}mm/s";
|
|
|
- updateStringValue(description);
|
|
|
- ref.application.updateRenderReady.emit(this, null);
|
|
|
- }
|
|
|
-
|
|
|
- // URM 测量项 6
|
|
|
- void getSRLoactionVelResult(
|
|
|
- DPoint point,
|
|
|
- ) async {
|
|
|
- bool success = false;
|
|
|
+ void getSRRoiFractalDimResult(
|
|
|
+ URMApplication app, DPoint startPoint, DPoint endPoint) async {
|
|
|
String description = "URM\n Measuring";
|
|
|
try {
|
|
|
- // TODO 换成真实接口
|
|
|
- // var result = await RPCBridge.ins.rpc.lab.getFileListByFolderAsync( );
|
|
|
+ GetSRRoiFractalDimResult? result =
|
|
|
+ await app.getSRRoiFractalDimResult(startPoint, endPoint);
|
|
|
+ if (result != null) {
|
|
|
+ print("URM Measure output: ${result.output} ");
|
|
|
+ description = "${(result.output).toStringAsFixed(2)}mm/s";
|
|
|
+ }
|
|
|
} catch (e) {
|
|
|
- success = false;
|
|
|
description = " ";
|
|
|
return;
|
|
|
}
|
|
|
- description = "${(12.34567).toStringAsFixed(2)}mm/s";
|
|
|
updateStringValue(description);
|
|
|
ref.application.updateRenderReady.emit(this, null);
|
|
|
}
|
|
|
|
|
|
// URM 测量项 7
|
|
|
- void getSRRoiVelResult(DPoint startPoint, DPoint endPoint) async {
|
|
|
- bool success = false;
|
|
|
- String description = "URM\n Measuring";
|
|
|
- try {
|
|
|
- // TODO 换成真实接口
|
|
|
- // var result = await RPCBridge.ins.rpc.lab.getFileListByFolderAsync( );
|
|
|
- } catch (e) {
|
|
|
- success = false;
|
|
|
- description = " ";
|
|
|
- return;
|
|
|
- }
|
|
|
- description = "${(12.34567).toStringAsFixed(2)}mm/s";
|
|
|
- updateStringValue(description);
|
|
|
- ref.application.updateRenderReady.emit(this, null);
|
|
|
- }
|
|
|
-
|
|
|
- // URM 测量项 8
|
|
|
- void getURMDensityMeasureResult(DPoint startPoint, DPoint endPoint) async {
|
|
|
- bool success = false;
|
|
|
+ void getSRRoiVelResult(
|
|
|
+ URMApplication app, DPoint startPoint, DPoint endPoint) async {
|
|
|
String description = "URM\n Measuring";
|
|
|
try {
|
|
|
- // TODO 换成真实接口
|
|
|
- // var result = await RPCBridge.ins.rpc.lab.getFileListByFolderAsync( );
|
|
|
+ GetSRRoiVelResult? result =
|
|
|
+ await app.getSRRoiVelResult(startPoint, endPoint);
|
|
|
+ if (result != null) {
|
|
|
+ print("URM Measure output: ${result.output} ");
|
|
|
+ description = "${(result.output).toStringAsFixed(2)}mm/s";
|
|
|
+ }
|
|
|
} catch (e) {
|
|
|
- success = false;
|
|
|
description = " ";
|
|
|
return;
|
|
|
}
|
|
|
- description = "${(12.34567).toStringAsFixed(2)}mm/s";
|
|
|
updateStringValue(description);
|
|
|
ref.application.updateRenderReady.emit(this, null);
|
|
|
}
|
|
|
|
|
|
// URM 测量项 9
|
|
|
- void getURMVelMeasureResult(DPoint startPoint, DPoint endPoint) async {
|
|
|
- bool success = false;
|
|
|
+ void getURMVelMeasureResult(
|
|
|
+ URMApplication app, DPoint startPoint, DPoint endPoint) async {
|
|
|
String description = "URM\n Measuring";
|
|
|
try {
|
|
|
- // TODO 换成真实接口
|
|
|
- // var result = await RPCBridge.ins.rpc.lab.getFileListByFolderAsync( );
|
|
|
+ GetURMVelMeasureResult? result =
|
|
|
+ await app.getURMVelMeasureResult(startPoint, endPoint);
|
|
|
+ if (result != null) {
|
|
|
+ // TODO 全部内容展示
|
|
|
+ print("URM Measure inMaxVel: ${result.inMaxVel} ");
|
|
|
+ description = "${(result.inMaxVel).toStringAsFixed(2)}mm/s";
|
|
|
+ }
|
|
|
} catch (e) {
|
|
|
- success = false;
|
|
|
description = " ";
|
|
|
return;
|
|
|
}
|
|
|
- description = "${(12.34567).toStringAsFixed(2)}mm/s";
|
|
|
updateStringValue(description);
|
|
|
ref.application.updateRenderReady.emit(this, null);
|
|
|
}
|
|
|
-
|
|
|
- void callServerMethodToGetResult() async {
|
|
|
- bool success = false;
|
|
|
- String description = "URM\n Measuring";
|
|
|
- try {
|
|
|
- // TODO 换成真实接口
|
|
|
- var result = await RPCBridge.ins.rpc.lab.getFileListByFolderAsync(
|
|
|
- GetFileListByFolderRequest(
|
|
|
- token: RPCBridge.ins.userToken,
|
|
|
- pageIndex: 1,
|
|
|
- pageSize: 100,
|
|
|
- // folderCode: patientCode,
|
|
|
- ),
|
|
|
- );
|
|
|
- } catch (e) {
|
|
|
- success = false;
|
|
|
- description = "\n Max: ${(100.2345).toStringAsFixed(2)}mm\n";
|
|
|
- updateStringValue(description);
|
|
|
- ref.application.updateRenderReady.emit(this, null);
|
|
|
- return;
|
|
|
- }
|
|
|
-
|
|
|
- if (success) {
|
|
|
- final feature = ref.feature!;
|
|
|
- // 如果返回点集添加点集
|
|
|
- // 返回值点集计算转为图像可绘制的点集
|
|
|
- feature.offsetsList.add([Offset(1, 1)]);
|
|
|
-
|
|
|
- /// 如果返回数值,直接添加数值
|
|
|
- description = "\n URM Measure Result: 88 mm";
|
|
|
- updateStringValue(description);
|
|
|
- } else {
|
|
|
- description = "\n Measure failed";
|
|
|
- updateStringValue(description);
|
|
|
- ref.application.updateRenderReady.emit(this, null);
|
|
|
- }
|
|
|
- }
|
|
|
}
|
|
|
|
|
|
class URMLocationCal extends Calculator<Location, double> {
|