123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391 |
- import 'package:fis_measure/interfaces/process/items/item.dart';
- import 'package:fis_measure/interfaces/process/items/item_metas.dart';
- import 'package:fis_measure/interfaces/process/items/types.dart';
- import 'package:fis_measure/process/items/item.dart';
- import 'package:fis_measure/process/primitives/carotid_imt.dart';
- import 'package:fis_measure/process/primitives/combos/afi.dart';
- import 'package:fis_measure/process/primitives/combos/area_straightline.dart';
- import 'package:fis_measure/process/primitives/combos/depth2baseline.dart';
- import 'package:fis_measure/process/primitives/combos/flow_area_vti.dart';
- import 'package:fis_measure/process/primitives/combos/lv_mass.dart';
- import 'package:fis_measure/process/primitives/combos/lwh_straightline.dart';
- import 'package:fis_measure/process/primitives/combos/lv_study.dart';
- import 'package:fis_measure/process/primitives/combos/pisa.dart';
- import 'package:fis_measure/process/primitives/combos/simpson.dart';
- import 'package:fis_measure/process/primitives/combos/sv.dart';
- import 'package:fis_measure/process/primitives/combos/three_ray.dart';
- import 'package:fis_measure/process/primitives/combos/two_area.dart';
- import 'package:fis_measure/process/primitives/combos/two_location.dart';
- import 'package:fis_measure/process/primitives/combos/two_ray.dart';
- import 'package:fis_measure/process/primitives/combos/two_straightline.dart';
- import 'package:fis_measure/process/primitives/combos/two_sv.dart';
- import 'package:fis_measure/process/primitives/multi_method/auto_doppler_trace.dart';
- import 'package:fis_measure/process/primitives/urm_measure/urm_den.dart';
- import 'package:fis_measure/process/primitives/urm_measure/urm_trace_measure.dart';
- import 'package:fis_measure/process/primitives/urm_measure/urm_ab_ratio.dart';
- import 'package:fis_measure/process/primitives/urm_measure/urm_vel.dart';
- import 'package:fis_measure/process/primitives/detection.dart';
- import 'package:fis_measure/process/primitives/ellipse.dart';
- import 'package:fis_measure/process/primitives/empty.dart';
- import 'package:fis_measure/process/primitives/location.dart';
- import 'package:fis_measure/process/primitives/multi_method/multiple_trace.dart';
- import 'package:fis_measure/process/primitives/multi_method/semiauto_trace.dart';
- import 'package:fis_measure/process/primitives/polyline.dart';
- import 'package:fis_measure/process/primitives/polyline_angle.dart';
- import 'package:fis_measure/process/primitives/ray.dart';
- import 'package:fis_measure/process/primitives/rvsp.dart';
- import 'package:fis_measure/process/primitives/single_straightline.dart';
- import 'package:fis_measure/process/primitives/spline.dart';
- import 'package:fis_measure/process/primitives/straightline.dart';
- import 'package:fis_measure/process/primitives/trace.dart';
- import 'package:fis_measure/process/primitives/twoline_angle.dart';
- import 'package:fis_measure/process/primitives/urm_measure/urm_ellipse_measure.dart';
- import 'package:fis_measure/process/primitives/urm_measure/urm_location_vel.dart';
- import 'package:fis_measure/process/primitives/urm_measure/urm_rect_measure.dart';
- import 'package:fis_measure/process/primitives/urm_measure/urm_shell_measure.dart';
- import 'package:fis_measure/process/primitives/urm_measure/urm_vessel_measure.dart';
- import 'package:fis_measure/process/primitives/urm_measure/urm_curvature_trace_measure.dart';
- import 'package:fis_measure/process/primitives/urm_measure/urm_curve_curvature_line_measure.dart';
- import 'package:fis_measure/process/primitives/urm_measure/urm_straight_curvature_line_measure.dart';
- /// 测量项创建器
- ///
- /// [meta] 测量项元信息
- ///
- /// [parent] 父项
- typedef MeasureItemCreator = MeasureItem Function(
- ItemMeta meta,
- IMeasureItem? parent,
- );
- /// 测量项工厂
- class MeasureItemFactory {
- MeasureItemFactory._();
- static MeasureItemFactory? _singletonInstance;
- static MeasureItemFactory get _singleton {
- if (_singletonInstance == null) {
- _singletonInstance = MeasureItemFactory._();
- _registerItemCreators();
- }
- return _singletonInstance!;
- }
- final _itemCreatorMap = <String, MeasureItemCreator>{};
- void _register(String typeName, MeasureItemCreator creator) {
- final key = typeName;
- _itemCreatorMap[key] = creator;
- }
- MeasureItemCreator? _findCreator(String typeName) {
- final key = typeName;
- if (_itemCreatorMap.containsKey(key)) {
- return _itemCreatorMap[key];
- }
- return null;
- }
- /// 创建测量项
- ///
- /// [meta] 元信息
- ///
- /// [parent] 父项
- static MeasureItem? createItem(ItemMeta meta, [IMeasureItem? parent]) {
- if (meta.measureType.isEmpty) return null;
- final creator = _singleton._findCreator(meta.measureType);
- if (creator == null) return null;
- final item = creator.call(meta, parent);
- return item;
- }
- static void _registerItemCreators() {
- // Cardiac
- _singleton._register(
- MeasureTypes.LvStudyByLineGroup, LvStudy.createLvStudyByLineGroup);
- _singleton._register(MeasureTypes.LvStudyByLineGroupTissue,
- LvStudy.createLvStudyByLineGroup);
- _singleton._register(
- MeasureTypes.LvSimpleTissue, LvStudy.createLvSimpleTissue);
- _singleton._register(
- MeasureTypes.LvSimpleTissueTm, LvStudy.createLvSimpleTissueTm);
- _singleton._register(MeasureTypes.LvdMassAL, LVMass.createLVdMass);
- _singleton._register(MeasureTypes.RVSP, Rvsp.createRvsp);
- _singleton._register(MeasureTypes.LvSimpson, LvStudySimpson.create);
- _singleton._register(
- MeasureTypes.LvSingleSimpson, LvStudySingleSimpson.create);
- // SV
- _singleton._register(MeasureTypes.SV, Sv.createSV);
- _singleton._register(MeasureTypes.QpQs, TwoSv.crateQpQs);
- _singleton._register(MeasureTypes.MultiQpQs, TwoSv.crateQpQs);
- _singleton._register(MeasureTypes.FlowVol, Sv.createFlowVol);
- _singleton._register(
- MeasureTypes.FlowAreaByVTI, FlowAreaByVti.createFlowAreaByVti);
- _singleton._register(MeasureTypes.PISA, Pisa.createPisa);
- // Empty
- _singleton._register(MeasureTypes.Empty, Empty.createEmpty);
- // Locations
- _singleton._register(MeasureTypes.Depth, Location.createTissueDepth);
- _singleton._register(
- MeasureTypes.DepthToBaseLine, DepthToBaseLine.createDepthToBaseLine);
- // Two Locations
- _singleton._register(
- MeasureTypes.AbRatioTwoVelocity, TwoLocation.createAbRatioTwoVelocity);
- _singleton._register(MeasureTypes.ResistivityIndex,
- TwoLocation.createResistivityIndexTwoLocationByEd);
- _singleton._register(MeasureTypes.ResistivityIndexTwoLocationByEd,
- TwoLocation.createResistivityIndexTwoLocationByEd);
- _singleton._register(
- MeasureTypes.MaxPgTwoLocation, TwoLocation.createMaxPgTwoLocation);
- _singleton._register(MeasureTypes.PulsatilityIndexTwoLocation,
- TwoLocation.createPulsatilityIndex);
- // Straight
- _singleton._register(MeasureTypes.Distance, StraightLine.createDistance);
- _singleton._register(MeasureTypes.Ray, Ray.createRay);
- _singleton._register(MeasureTypes.LvDpDt, StraightLine.createLvDpDt);
- _singleton._register(
- MeasureTypes.VolumeOneDistance, StraightLine.createVolume);
- // Three StraightLine
- _singleton._register(
- MeasureTypes.VolumeThreeDistance, LWHStraightLine.createVolume);
- _singleton._register(
- MeasureTypes.ThreeDistanceMean, LWHStraightLine.createMean);
- _singleton._register(
- MeasureTypes.ThreeDistanceMax, LWHStraightLine.createMax);
- _singleton._register(
- MeasureTypes.VolumeTwoDistance, TwoStraightLine.createVolume);
- _singleton._register(MeasureTypes.VolumeEllipse, Ellipse.createVolume);
- _singleton._register(MeasureTypes.ThreeVerticalDistance,
- LWHStraightLine.createThreeVerticalDistance);
- // Two Area
- _singleton._register(MeasureTypes.StenosisTwoArea, TwoArea.crateStenosis);
- _singleton._register(MeasureTypes.AbRatioTwoArea, TwoArea.crateABRatio);
- // Two StraightLine
- _singleton._register(
- MeasureTypes.TwoDistanceBase, TwoStraightLine.createTwoDistanceBase);
- _singleton._register(MeasureTypes.ResidualUrine, TwoStraightLine.createRUV);
- _singleton._register(MeasureTypes.StenosisTwoDistance,
- TwoStraightLine.createStenosisTwoDistance);
- _singleton._register(
- MeasureTypes.AbRatioTwoDistance, TwoStraightLine.createAbRatioDistance);
- _singleton._register(
- MeasureTypes.OBRatioFLBPD, TwoStraightLine.createAbRatioDistance);
- _singleton._register(
- MeasureTypes.OBRatioBPDOFD, TwoStraightLine.createAbRatioDistance);
- _singleton._register(MeasureTypes.TwoDistanceAverage,
- TwoStraightLine.createTwoDistanceAverage);
- _singleton._register(
- MeasureTypes.TwoStraightLineAngle, TwoStraightLine.createAngle);
- _singleton._register(MeasureTypes.IvsThck, TwoStraightLine.createIvsThck);
- _singleton._register(MeasureTypes.TwoVerticalDistance,
- TwoStraightLine.createTwoVerticalDistance);
- // Angle
- _singleton._register(
- MeasureTypes.PolyLineAngle, PolylineAngle.createPolyAngle);
- // TissueTM
- _singleton._register(
- MeasureTypes.VerticalDistance, StraightLine.createVerticalDistance);
- _singleton._register(MeasureTypes.TimeSpan, StraightLine.createTimeSpan);
- _singleton._register(MeasureTypes.MDepth, Location.createTissueTMDepth);
- _singleton._register(MeasureTypes.StenosisTwoVerticalDistance,
- TwoStraightLine.createStenosisTwoVerticalDistance);
- _singleton._register(MeasureTypes.AbRatioTwoVerticalDistance,
- TwoStraightLine.createAbRatioTwoVerticalDistance);
- _singleton._register(
- MeasureTypes.AbRatioTwoSlope, TwoStraightLine.createAbRatioSlope);
- _singleton._register(MeasureTypes.EfTeich, TwoStraightLine.createEfTeich);
- _singleton._register(MeasureTypes.Slope, StraightLine.createSlope);
- _singleton._register(
- MeasureTypes.SlopeDoppler, StraightLine.createSlopeDoppler);
- _singleton._register(MeasureTypes.Velocity, Location.createVelocity);
- _singleton._register(MeasureTypes.DopplerTrace, MultiTrace.createTrace);
- _singleton._register(
- MeasureTypes.SemiManualTrace, MultiTrace.createTrace); // 暂时只支持手动
- _singleton._register(MeasureTypes.Pht, StraightLine.createTimeSpan);
- _singleton._register(MeasureTypes.TeiIndex, TwoStraightLine.createTeiIndex);
- _singleton._register(MeasureTypes.AbRatioTwoTimeSpan,
- TwoStraightLine.createAbRatioTwoTimeSpan);
- // Area Perimeter
- _singleton._register(
- MeasureTypes.AreaPerimeterEllipse, Ellipse.createAreaPerimeter);
- _singleton._register(
- MeasureTypes.AreaPerimeterPolyline, Polyline.createAreaPerimeter);
- _singleton._register(
- MeasureTypes.AreaPerimeterSpline, Spline.createAreaPerimeter);
- _singleton._register(
- MeasureTypes.AreaPerimeterTrace, Trace.createAreaPerimeter);
- _singleton._register(MeasureTypes.AreaPerimeterTwoDistance,
- TwoStraightLine.createAreaPerimeter);
- // Area & H
- _singleton._register(
- MeasureTypes.AreaStraightLine, AreaStraightLine.createVolume);
- _singleton._register(
- MeasureTypes.CurveLengthPolyline, Polyline.createCurveLength);
- _singleton._register(
- MeasureTypes.CurveLengthSpline, Spline.createCurveLength);
- _singleton._register(
- MeasureTypes.CurveLengthTrace, Trace.createCurveLength);
- // Specific
- _singleton._register(MeasureTypes.Afi, Afi.createAfi);
- _singleton._register(MeasureTypes.HR, SingleStraightLine.createHeartRate);
- _singleton._register(MeasureTypes.HipOneRay, TwoRay.createTwoRay);
- _singleton._register(MeasureTypes.HipTwoRay, ThreeRay.createThreeRay);
- _singleton._register(
- MeasureTypes.CardiacAxis, TwolineAngle.createTwolineAngle);
- // AI
- _singleton._register(MeasureTypes.AntCCA_IMT, CarotidIMT.createMeasureRect);
- _singleton._register(
- MeasureTypes.PostCCA_IMT, CarotidIMT.createMeasureRect);
- _singleton._register(
- MeasureTypes.BothCCA_IMT, CarotidIMT.createMeasureRect);
- _singleton._register(
- MeasureTypes.PlaqueDetection, CarotidDetection.createDetectionRect);
- _singleton._register(
- MeasureTypes.IntimaDetection, CarotidDetection.createDetectionRect);
- // URM 超分辨
- // _singleton._register(MeasureTypes.URMCurvature,
- // URMCurvatureMeasure.createURMCurvatureMeasure);
- _singleton._register(MeasureTypes.URMStraightCurvatureLineMeasure,
- URMStraightCurvatureLineMeasure.createURMStraightCurvatureLineMeasure);
- _singleton._register(MeasureTypes.URMCurveCurvatureLineMeasure,
- URMCurveCurvatureLineMeasure.createURMCurveCurvatureLineMeasure);
- _singleton._register(MeasureTypes.URMCurvatureTraceMeasure,
- URMCurvatureTraceMeasure.createURMCurvatureTraceMeasure);
- _singleton._register(
- MeasureTypes.URMRectDensity, URMRectMeasure.createURMRectDensity);
- /// TODO
- _singleton._register(
- MeasureTypes.URMTraceDensity, URMTraceMeasure.createURMTraceDensity);
- _singleton._register(MeasureTypes.URMEllipseDensity,
- URMEllipseMeasure.createURMEllipseDensity);
- _singleton._register(MeasureTypes.URMLocationVel,
- URMLocationVelMeasure.createURMLocationVelMeasure);
- _singleton._register(
- MeasureTypes.URMRectFractalDim, URMRectMeasure.createURMRectFractalDim);
- _singleton._register(MeasureTypes.URMTraceFractalDim,
- URMTraceMeasure.createURMTraceFractalDim);
- _singleton._register(MeasureTypes.URMEllipseFractalDim,
- URMEllipseMeasure.createURMEllipseFractalDim);
- // _singleton._register(
- // MeasureTypes.FractalDimURM, FractalDimURM.CreateFractalDimURM);
- // _singleton._register(MeasureTypes.DensityURM, DensityURM.CreateDensityURM);
- _singleton._register(MeasureTypes.URMDen, URMDen.create);
- _singleton._register(MeasureTypes.URMVel, URMVel.create);
- // _singleton._register(MeasureTypes.AutoUterusVertical,
- // AutoUterusVertical.CreateAutoUterusVertical);
- // _singleton._register(
- // MeasureTypes.AutoUterusCross, AutoUterusCross.CreateAutoUterusCross);
- // _singleton._register(MeasureTypes.URMDensityRation, AbRatio.create);
- // _singleton._register(MeasureTypes.URMFractalDimRation, AbRatio.create);
- _singleton._register(
- MeasureTypes.URMRectDenMeasure, URMRectMeasure.createURMRectDenMeasure);
- _singleton._register(MeasureTypes.URMTraceDenMeasure,
- URMTraceMeasure.createURMTraceDenMeasure);
- _singleton._register(MeasureTypes.URMEllipseDenMeasure,
- URMEllipseMeasure.createURMEllipseDenMeasure);
- _singleton._register(
- MeasureTypes.URMRectVelMeasure, URMRectMeasure.createURMRectVelMeasure);
- _singleton._register(MeasureTypes.URMTraceVelMeasure,
- URMTraceMeasure.createURMTraceVelMeasure);
- _singleton._register(MeasureTypes.URMEllipseVelMeasure,
- URMEllipseMeasure.createURMEllipseVelMeasure);
- ////////// 分界线 ///////////
- // _singleton._register(MeasureTypes.URMDensityMeasure,
- // URMDensityMeasure.CreateURMDensityMeasure);
- // _singleton._register(
- // MeasureTypes.URMVelMeasure, URMVelMeasure.CreateURMVelMeasure);
- // _singleton._register(MeasureTypes.URMDensityVelMeasure,
- // URMDensityVelMeasure.CreateURMDensityVelMeasure);
- _singleton._register(
- MeasureTypes.URMVesselMeasure, URMVesselMeasure.createURMVesselMeasure);
- _singleton._register(
- MeasureTypes.URMRectPerfusion, URMRectMeasure.createURMRectPerfusion);
- _singleton._register(MeasureTypes.URMTracePerfusion,
- URMTraceMeasure.createURMTracePerfusion);
- _singleton._register(MeasureTypes.URMEllipsePerfusion,
- URMEllipseMeasure.createURMEllipsePerfusion);
- // =============== 超声机还未完成 Hist 开始================
- // _singleton._register(
- // MeasureTypes.URMRectHist, URMRectMeasure.createURMRectHist);
- // _singleton._register(
- // MeasureTypes.URMTraceHist, URMTraceMeasure.createURMTraceHist);
- // _singleton._register(
- // MeasureTypes.URMEllipseHist, URMEllipseMeasure.createURMEllipseHist);
- // _singleton._register(MeasureTypes.URMShellHistMeasure,
- // URMShellMeasure.createURMShellHistMeasure);
- // =============== 超声机还未完成 结束================
- // _singleton._register(MeasureTypes.URMPerfusionMeasure,
- // URMPerfusionMeasure.CreateURMPerfusionMeasure);
- // _singleton._register(
- // MeasureTypes.URMHistMeasure, URMHistMeasure.CreateURMHistMeasure);
- _singleton._register(MeasureTypes.URMShellDenMeasure,
- URMShellMeasure.createURMShellDenMeasure);
- _singleton._register(MeasureTypes.URMShellVelMeasure,
- URMShellMeasure.createURMShellVelMeasure);
- _singleton._register(MeasureTypes.URMShellDensityMeasure,
- URMShellMeasure.createURMShellDensityMeasure);
- _singleton._register(MeasureTypes.URMShellFractalDimMeasure,
- URMShellMeasure.createURMShellFractalDimMeasure);
- _singleton._register(MeasureTypes.URMShellPerfusionMeasure,
- URMShellMeasure.createURMShellPerfusionMeasure);
- _singleton._register(MeasureTypes.URMRectDenVelMeasure,
- URMRectMeasure.createURMRectDenVelMeasure);
- _singleton._register(MeasureTypes.URMTraceDenVelMeasure,
- URMTraceMeasure.createURMTraceDenVelMeasure);
- _singleton._register(MeasureTypes.URMEllipseDenVelMeasure,
- URMEllipseMeasure.createURMEllipseDenVelMeasure);
- _singleton._register(MeasureTypes.URMShellDenVelMeasure,
- URMShellMeasure.createURMShellDenVelMeasure);
- /// 新增的
- _singleton._register(
- MeasureTypes.DensityTwoURMRect, TwoURMRectDen.createTwoURMRectDen);
- _singleton._register(
- MeasureTypes.DensityTwoTrace, TwoURMTraceDen.createTwoURMTraceDen);
- _singleton._register(MeasureTypes.DensityTwoEllipse,
- TwoURMEllipseDen.createTwoURMEllipseDen);
- /// 遗漏项
- _singleton._register(MeasureTypes.FractalDimTwoURMRect,
- TwoURMRectFractal.createTwoURMRectFractal);
- _singleton._register(MeasureTypes.FractalDimTwoURMTrace,
- TwoURMTraceFractal.createTwoURMTraceFractal);
- _singleton._register(MeasureTypes.FractalDimTwoURMEllipse,
- TwoURMEllipseFractal.createTwoURMEllipseFractal);
- _singleton._register(
- MeasureTypes.SemiautoTrace,
- SemiautoTrace.createTrace,
- );
- _singleton._register(
- MeasureTypes.AutoDopplerTrace,
- AutoDopplerTrace.createTrace,
- );
- }
- }
|