cardiac.dart 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179
  1. import 'dart:math' as math;
  2. import 'package:fis_common/logger/logger.dart';
  3. import 'package:fis_measure/configs/cardiac.dart';
  4. import 'package:fis_measure/utils/number.dart';
  5. class CardiacFormulas {
  6. CardiacFormulas._();
  7. /// IMP
  8. ///
  9. /// Formula: `(CO-ET)/ET`
  10. ///
  11. /// Result Unit: `None`
  12. static double teiIndex(double co, double et) {
  13. double imp = 0.0;
  14. if (et != 0.0) {
  15. imp = (((co).abs() - (et).abs()) / et).abs();
  16. }
  17. return imp;
  18. }
  19. /// EF
  20. /// Formula: `(EDV - ESV )/EDV`
  21. ///
  22. /// [edv] Unit: `cm³`
  23. ///
  24. /// [esv] Unit: `cm³`
  25. ///
  26. /// Result Unit: `None`
  27. static double ef(double edv, double esv) {
  28. // 这行判断暂时注释掉是为了使实际表现与旧版一致
  29. // if (edv < esv) {
  30. // return double.nan;
  31. // }
  32. return (edv - esv) / edv * 100;
  33. }
  34. /// EDV (Teichholz)
  35. ///
  36. /// Formula: `[7.0/(2.4 + LVIDd)] x LVIDd^3`
  37. ///
  38. /// [lvidd] Unit: `cm`
  39. ///
  40. /// Result Unit: `cm³`
  41. static double edvTeichholz(double lvidd) {
  42. double edv = double.nan;
  43. if (!NumUtil.almostEquals(lvidd, 0)) {
  44. edv = 7.0 * math.pow(lvidd, 3) / (2.4 + lvidd);
  45. }
  46. return edv;
  47. }
  48. /// EDV (Cube)
  49. ///
  50. /// Formula: `LVIDd^3`
  51. ///
  52. /// [lvidd] Unit: `cm`
  53. ///
  54. /// Result Unit: `cm³`
  55. static double edvCube(double lvidd) {
  56. double edv = double.nan;
  57. if (!NumUtil.almostEquals(lvidd, 0)) {
  58. edv = math.pow(lvidd, 3).toDouble();
  59. }
  60. return edv;
  61. }
  62. /// ESV (Teichholz)
  63. ///
  64. /// Formula: `[7.0/(2.4 + LVIDs)] x LVIDs^3`
  65. ///
  66. /// [lvids] Unit: `cm`
  67. ///
  68. /// Result Unit: `cm³`
  69. static double esvTeichholz(double lvids) {
  70. // 计算公式相同,入参不同
  71. return edvTeichholz(lvids);
  72. }
  73. /// ESV (Cube)
  74. ///
  75. /// Formula: `LVIDs^3`
  76. ///
  77. /// [lvids] Unit: `cm`
  78. ///
  79. /// Result Unit: `cm³`
  80. static double esvCube(double lvids) {
  81. // 计算公式相同,入参不同
  82. return edvCube(lvids);
  83. }
  84. /// SV
  85. static double sv(double edv, double esv) {
  86. return edv - esv;
  87. }
  88. /// CO
  89. static double co(
  90. double sv, {
  91. required int hr,
  92. }) {
  93. return (sv - hr) / 1000.0;
  94. }
  95. /// CI
  96. static double ci(
  97. double sv, {
  98. required int hr,
  99. required double bsa,
  100. }) {
  101. return ((sv - hr) / 1000.0) / bsa;
  102. }
  103. /// LVdMass
  104. static double lvdMass(double ivsd, double lvidd, double lvpwd) {
  105. const density = GlobalCardiacConfigs.density;
  106. const correctionFactor = GlobalCardiacConfigs.correctionFactor;
  107. double part1 = math.pow(ivsd + lvidd + lvpwd, 3).toDouble();
  108. double part2 = math.pow(lvidd, 3).toDouble();
  109. double value = ((density * part1 - part2) + correctionFactor) / 1000.0;
  110. return value;
  111. }
  112. /// LVd Mass AL
  113. static double lvdMassAL(
  114. double lvadSaxEpi,
  115. double lvadSaxEndo,
  116. double lvldApical,
  117. ) {
  118. double t =
  119. math.sqrt(lvadSaxEpi / math.pi) - math.sqrt(lvadSaxEndo / math.pi);
  120. double mass = 1.05 *
  121. 5 /
  122. 6 *
  123. (lvadSaxEpi * (lvldApical + t) - lvadSaxEndo * lvldApical) /
  124. 1000;
  125. return mass;
  126. }
  127. /// LVd Mass Index
  128. static double lvdMassIndex(double lvdmass, double bsa) {
  129. return lvdmass / bsa * 1000;
  130. }
  131. /// %FS
  132. static double fsPercent(double lvidd, double lvids) {
  133. return ((lvidd - lvids) / lvidd) * 100;
  134. }
  135. /// %IVS
  136. static double ivsPercent(double ivss, double ivsd) {
  137. return ((ivss - ivsd) / ivsd) * 100;
  138. }
  139. /// %LVPW
  140. static double lvpwPercent(double lvpws, double lvpwd) {
  141. return ((lvpws - lvpwd) / lvpwd) * 100;
  142. }
  143. /// MAM%
  144. static double mamPercent(double mapse, double lvidd, double lvids) {
  145. return mapse / (lvidd - lvids + mapse) * 100;
  146. }
  147. /// SI
  148. ///
  149. /// (EDV - ESV)/BSA
  150. ///
  151. /// [sv] cm³
  152. ///
  153. /// [bsa] m²
  154. ///
  155. /// return `cm³/m²`
  156. static double si(double sv, double bsa) {
  157. double si = sv / bsa;
  158. return si;
  159. }
  160. }