linear_tissue.dart 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. import 'package:fis_measure/interfaces/date_types/point.dart';
  2. import 'package:fis_measure/interfaces/date_types/skew_transform.dart';
  3. import 'package:fis_measure/interfaces/process/physical_coordinates/physical_coordinate.dart';
  4. import 'package:vid/us/vid_us_physical_coordinate.dart';
  5. import 'package:vid/us/vid_us_visual_area_type.dart';
  6. /// 二维线阵物理坐标系
  7. class LinearTissuePhysicalCoordinate implements ITissuePhysicalCoordinate {
  8. // ignore: non_constant_identifier_names
  9. static final DPoint C_INVALID_POINT = DPoint(double.nan, double.nan);
  10. late final double _depthStart;
  11. late final double _depthEnd;
  12. late final double _width;
  13. late final double _beamPosition;
  14. late final double _steer;
  15. late final DSkewTransform _logicalToPhysicalConvert;
  16. late final DSkewTransform _logicalToPhysicalConvertBack;
  17. LinearTissuePhysicalCoordinate(
  18. VidUsLinearTissuePhysicalCoordinate vidData,
  19. ) {
  20. _depthStart = vidData.depthStart;
  21. _depthEnd = vidData.depthEnd;
  22. _width = vidData.width;
  23. _beamPosition = vidData.beamPosition;
  24. _steer = vidData.steer;
  25. _logicalToPhysicalConvertBack = DSkewTransform(
  26. _steer,
  27. 0,
  28. 0,
  29. (_depthEnd - _depthStart) / 2,
  30. );
  31. _logicalToPhysicalConvert = _logicalToPhysicalConvertBack.inverse;
  32. }
  33. @override
  34. VidUsVisualAreaType get areaType => VidUsVisualAreaType.Tissue;
  35. @override
  36. double get depthEnd => _depthEnd;
  37. @override
  38. double get depthStart => _depthStart;
  39. @override
  40. double get width => _width;
  41. @override
  42. double get beamPosition => _beamPosition;
  43. /// 图像顺时针旋转的y轴旋转角度
  44. ///
  45. /// 单位:degrees
  46. double get steer => _steer;
  47. @override
  48. DPoint convert(DPoint pointInLogical) {
  49. return _logicalToPhysicalConvert.transform(pointInLogical);
  50. }
  51. @override
  52. DPoint convertBack(DPoint pointInPhysical) {
  53. return _logicalToPhysicalConvertBack.transform(pointInPhysical);
  54. }
  55. }