date_structure.dart 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280
  1. ///诊断器官枚举
  2. enum DiagnosisOrganEnum {
  3. Null,
  4. placeHolder_1,
  5. Breast, //乳腺
  6. Abdomen, //腹部
  7. Liver, //肝脏
  8. Cholecyst, //胆囊
  9. Kidney, //肾脏
  10. Spleen, //脾脏
  11. CarotidArtery, //颈动脉
  12. Thyroid, //甲状腺
  13. Neck, //颈部
  14. }
  15. class AIDiagnosisRect {
  16. int right;
  17. int bottom;
  18. int left;
  19. int top;
  20. int width;
  21. int height;
  22. AIDiagnosisRect({
  23. this.right = 0,
  24. this.bottom = 0,
  25. this.left = 0,
  26. this.top = 0,
  27. this.width = 0,
  28. this.height = 0,
  29. });
  30. factory AIDiagnosisRect.fromJson(Map<String, dynamic> map) {
  31. return AIDiagnosisRect(
  32. right: map['Right'],
  33. bottom: map['Bottom'],
  34. left: map['Left'],
  35. top: map['Top'],
  36. width: map['Width'],
  37. height: map['Height'],
  38. );
  39. }
  40. Map<String, dynamic> toJson() {
  41. final map = <String, dynamic>{};
  42. map['Right'] = right;
  43. map['Bottom'] = bottom;
  44. map['Left'] = left;
  45. map['Top'] = top;
  46. map['Width'] = width;
  47. map['Height'] = height;
  48. return map;
  49. }
  50. }
  51. class AIDiagnosisPoint2D {
  52. int x;
  53. int y;
  54. AIDiagnosisPoint2D({
  55. this.x = 0,
  56. this.y = 0,
  57. });
  58. factory AIDiagnosisPoint2D.fromJson(Map<String, dynamic> map) {
  59. return AIDiagnosisPoint2D(
  60. x: map['X'],
  61. y: map['Y'],
  62. );
  63. }
  64. Map<String, dynamic> toJson() {
  65. final map = <String, dynamic>{};
  66. map['X'] = x;
  67. map['Y'] = y;
  68. return map;
  69. }
  70. }
  71. ///诊断描述类型
  72. enum DiagnosisDescriptionEnum {
  73. Shape, //形状
  74. Orientation, //方向
  75. EchoPattern, //回声模式
  76. LesionBoundary, //病变边界
  77. Margin, //边缘
  78. Calcification, //钙化
  79. LesionSize, //病变大小
  80. ThyroidEchoPattern, //甲状腺回声模式
  81. ThyroidShape, //甲状腺形状
  82. ThyroidMargin, //甲状腺边缘
  83. ThyroidEchogenicFoci, //甲状腺回声点
  84. LiverShape, //肝脏形状
  85. LiverBoundary, //肝脏边界
  86. LiverEchoTexture, //肝脏回声质地
  87. QlaqueEchoPattern, // 斑块回声类型,这里下面是颈动脉相关的
  88. QlaqueLocation, // 斑块位置
  89. CarotidRateOfStenosis, // 颈动脉狭窄率
  90. CarotidInnerDiameter, // 颈动脉内径
  91. CarotidIntimaMediaThickness, // 颈动脉内中膜厚度,到这结束颈动脉相关
  92. }
  93. class AIDiagnosisDescription {
  94. DiagnosisDescriptionEnum type;
  95. String? value;
  96. AIDiagnosisDescription({
  97. this.type = DiagnosisDescriptionEnum.Shape,
  98. this.value,
  99. });
  100. factory AIDiagnosisDescription.fromJson(Map<String, dynamic> map) {
  101. return AIDiagnosisDescription(
  102. type: DiagnosisDescriptionEnum.values
  103. .firstWhere((e) => e.index == map['Type']),
  104. value: map['Value'],
  105. );
  106. }
  107. Map<String, dynamic> toJson() {
  108. final map = <String, dynamic>{};
  109. map['Type'] = type.index;
  110. if (value != null) map['Value'] = value;
  111. return map;
  112. }
  113. }
  114. class AIDetectedObject {
  115. ///标签
  116. int label;
  117. ///置信度(可信程度)
  118. double confidence;
  119. ///边界框
  120. AIDiagnosisRect? boundingBox;
  121. ///坐标集合
  122. List<AIDiagnosisPoint2D>? contours;
  123. ///描述集合
  124. List<AIDiagnosisDescription>? descriptions;
  125. AIDetectedObject({
  126. this.label = 0,
  127. this.confidence = 0,
  128. this.boundingBox,
  129. this.contours,
  130. this.descriptions,
  131. });
  132. factory AIDetectedObject.fromJson(Map<String, dynamic> map) {
  133. return AIDetectedObject(
  134. label: map['Label'],
  135. confidence: map['Confidence'],
  136. boundingBox: map['BoundingBox'] != null
  137. ? AIDiagnosisRect.fromJson(map['BoundingBox'])
  138. : null,
  139. contours: map['Contours'] != null
  140. ? (map['Contours'] as List)
  141. .map(
  142. (e) => AIDiagnosisPoint2D.fromJson(e as Map<String, dynamic>))
  143. .toList()
  144. : null,
  145. descriptions: map['Descriptions'] != null
  146. ? (map['Descriptions'] as List)
  147. .map((e) =>
  148. AIDiagnosisDescription.fromJson(e as Map<String, dynamic>))
  149. .toList()
  150. : null,
  151. );
  152. }
  153. Map<String, dynamic> toJson() {
  154. final map = <String, dynamic>{};
  155. map['Label'] = label;
  156. map['Confidence'] = confidence;
  157. if (boundingBox != null) map['BoundingBox'] = boundingBox;
  158. if (contours != null) map['Contours'] = contours;
  159. if (descriptions != null) map['Descriptions'] = descriptions;
  160. return map;
  161. }
  162. }
  163. class AIDiagnosisResultPerOrgan {
  164. ///诊断器官
  165. DiagnosisOrganEnum organ;
  166. ///诊断矩形
  167. AIDiagnosisRect? organBoundBox;
  168. ///器官轮廓:坐标集合
  169. List<AIDiagnosisPoint2D>? organContours;
  170. ///器官描述
  171. List<AIDiagnosisDescription>? organDescriptions;
  172. ///检测到的对象集合
  173. List<AIDetectedObject>? detectedObjects;
  174. AIDiagnosisResultPerOrgan({
  175. this.organ = DiagnosisOrganEnum.Null,
  176. this.organBoundBox,
  177. this.organContours,
  178. this.organDescriptions,
  179. this.detectedObjects,
  180. });
  181. factory AIDiagnosisResultPerOrgan.fromJson(Map<String, dynamic> map) {
  182. return AIDiagnosisResultPerOrgan(
  183. organ:
  184. DiagnosisOrganEnum.values.firstWhere((e) => e.index == map['Organ']),
  185. organBoundBox: map['OrganBoundBox'] != null
  186. ? AIDiagnosisRect.fromJson(map['OrganBoundBox'])
  187. : null,
  188. organContours: map['OrganContours'] != null
  189. ? (map['OrganContours'] as List)
  190. .map(
  191. (e) => AIDiagnosisPoint2D.fromJson(e as Map<String, dynamic>))
  192. .toList()
  193. : null,
  194. organDescriptions: map['OrganDescriptions'] != null
  195. ? (map['OrganDescriptions'] as List)
  196. .map((e) =>
  197. AIDiagnosisDescription.fromJson(e as Map<String, dynamic>))
  198. .toList()
  199. : null,
  200. detectedObjects: map['DetectedObjects'] != null
  201. ? (map['DetectedObjects'] as List)
  202. .map((e) => AIDetectedObject.fromJson(e as Map<String, dynamic>))
  203. .toList()
  204. : null,
  205. );
  206. }
  207. Map<String, dynamic> toJson() {
  208. final map = <String, dynamic>{};
  209. map['Organ'] = organ.index;
  210. if (organBoundBox != null) map['OrganBoundBox'] = organBoundBox;
  211. if (organContours != null) map['OrganContours'] = organContours;
  212. if (organDescriptions != null) map['OrganDescriptions'] = organDescriptions;
  213. if (detectedObjects != null) map['DetectedObjects'] = detectedObjects;
  214. return map;
  215. }
  216. }
  217. class AIDiagnosisPerImageDTO {
  218. int index;
  219. double priorityScore;
  220. List<AIDiagnosisResultPerOrgan>? diagResultsForEachOrgan;
  221. AIDiagnosisPerImageDTO({
  222. this.index = 0,
  223. this.priorityScore = 0,
  224. this.diagResultsForEachOrgan,
  225. });
  226. factory AIDiagnosisPerImageDTO.fromJson(Map<String, dynamic> map) {
  227. return AIDiagnosisPerImageDTO(
  228. index: map['Index'],
  229. priorityScore: map['PriorityScore'],
  230. diagResultsForEachOrgan: map['DiagResultsForEachOrgan'] != null
  231. ? (map['DiagResultsForEachOrgan'] as List)
  232. .map((e) =>
  233. AIDiagnosisResultPerOrgan.fromJson(e as Map<String, dynamic>))
  234. .toList()
  235. : null,
  236. );
  237. }
  238. Map<String, dynamic> toJson() {
  239. final map = <String, dynamic>{};
  240. map['Index'] = index;
  241. map['PriorityScore'] = priorityScore;
  242. if (diagResultsForEachOrgan != null) {
  243. map['DiagResultsForEachOrgan'] = diagResultsForEachOrgan;
  244. }
  245. return map;
  246. }
  247. }