|
@@ -6,6 +6,8 @@ import 'package:fis_i18n/i18n.dart';
|
|
|
import 'package:fis_measure/interfaces/process/standard_line/calibration.dart';
|
|
|
import 'package:fis_measure/interfaces/process/workspace/application.dart';
|
|
|
import 'package:fis_measure/process/visual/visual.dart';
|
|
|
+import 'package:fis_measure/process/workspace/third_part/application.dart';
|
|
|
+import 'package:fis_measure/process/workspace/third_part/calibration_controller.dart';
|
|
|
import 'package:fis_measure/process/workspace/visual_loader.dart';
|
|
|
import 'package:fis_measure/values/unit_desc.dart';
|
|
|
import 'package:fis_measure/view/paint/ai_patint_controller.dart';
|
|
@@ -18,7 +20,7 @@ import 'package:vid/us/vid_us_unit.dart';
|
|
|
class ResultInfo extends StatefulWidget {
|
|
|
const ResultInfo(this.aiDetectedObject, {Key? key}) : super(key: key);
|
|
|
|
|
|
- final List<AIDetectedObject> aiDetectedObject;
|
|
|
+ final List<AIDetectedObject>? aiDetectedObject;
|
|
|
@override
|
|
|
State<ResultInfo> createState() => _ResultInfoState();
|
|
|
}
|
|
@@ -36,15 +38,21 @@ class _ResultInfoState extends State<ResultInfo> {
|
|
|
void initState() {
|
|
|
_updateImagePhysicalSize();
|
|
|
try {
|
|
|
- standardLineCalibrationController =
|
|
|
- Get.find<IStandardLineCalibrationController>();
|
|
|
+ if (application.isThirdPart) {
|
|
|
+ final standradLine = (application as ThirdPartApplication).standardLine;
|
|
|
+ standardLineCalibrationController =
|
|
|
+ StandardLineCalibrationController(application, standradLine);
|
|
|
+ Get.put<IStandardLineCalibrationController>(
|
|
|
+ standardLineCalibrationController!);
|
|
|
+ if (standardLineCalibrationController != null) {
|
|
|
+ standardLineCalibrationController!.editStateChanged
|
|
|
+ .addListener(onStandardLineUpdated);
|
|
|
+ }
|
|
|
+ }
|
|
|
} catch (e) {
|
|
|
- logger.e('standardLineCalibrationController cannot find', e);
|
|
|
- }
|
|
|
- if (standardLineCalibrationController != null) {
|
|
|
- standardLineCalibrationController!.editStateChanged
|
|
|
- .addListener(onStandardLineUpdated);
|
|
|
+ logger.e('standardLineCalibrationController cannot find ', e);
|
|
|
}
|
|
|
+
|
|
|
super.initState();
|
|
|
}
|
|
|
|
|
@@ -64,7 +72,7 @@ class _ResultInfoState extends State<ResultInfo> {
|
|
|
@override
|
|
|
Widget build(BuildContext context) {
|
|
|
final description = widget
|
|
|
- .aiDetectedObject[aiPatintController.state.aiResultIndex].descriptions;
|
|
|
+ .aiDetectedObject?[aiPatintController.state.aiResultIndex].descriptions;
|
|
|
var lesionSizeDescription = description?.firstWhereOrNull(
|
|
|
(element) => element.type == DiagnosisDescriptionEnum.LesionSize);
|
|
|
var lesionSize = lesionSizeDescription?.value ?? '';
|
|
@@ -163,16 +171,16 @@ class _ResultInfoState extends State<ResultInfo> {
|
|
|
width: 70,
|
|
|
height: 70,
|
|
|
child: Obx(() {
|
|
|
- final aiDetected = widget.aiDetectedObject[
|
|
|
+ final aiDetected = widget.aiDetectedObject?[
|
|
|
aiPatintController.state.aiResultIndex];
|
|
|
return CircularProgressIndicator(
|
|
|
valueColor: AlwaysStoppedAnimation(
|
|
|
_buildAITextColor(
|
|
|
- aiDetected.label,
|
|
|
+ aiDetected?.label ?? 0,
|
|
|
),
|
|
|
),
|
|
|
backgroundColor: Colors.grey,
|
|
|
- value: aiDetected.confidence,
|
|
|
+ value: aiDetected?.confidence,
|
|
|
);
|
|
|
}),
|
|
|
),
|
|
@@ -183,12 +191,12 @@ class _ResultInfoState extends State<ResultInfo> {
|
|
|
child: Obx(
|
|
|
() {
|
|
|
final confidence = widget
|
|
|
- .aiDetectedObject[aiPatintController
|
|
|
+ .aiDetectedObject?[aiPatintController
|
|
|
.state.aiResultIndex]
|
|
|
.confidence;
|
|
|
return Center(
|
|
|
child: Text(
|
|
|
- '${(confidence * 100).toStringAsFixed(1)}%',
|
|
|
+ '${(confidence ?? 0 * 100).toStringAsFixed(1)}%',
|
|
|
style: const TextStyle(
|
|
|
color: Colors.white,
|
|
|
fontSize: 18,
|
|
@@ -326,21 +334,24 @@ class _ResultInfoState extends State<ResultInfo> {
|
|
|
switch (aiPatintController.diagnosisOrgan) {
|
|
|
case DiagnosisOrganEnum.Breast:
|
|
|
return Obx(() {
|
|
|
- aiDetectedObjectItem =
|
|
|
- widget.aiDetectedObject[aiPatintController.state.aiResultIndex];
|
|
|
+ aiDetectedObjectItem = widget
|
|
|
+ .aiDetectedObject?[aiPatintController.state.aiResultIndex] ??
|
|
|
+ AIDetectedObject();
|
|
|
return _buildBreastDescription(aiDetectedObjectItem.label);
|
|
|
});
|
|
|
|
|
|
case DiagnosisOrganEnum.Liver:
|
|
|
return Obx(() {
|
|
|
- aiDetectedObjectItem =
|
|
|
- widget.aiDetectedObject[aiPatintController.state.aiResultIndex];
|
|
|
+ aiDetectedObjectItem = widget
|
|
|
+ .aiDetectedObject?[aiPatintController.state.aiResultIndex] ??
|
|
|
+ AIDetectedObject();
|
|
|
return _buildLiverDescription(aiDetectedObjectItem.label);
|
|
|
});
|
|
|
case DiagnosisOrganEnum.Thyroid:
|
|
|
return Obx(() {
|
|
|
- aiDetectedObjectItem =
|
|
|
- widget.aiDetectedObject[aiPatintController.state.aiResultIndex];
|
|
|
+ aiDetectedObjectItem = widget
|
|
|
+ .aiDetectedObject?[aiPatintController.state.aiResultIndex] ??
|
|
|
+ AIDetectedObject();
|
|
|
return _buildThyroidDescription(aiDetectedObjectItem.label);
|
|
|
});
|
|
|
default:
|