|
@@ -2,15 +2,17 @@
|
|
|
|
|
|
import 'dart:typed_data';
|
|
|
|
|
|
+import 'package:fis_common/event/event_type.dart';
|
|
|
import 'package:fis_vid_ext/vid_extended_data.dart';
|
|
|
import 'package:fis_vid_ext/vid_tag.dart';
|
|
|
import 'package:fis_vid_ext/vid_value.dart';
|
|
|
|
|
|
import 'pixel_space.dart';
|
|
|
|
|
|
+
|
|
|
class StandardLine {
|
|
|
-
|
|
|
- static const double DefaultPhysicsLength = 40;
|
|
|
+
|
|
|
+ static const double DefaultPhysicsLength = 4.0;
|
|
|
|
|
|
|
|
|
static final VidTag DicomTagPixelSpacing = VidTag("0028", "0030");
|
|
@@ -27,27 +29,43 @@ class StandardLine {
|
|
|
|
|
|
static final VidTag DicomTagPhysicalUnitsY = VidTag("0018", "6026");
|
|
|
|
|
|
- PixelSpacing? _currentPixelSpacing;
|
|
|
+ PixelSpacing _currentPixelSpacing = PixelSpacing();
|
|
|
double _physicsLength = DefaultPhysicsLength;
|
|
|
+ double _pixelLength = 0.0;
|
|
|
+ double _perPixelPhysicalLength = 0.0;
|
|
|
|
|
|
+
|
|
|
double get physicsLength => _physicsLength;
|
|
|
set physicsLength(double val) {
|
|
|
if (val != _physicsLength) {
|
|
|
_physicsLength = val;
|
|
|
+ _onLineLengthChanged();
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+ double get pixelLength => _pixelLength;
|
|
|
+ set pixelLength(double val) {
|
|
|
+ if (val != _pixelLength) {
|
|
|
+ _pixelLength = val;
|
|
|
+ _onLineLengthChanged();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ double get perPixelPhysicalLength => _perPixelPhysicalLength;
|
|
|
+
|
|
|
|
|
|
- PixelSpacing? get currentPixelSpacing => _currentPixelSpacing;
|
|
|
- set currentPixelSpacing(PixelSpacing? val) {
|
|
|
+ PixelSpacing get currentPixelSpacing => _currentPixelSpacing;
|
|
|
+ set currentPixelSpacing(PixelSpacing val) {
|
|
|
if (val != _currentPixelSpacing) {
|
|
|
_currentPixelSpacing = val;
|
|
|
_onPixelSpacingChanged();
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-
|
|
|
- bool get needSetPixelSpacing => currentPixelSpacing == null;
|
|
|
+
|
|
|
+ final pixelSpacingChanged = FEventHandler<PixelSpacing?>();
|
|
|
|
|
|
|
|
|
void loadFromVidExtData(Uint8List bytes) {
|
|
@@ -86,8 +104,23 @@ class StandardLine {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ void _onLineLengthChanged() {
|
|
|
+ final physicalDeltaX = physicsLength * 10 / pixelLength;
|
|
|
+ final physicalDeltaY = physicalDeltaX;
|
|
|
+ currentPixelSpacing = PixelSpacing.fill(physicalDeltaX, physicalDeltaY);
|
|
|
+ }
|
|
|
+
|
|
|
void _onPixelSpacingChanged() {
|
|
|
-
|
|
|
+ _perPixelPhysicalLength =
|
|
|
+ _getPixelLengthWithUnit(currentPixelSpacing.physicalDeltaX);
|
|
|
+ }
|
|
|
+
|
|
|
+ double _getPixelLengthWithUnit(double length) {
|
|
|
+
|
|
|
+
|
|
|
+ length = length / 10;
|
|
|
+
|
|
|
+ return length;
|
|
|
}
|
|
|
|
|
|
IVidValue? _getVidValueByTag(VidTag vidTag, VidExtendedData extendedData) {
|