cardiac.dart 3.5 KB

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