From 5e7876a9c51dacb855bb472e47c6e66a14a10ba7 Mon Sep 17 00:00:00 2001 From: kradchen Date: Mon, 23 Jun 2025 13:42:23 +0800 Subject: [PATCH] fix: fix elipse & round draw bug --- .../Measure/EllipseAnnotationActor.cpp | 4 +- .../Measure/RoundAnnotationActor.cpp | 24 +- .../Rendering/Measure/RoundAnnotationActor.h | 9 +- src/translations/en_US.ts | 345 ++++++++++-------- src/translations/zh_CN.ts | 195 +++++----- 5 files changed, 310 insertions(+), 267 deletions(-) diff --git a/src/src/Rendering/Measure/EllipseAnnotationActor.cpp b/src/src/Rendering/Measure/EllipseAnnotationActor.cpp index f77c4c7..26bd26e 100644 --- a/src/src/Rendering/Measure/EllipseAnnotationActor.cpp +++ b/src/src/Rendering/Measure/EllipseAnnotationActor.cpp @@ -274,10 +274,10 @@ void EllipseAnnotationActor::drawCircle(double *p1, double *p2) { double * dp = Renderer->GetActiveCamera()->GetDirectionOfProjection(); int nIndex[2] = {0,1}; - if (abs(dp[1])>0.0){ + if (abs(dp[1])>0.5){ nIndex[1] = 2; } - if (abs(dp[0])>0.0){ + if (abs(dp[0])>0.5){ nIndex[0] = 1; nIndex[1] = 2; } diff --git a/src/src/Rendering/Measure/RoundAnnotationActor.cpp b/src/src/Rendering/Measure/RoundAnnotationActor.cpp index e404611..c86fdde 100644 --- a/src/src/Rendering/Measure/RoundAnnotationActor.cpp +++ b/src/src/Rendering/Measure/RoundAnnotationActor.cpp @@ -133,12 +133,9 @@ RoundAnnotationActor::RoundAnnotationActor() { textProperty->SetBackgroundColor(1.0, 0.0, 0.0); textProperty->SetBackgroundOpacity(0.3); - mUnitmm2 = QCoreApplication::translate("RoundAnnotationActor","mm²"); - mUnitcm2 = QCoreApplication::translate("RoundAnnotationActor","cm²"); - mAreaName = QCoreApplication::translate("RoundAnnotationActor", "Area"); - mUnitcm3 = QCoreApplication::translate("RoundAnnotationActor","cm³"); - mUnitmm3 = QCoreApplication::translate("RoundAnnotationActor","mm³"); - mVolumeName = QCoreApplication::translate("RoundAnnotationActor", "Volume"); + mUnitmm = QCoreApplication::translate("RoundAnnotationActor","mm"); + mUnitcm = QCoreApplication::translate("RoundAnnotationActor","cm"); + mDiameterName = QCoreApplication::translate("RoundAnnotationActor", "Diameter"); } RoundAnnotationActor::~RoundAnnotationActor() { @@ -266,10 +263,10 @@ void RoundAnnotationActor::drawCircle(double *p1, double *p2) { double * dp = Renderer->GetActiveCamera()->GetDirectionOfProjection(); int nIndex[2] = {0,1}; - if (abs(dp[1])>0.0){ + if (abs(dp[1])>0.5){ nIndex[1] = 2; } - if (abs(dp[0])>0.0){ + if (abs(dp[0])>0.5){ nIndex[0] = 1; nIndex[1] = 2; } @@ -301,17 +298,14 @@ void RoundAnnotationActor::drawCircle(double *p1, double *p2) { id++; } BaseDataPoints->Modified(); - double area = vtkMath::Pi()*r*r; - double volume = area*3*r/4; - QString textValue = QString("%1: %2%3\r\n%4: %5%6").arg(mAreaName) - .arg(area>1000?area/100:area,0,'f',2).arg(area>1000?mUnitcm2:mUnitmm2) - .arg(mVolumeName) - .arg(volume>10000?volume/1000:volume,0,'f',2).arg(volume>10000?mUnitcm3:mUnitmm3); + double diameter = 2*r; + QString textValue = QString("%1: %2%3").arg(mDiameterName) + .arg(diameter>100?diameter/10:diameter,0,'f',2).arg(diameter>100?mUnitcm:mUnitmm); vtkTextMapper::SafeDownCast(text->GetMapper())->SetInput(textValue.toUtf8().constData()); } void RoundAnnotationActor::selfDragCb(vtkObject *, unsigned long, void *data) { -//control point drag realized by father + //control point drag realized by father } void RoundAnnotationActor::controlPointsTransform(float x, float y) { diff --git a/src/src/Rendering/Measure/RoundAnnotationActor.h b/src/src/Rendering/Measure/RoundAnnotationActor.h index e95e3e3..9102214 100644 --- a/src/src/Rendering/Measure/RoundAnnotationActor.h +++ b/src/src/Rendering/Measure/RoundAnnotationActor.h @@ -58,12 +58,9 @@ private: // void analyzePixel(double *p1, double *p2); vtkTextProperty *textProperty; - QString mUnitmm2 ; - QString mUnitcm2 ; - QString mUnitmm3 ; - QString mUnitcm3 ; - QString mAreaName; - QString mVolumeName; + QString mUnitmm ; + QString mUnitcm ; + QString mDiameterName; QString mRenderTime; }; diff --git a/src/translations/en_US.ts b/src/translations/en_US.ts index e4ea018..e136d33 100644 --- a/src/translations/en_US.ts +++ b/src/translations/en_US.ts @@ -3,16 +3,6 @@ ConfigurationDialog - - - Listener port: - - - - - My AE title: - - Advanced settings @@ -23,9 +13,19 @@ PACS location + + + Listening port: + + + + + Local AE title: + + - Retrive Protocol + Retrieval Protocol @@ -64,12 +64,12 @@ - Retrieve protocol + Retrieval protocol - Maximum active downloads + Maximum active downloads Number @@ -94,27 +94,27 @@ Customwindow - + Customwindow - + Window level - + Window width - + OK - + Cancel @@ -122,279 +122,287 @@ DefaultToolBar - + Open Dicom series from directory - + Open DICOM folder - + Open DICOM file - + Change Language 切换为中文界面 - + Quit - + Search and download studies from PACS locations - + Export images - + Layout - + Toggle series synchronization - + Sychronize slice - + Sychronize zoom & pan - + Sychronize window level & width - - - - CUR STATE: %1 - - - - + Adjust window level - - Custom Window - - - - + Negative - + Pan image - + Zoom image - + Browse series - + Toggle annotations - + Annotations - + Cross Reference Line - + Hide all measurements - + Hide patient data - + Show Dicom tags - - Length - - - - - Angle - - - - + Closed polygon - + Open polygon - + Arrow - + Ellipse - + Text - - Measurements + + Custom window width and level - + + gray + + + + + Jet + + + + + Ruler + + + + + Angle gauge + + + + + Round + + + + + Measuring tool + + + + Delete selected - + Delete all in current slice - + Delete all in current series - + Fusion - + Cine - + Delete current series - + Transformations - + Rotate 90 CCW - + Rotate 90 CW - + Rotate 180 - + Flip horizontal - + Flip vertical - + Clear transformations - + MPR - + 3D MPR - + Coronal - + Sagittal - + Axial - + Full screen - + Exit full screen mode - + Minimize - + Close @@ -402,12 +410,12 @@ DicomImageView - + Error - + Unable to read file %1 @@ -448,140 +456,147 @@ EllipseAnnotationActor - + mm² - + cm² - + Area + + + Area:%1 %7, Pixel:%2, +Max:%3, Min:%4, +Avg:%5, SD:%6 + + ExportDialog - + Dialog - + Export Type - + Export File - + Current Image - + Current Series - + All Opened Series - + File Format - + JPEG - + BMP - + PNG - + TIFF - + DICOM - + Export Location - + Export Folder - + FileName Prefix - + Choose Folder... - + Show in Explorer after exported - + File Settings - + Annotations - + Full - + Basic(anonymous) - + Disabled - + Export - + Close @@ -618,22 +633,22 @@ FontPropertyWidget - + Text Property - + Specify the path to a TTF file here. - + Apply - + Cancel @@ -641,7 +656,7 @@ GridPopWidget - + Form @@ -758,14 +773,14 @@ - + Custom date - + Custom date range @@ -822,32 +837,32 @@ OpenPolyAnnotationActor - + mm - + cm - + mm² - + cm² - + Distance - + Area @@ -871,47 +886,47 @@ QDicomViewer - + Ready - + Open dicom directory - + Open dicom files - + confirm - + Change Language will reload the application, please confirm to do this! - + Ok - + Cancel - + Warning - + open DICOM Images From PACS Fail @@ -919,12 +934,12 @@ QDicomViewerClass - + QDicomViewer - + toolBar @@ -947,6 +962,24 @@ + + RoundAnnotationActor + + + mm + + + + + cm + + + + + Diameter + + + RulerAnnotationActor @@ -976,32 +1009,32 @@ VCRToolbar - + VCR Controls - + &Play - + Pre&vious Frame - + &First Frame - + &Next Frame - + &Last Frame @@ -1067,27 +1100,27 @@ calibrationWidget - + Length Calibration - + Enter new distance - + mm - + OK - + Cancel diff --git a/src/translations/zh_CN.ts b/src/translations/zh_CN.ts index 15e0617..59df120 100644 --- a/src/translations/zh_CN.ts +++ b/src/translations/zh_CN.ts @@ -142,37 +142,37 @@ DefaultToolBar - + Open DICOM folder 打开文件夹 - + Open DICOM file 打开文件 - + Quit 退出 - + Search and download studies from PACS locations 从PACS获取 - + Export images - + Layout 动态布局 - + Toggle series synchronization 激活图像同步 @@ -181,32 +181,32 @@ 当前状态: %1 - + Open Dicom series from directory 打开DICOM - + Change Language Language: English - + Sychronize slice 同步翻页 - + Sychronize zoom & pan 同步缩放&移动 - + Sychronize window level & width 同步窗宽窗位 - + Adjust window level 调窗 @@ -215,52 +215,52 @@ 自定义窗宽窗位 - + Negative 负相 - + Pan image 移动 - + Zoom image 缩放 - + Browse series 翻页 - + Toggle annotations 四角标记 - + Annotations 四角标记 - + Cross Reference Line 参考线 - + Hide all measurements 隐藏所有测量 - + Hide patient data 隐藏患者信息 - + Show Dicom tags 显示DICOM标记 @@ -273,32 +273,32 @@ 量角器 - + Closed polygon 闭合多边形 - + Open polygon 开放多边形 - + Arrow 箭头 - + Ellipse 椭圆 - + Round 正圆直径测量 - + Text 文字 @@ -307,132 +307,142 @@ 测量工具 - + Custom window width and level 自定义窗宽窗位 - + + gray + + + + + Jet + + + + Ruler 直尺 - + Angle gauge 量角器 - + Measuring tool 测量工具 - + Delete selected 删除选中 - + Delete all in current slice 删除当前图像中所有测量 - + Delete all in current series 删除当前序列所有图像 - + Fusion - + Cine - + Delete current series 删除当前序列所有测量 - + Transformations 翻页&旋转 - + Rotate 90 CCW 逆时针旋转90度 - + Rotate 90 CW 顺时针旋转90度 - + Rotate 180 旋转180度 - + Flip horizontal 水平翻转 - + Flip vertical 垂直翻转 - + Clear transformations 清除变换 - + MPR 多平面重建 - + 3D MPR - + Coronal 冠状面 - + Sagittal 矢状面 - + Axial 横断面 - + Full screen 全屏 - + Exit full screen mode 退出全屏 - + Minimize 最小化 - + Close 关闭 @@ -440,12 +450,12 @@ DicomImageView - + Error 错误 - + Unable to read file %1 无法读取文件 %1 @@ -501,7 +511,7 @@ 面积 - + Area:%1 %7, Pixel:%2, Max:%3, Min:%4, Avg:%5, SD:%6 @@ -946,47 +956,47 @@ Avg:%5, SD:%6 QDicomViewer - + Ready 就绪 - + Open dicom directory 打开文件夹 - + Open dicom files 打开文件 - + confirm 确认 - + Change Language will reload the application, please confirm to do this! 更改语言会重载整个程序,请确认是否要如此操作! - + Ok 确认 - + Cancel 取消 - + Warning 警告 - + open DICOM Images From PACS Fail 从PACS打开 @@ -1032,34 +1042,43 @@ Avg:%5, SD:%6 RoundAnnotationActor - mm² - 平方毫米 + 平方毫米 + + + cm² + 平方厘米 + + + Area + 面积 + + + cm³ + 立方厘米 + + + mm³ + 立方毫米 + + + Volume + 体积 + + + + mm + 毫米 - cm² - 平方厘米 + cm + 厘米 - Area - 面积 - - - - cm³ - 立方厘米 - - - - mm³ - 立方毫米 - - - - Volume - 体积 + Diameter + 直径