///诊断器官枚举 enum DiagnosisOrganEnum { Null, placeHolder_1, Breast, //乳腺 Abdomen, //腹部 Liver, //肝脏 Cholecyst, //胆囊 Kidney, //肾脏 Spleen, //脾脏 CarotidArtery, //颈动脉 Thyroid, //甲状腺 Neck, //颈部 } class AIDiagnosisRect { int right; int bottom; int left; int top; int width; int height; AIDiagnosisRect({ this.right = 0, this.bottom = 0, this.left = 0, this.top = 0, this.width = 0, this.height = 0, }); factory AIDiagnosisRect.fromJson(Map map) { return AIDiagnosisRect( right: map['Right'], bottom: map['Bottom'], left: map['Left'], top: map['Top'], width: map['Width'], height: map['Height'], ); } Map toJson() { final map = {}; map['Right'] = right; map['Bottom'] = bottom; map['Left'] = left; map['Top'] = top; map['Width'] = width; map['Height'] = height; return map; } } class AIDiagnosisPoint2D { int x; int y; AIDiagnosisPoint2D({ this.x = 0, this.y = 0, }); factory AIDiagnosisPoint2D.fromJson(Map map) { return AIDiagnosisPoint2D( x: map['X'], y: map['Y'], ); } Map toJson() { final map = {}; map['X'] = x; map['Y'] = y; return map; } } ///诊断描述类型 enum DiagnosisDescriptionEnum { Shape, //形状 Orientation, //方向 EchoPattern, //回声模式 LesionBoundary, //病变边界 Margin, //边缘 Calcification, //钙化 LesionSize, //病变大小 ThyroidEchoPattern, //甲状腺回声模式 ThyroidShape, //甲状腺形状 ThyroidMargin, //甲状腺边缘 ThyroidEchogenicFoci, //甲状腺回声点 LiverShape, //肝脏形状 LiverBoundary, //肝脏边界 LiverEchoTexture, //肝脏回声质地 QlaqueEchoPattern, // 斑块回声类型,这里下面是颈动脉相关的 QlaqueLocation, // 斑块位置 CarotidRateOfStenosis, // 颈动脉狭窄率 CarotidInnerDiameter, // 颈动脉内径 CarotidIntimaMediaThickness, // 颈动脉内中膜厚度,到这结束颈动脉相关 } class AIDiagnosisDescription { DiagnosisDescriptionEnum type; String? value; AIDiagnosisDescription({ this.type = DiagnosisDescriptionEnum.Shape, this.value, }); factory AIDiagnosisDescription.fromJson(Map map) { return AIDiagnosisDescription( type: DiagnosisDescriptionEnum.values .firstWhere((e) => e.index == map['Type']), value: map['Value'], ); } Map toJson() { final map = {}; map['Type'] = type.index; if (value != null) map['Value'] = value; return map; } } class AIDetectedObject { ///标签 int label; ///置信度(可信程度) double confidence; ///边界框 AIDiagnosisRect? boundingBox; ///坐标集合 List? contours; ///描述集合 List? descriptions; AIDetectedObject({ this.label = 0, this.confidence = 0, this.boundingBox, this.contours, this.descriptions, }); factory AIDetectedObject.fromJson(Map map) { return AIDetectedObject( label: map['Label'], confidence: map['Confidence'], boundingBox: map['BoundingBox'] != null ? AIDiagnosisRect.fromJson(map['BoundingBox']) : null, contours: map['Contours'] != null ? (map['Contours'] as List) .map( (e) => AIDiagnosisPoint2D.fromJson(e as Map)) .toList() : null, descriptions: map['Descriptions'] != null ? (map['Descriptions'] as List) .map((e) => AIDiagnosisDescription.fromJson(e as Map)) .toList() : null, ); } Map toJson() { final map = {}; map['Label'] = label; map['Confidence'] = confidence; if (boundingBox != null) map['BoundingBox'] = boundingBox; if (contours != null) map['Contours'] = contours; if (descriptions != null) map['Descriptions'] = descriptions; return map; } } class AIDiagnosisResultPerOrgan { ///诊断器官 DiagnosisOrganEnum organ; ///诊断矩形 AIDiagnosisRect? organBoundBox; ///器官轮廓:坐标集合 List? organContours; ///器官描述 List? organDescriptions; ///检测到的对象集合 List? detectedObjects; AIDiagnosisResultPerOrgan({ this.organ = DiagnosisOrganEnum.Null, this.organBoundBox, this.organContours, this.organDescriptions, this.detectedObjects, }); factory AIDiagnosisResultPerOrgan.fromJson(Map map) { return AIDiagnosisResultPerOrgan( organ: DiagnosisOrganEnum.values.firstWhere((e) => e.index == map['Organ']), organBoundBox: map['OrganBoundBox'] != null ? AIDiagnosisRect.fromJson(map['OrganBoundBox']) : null, organContours: map['OrganContours'] != null ? (map['OrganContours'] as List) .map( (e) => AIDiagnosisPoint2D.fromJson(e as Map)) .toList() : null, organDescriptions: map['OrganDescriptions'] != null ? (map['OrganDescriptions'] as List) .map((e) => AIDiagnosisDescription.fromJson(e as Map)) .toList() : null, detectedObjects: map['DetectedObjects'] != null ? (map['DetectedObjects'] as List) .map((e) => AIDetectedObject.fromJson(e as Map)) .toList() : null, ); } Map toJson() { final map = {}; map['Organ'] = organ.index; if (organBoundBox != null) map['OrganBoundBox'] = organBoundBox; if (organContours != null) map['OrganContours'] = organContours; if (organDescriptions != null) map['OrganDescriptions'] = organDescriptions; if (detectedObjects != null) map['DetectedObjects'] = detectedObjects; return map; } } class AIDiagnosisPerImageDTO { int index; double priorityScore; List? diagResultsForEachOrgan; AIDiagnosisPerImageDTO({ this.index = 0, this.priorityScore = 0, this.diagResultsForEachOrgan, }); factory AIDiagnosisPerImageDTO.fromJson(Map map) { return AIDiagnosisPerImageDTO( index: map['Index'], priorityScore: map['PriorityScore'], diagResultsForEachOrgan: map['DiagResultsForEachOrgan'] != null ? (map['DiagResultsForEachOrgan'] as List) .map((e) => AIDiagnosisResultPerOrgan.fromJson(e as Map)) .toList() : null, ); } Map toJson() { final map = {}; map['Index'] = index; map['PriorityScore'] = priorityScore; if (diagResultsForEachOrgan != null) { map['DiagResultsForEachOrgan'] = diagResultsForEachOrgan; } return map; } }