123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280 |
- ///诊断器官枚举
- 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<String, dynamic> map) {
- return AIDiagnosisRect(
- right: map['Right'],
- bottom: map['Bottom'],
- left: map['Left'],
- top: map['Top'],
- width: map['Width'],
- height: map['Height'],
- );
- }
- Map<String, dynamic> toJson() {
- final map = <String, dynamic>{};
- 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<String, dynamic> map) {
- return AIDiagnosisPoint2D(
- x: map['X'],
- y: map['Y'],
- );
- }
- Map<String, dynamic> toJson() {
- final map = <String, dynamic>{};
- 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<String, dynamic> map) {
- return AIDiagnosisDescription(
- type: DiagnosisDescriptionEnum.values
- .firstWhere((e) => e.index == map['Type']),
- value: map['Value'],
- );
- }
- Map<String, dynamic> toJson() {
- final map = <String, dynamic>{};
- map['Type'] = type.index;
- if (value != null) map['Value'] = value;
- return map;
- }
- }
- class AIDetectedObject {
- ///标签
- int label;
- ///置信度(可信程度)
- double confidence;
- ///边界框
- AIDiagnosisRect? boundingBox;
- ///坐标集合
- List<AIDiagnosisPoint2D>? contours;
- ///描述集合
- List<AIDiagnosisDescription>? descriptions;
- AIDetectedObject({
- this.label = 0,
- this.confidence = 0,
- this.boundingBox,
- this.contours,
- this.descriptions,
- });
- factory AIDetectedObject.fromJson(Map<String, dynamic> 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<String, dynamic>))
- .toList()
- : null,
- descriptions: map['Descriptions'] != null
- ? (map['Descriptions'] as List)
- .map((e) =>
- AIDiagnosisDescription.fromJson(e as Map<String, dynamic>))
- .toList()
- : null,
- );
- }
- Map<String, dynamic> toJson() {
- final map = <String, dynamic>{};
- 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<AIDiagnosisPoint2D>? organContours;
- ///器官描述
- List<AIDiagnosisDescription>? organDescriptions;
- ///检测到的对象集合
- List<AIDetectedObject>? detectedObjects;
- AIDiagnosisResultPerOrgan({
- this.organ = DiagnosisOrganEnum.Null,
- this.organBoundBox,
- this.organContours,
- this.organDescriptions,
- this.detectedObjects,
- });
- factory AIDiagnosisResultPerOrgan.fromJson(Map<String, dynamic> 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<String, dynamic>))
- .toList()
- : null,
- organDescriptions: map['OrganDescriptions'] != null
- ? (map['OrganDescriptions'] as List)
- .map((e) =>
- AIDiagnosisDescription.fromJson(e as Map<String, dynamic>))
- .toList()
- : null,
- detectedObjects: map['DetectedObjects'] != null
- ? (map['DetectedObjects'] as List)
- .map((e) => AIDetectedObject.fromJson(e as Map<String, dynamic>))
- .toList()
- : null,
- );
- }
- Map<String, dynamic> toJson() {
- final map = <String, dynamic>{};
- 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<AIDiagnosisResultPerOrgan>? diagResultsForEachOrgan;
- AIDiagnosisPerImageDTO({
- this.index = 0,
- this.priorityScore = 0,
- this.diagResultsForEachOrgan,
- });
- factory AIDiagnosisPerImageDTO.fromJson(Map<String, dynamic> map) {
- return AIDiagnosisPerImageDTO(
- index: map['Index'],
- priorityScore: map['PriorityScore'],
- diagResultsForEachOrgan: map['DiagResultsForEachOrgan'] != null
- ? (map['DiagResultsForEachOrgan'] as List)
- .map((e) =>
- AIDiagnosisResultPerOrgan.fromJson(e as Map<String, dynamic>))
- .toList()
- : null,
- );
- }
- Map<String, dynamic> toJson() {
- final map = <String, dynamic>{};
- map['Index'] = index;
- map['PriorityScore'] = priorityScore;
- if (diagResultsForEachOrgan != null) {
- map['DiagResultsForEachOrgan'] = diagResultsForEachOrgan;
- }
- return map;
- }
- }
|