date_structure.dart 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248
  1. enum DiagnosisOrganEnum {
  2. Null,
  3. placeHolder_1,
  4. Breast,
  5. Abdomen,
  6. Liver,
  7. Cholecyst,
  8. Kidney,
  9. Spleen,
  10. CarotidArtery,
  11. Thyroid,
  12. Neck,
  13. }
  14. class AIDiagnosisRect {
  15. int right;
  16. int bottom;
  17. int left;
  18. int top;
  19. int width;
  20. int height;
  21. AIDiagnosisRect({
  22. this.right = 0,
  23. this.bottom = 0,
  24. this.left = 0,
  25. this.top = 0,
  26. this.width = 0,
  27. this.height = 0,
  28. });
  29. factory AIDiagnosisRect.fromJson(Map<String, dynamic> map) {
  30. return AIDiagnosisRect(
  31. right: map['Right'],
  32. bottom: map['Bottom'],
  33. left: map['Left'],
  34. top: map['Top'],
  35. width: map['Width'],
  36. height: map['Height'],
  37. );
  38. }
  39. Map<String, dynamic> toJson() {
  40. final map = <String, dynamic>{};
  41. map['Right'] = right;
  42. map['Bottom'] = bottom;
  43. map['Left'] = left;
  44. map['Top'] = top;
  45. map['Width'] = width;
  46. map['Height'] = height;
  47. return map;
  48. }
  49. }
  50. class AIDiagnosisPoint2D {
  51. int x;
  52. int y;
  53. AIDiagnosisPoint2D({
  54. this.x = 0,
  55. this.y = 0,
  56. });
  57. factory AIDiagnosisPoint2D.fromJson(Map<String, dynamic> map) {
  58. return AIDiagnosisPoint2D(
  59. x: map['X'],
  60. y: map['Y'],
  61. );
  62. }
  63. Map<String, dynamic> toJson() {
  64. final map = <String, dynamic>{};
  65. map['X'] = x;
  66. map['Y'] = y;
  67. return map;
  68. }
  69. }
  70. enum DiagnosisDescriptionEnum {
  71. Shape,
  72. Orientation,
  73. EchoPattern,
  74. LesionBoundary,
  75. Margin,
  76. Calcification,
  77. LesionSize,
  78. }
  79. class AIDiagnosisDescription {
  80. DiagnosisDescriptionEnum type;
  81. String? value;
  82. AIDiagnosisDescription({
  83. this.type = DiagnosisDescriptionEnum.Shape,
  84. this.value,
  85. });
  86. factory AIDiagnosisDescription.fromJson(Map<String, dynamic> map) {
  87. return AIDiagnosisDescription(
  88. type: DiagnosisDescriptionEnum.values
  89. .firstWhere((e) => e.index == map['Type']),
  90. value: map['Value'],
  91. );
  92. }
  93. Map<String, dynamic> toJson() {
  94. final map = <String, dynamic>{};
  95. map['Type'] = type.index;
  96. if (value != null) map['Value'] = value;
  97. return map;
  98. }
  99. }
  100. class AIDetectedObject {
  101. int label;
  102. double confidence;
  103. AIDiagnosisRect? boundingBox;
  104. List<AIDiagnosisPoint2D>? contours;
  105. List<AIDiagnosisDescription>? descriptions;
  106. AIDetectedObject({
  107. this.label = 0,
  108. this.confidence = 0,
  109. this.boundingBox,
  110. this.contours,
  111. this.descriptions,
  112. });
  113. factory AIDetectedObject.fromJson(Map<String, dynamic> map) {
  114. return AIDetectedObject(
  115. label: map['Label'],
  116. confidence: map['Confidence'],
  117. boundingBox: map['BoundingBox'] != null
  118. ? AIDiagnosisRect.fromJson(map['BoundingBox'])
  119. : null,
  120. contours: map['Contours'] != null
  121. ? (map['Contours'] as List)
  122. .map(
  123. (e) => AIDiagnosisPoint2D.fromJson(e as Map<String, dynamic>))
  124. .toList()
  125. : null,
  126. descriptions: map['Descriptions'] != null
  127. ? (map['Descriptions'] as List)
  128. .map((e) =>
  129. AIDiagnosisDescription.fromJson(e as Map<String, dynamic>))
  130. .toList()
  131. : null,
  132. );
  133. }
  134. Map<String, dynamic> toJson() {
  135. final map = <String, dynamic>{};
  136. map['Label'] = label;
  137. map['Confidence'] = confidence;
  138. if (boundingBox != null) map['BoundingBox'] = boundingBox;
  139. if (contours != null) map['Contours'] = contours;
  140. if (descriptions != null) map['Descriptions'] = descriptions;
  141. return map;
  142. }
  143. }
  144. class AIDiagnosisResultPerOrgan {
  145. DiagnosisOrganEnum organ;
  146. AIDiagnosisRect? organBoundBox;
  147. List<AIDiagnosisPoint2D>? organContours;
  148. List<AIDiagnosisDescription>? organDescriptions;
  149. List<AIDetectedObject>? detectedObjects;
  150. AIDiagnosisResultPerOrgan({
  151. this.organ = DiagnosisOrganEnum.Null,
  152. this.organBoundBox,
  153. this.organContours,
  154. this.organDescriptions,
  155. this.detectedObjects,
  156. });
  157. factory AIDiagnosisResultPerOrgan.fromJson(Map<String, dynamic> map) {
  158. return AIDiagnosisResultPerOrgan(
  159. organ:
  160. DiagnosisOrganEnum.values.firstWhere((e) => e.index == map['Organ']),
  161. organBoundBox: map['OrganBoundBox'] != null
  162. ? AIDiagnosisRect.fromJson(map['OrganBoundBox'])
  163. : null,
  164. organContours: map['OrganContours'] != null
  165. ? (map['OrganContours'] as List)
  166. .map(
  167. (e) => AIDiagnosisPoint2D.fromJson(e as Map<String, dynamic>))
  168. .toList()
  169. : null,
  170. organDescriptions: map['OrganDescriptions'] != null
  171. ? (map['OrganDescriptions'] as List)
  172. .map((e) =>
  173. AIDiagnosisDescription.fromJson(e as Map<String, dynamic>))
  174. .toList()
  175. : null,
  176. detectedObjects: map['DetectedObjects'] != null
  177. ? (map['DetectedObjects'] as List)
  178. .map((e) => AIDetectedObject.fromJson(e as Map<String, dynamic>))
  179. .toList()
  180. : null,
  181. );
  182. }
  183. Map<String, dynamic> toJson() {
  184. final map = <String, dynamic>{};
  185. map['Organ'] = organ.index;
  186. if (organBoundBox != null) map['OrganBoundBox'] = organBoundBox;
  187. if (organContours != null) map['OrganContours'] = organContours;
  188. if (organDescriptions != null) map['OrganDescriptions'] = organDescriptions;
  189. if (detectedObjects != null) map['DetectedObjects'] = detectedObjects;
  190. return map;
  191. }
  192. }
  193. class AIDiagnosisPerImageDTO {
  194. int index;
  195. double priorityScore;
  196. List<AIDiagnosisResultPerOrgan>? diagResultsForEachOrgan;
  197. AIDiagnosisPerImageDTO({
  198. this.index = 0,
  199. this.priorityScore = 0,
  200. this.diagResultsForEachOrgan,
  201. });
  202. factory AIDiagnosisPerImageDTO.fromJson(Map<String, dynamic> map) {
  203. return AIDiagnosisPerImageDTO(
  204. index: map['Index'],
  205. priorityScore: map['PriorityScore'],
  206. diagResultsForEachOrgan: map['DiagResultsForEachOrgan'] != null
  207. ? (map['DiagResultsForEachOrgan'] as List)
  208. .map((e) =>
  209. AIDiagnosisResultPerOrgan.fromJson(e as Map<String, dynamic>))
  210. .toList()
  211. : null,
  212. );
  213. }
  214. Map<String, dynamic> toJson() {
  215. final map = <String, dynamic>{};
  216. map['Index'] = index;
  217. map['PriorityScore'] = priorityScore;
  218. if (diagResultsForEachOrgan != null) {
  219. map['DiagResultsForEachOrgan'] = diagResultsForEachOrgan;
  220. }
  221. return map;
  222. }
  223. }