feat: add volume measure mode to draggable style

This commit is contained in:
kradchen
2025-07-14 16:42:20 +08:00
parent 159616402e
commit 60306767ff
2 changed files with 31 additions and 5 deletions

View File

@@ -23,6 +23,7 @@
#include "Rendering/Core/DraggableActor.h" #include "Rendering/Core/DraggableActor.h"
#include "Rendering/Measure/CrossCursorAnnotationActor.h" #include "Rendering/Measure/CrossCursorAnnotationActor.h"
#include "Rendering/Measure/EllipsoidVolumeAnnotationActor.h"
#include "Common/QGlobals.h" #include "Common/QGlobals.h"
vtkStandardNewMacro(ActorDraggableInteractorStyle) vtkStandardNewMacro(ActorDraggableInteractorStyle)
@@ -121,6 +122,10 @@ void ActorDraggableInteractorStyle::OnLeftButtonDown() {
return; return;
} }
} }
if(this->InteractionMode == VTKIS_VOLUMEMEASURE){
EllipsoidVolumeAnnotationActor::Default()->onMeasureLeftButtonDown(Interactor);
this->StartState(VTKIS_VOLUMEMEASURE);
}
if (this->InteractionMode == VTKIS_IMAGE_WINDOWLEVEL) { if (this->InteractionMode == VTKIS_IMAGE_WINDOWLEVEL) {
this->WindowLevelStartPosition[0] = x; this->WindowLevelStartPosition[0] = x;
this->WindowLevelStartPosition[1] = y; this->WindowLevelStartPosition[1] = y;
@@ -188,6 +193,10 @@ void ActorDraggableInteractorStyle::OnLeftButtonUp() {
case VTKIS_SYNCPOINT: case VTKIS_SYNCPOINT:
this->EndSyncSlicePoint(); this->EndSyncSlicePoint();
break; break;
case VTKIS_VOLUMEMEASURE:
EllipsoidVolumeAnnotationActor::Default()->onMeasureLeftButtonUp(Interactor);
this->StopState();
break;
} }
vtkInteractorStyleImage::OnLeftButtonUp(); vtkInteractorStyleImage::OnLeftButtonUp();
} }
@@ -271,7 +280,10 @@ void ActorDraggableInteractorStyle::OnMouseMove() {
this->SyncSlicePoint(); this->SyncSlicePoint();
this->InvokeEvent(vtkCommand::InteractionEvent, nullptr); this->InvokeEvent(vtkCommand::InteractionEvent, nullptr);
break; break;
case VTKIS_VOLUMEMEASURE:
VolumeMeasure();
this->InvokeEvent(vtkCommand::InteractionEvent, nullptr);
break;
} }
vtkInteractorStyleImage::OnMouseMove(); vtkInteractorStyleImage::OnMouseMove();
} }
@@ -372,6 +384,11 @@ void ActorDraggableInteractorStyle::MeasurePlace() {
measure->onMeasureMouseMove(this->Interactor); measure->onMeasureMouseMove(this->Interactor);
} }
void ActorDraggableInteractorStyle::VolumeMeasure()
{
EllipsoidVolumeAnnotationActor::Default()->onMeasureMouseMove(Interactor);
}
void ActorDraggableInteractorStyle::Drag() { void ActorDraggableInteractorStyle::Drag() {
int *pos = this->Interactor->GetEventPosition(); int *pos = this->Interactor->GetEventPosition();
this->FindPokedRenderer(pos[0], pos[1]); this->FindPokedRenderer(pos[0], pos[1]);
@@ -688,6 +705,16 @@ void ActorDraggableInteractorStyle::SetCurrentImageNumber(int i) {
} }
} }
void ActorDraggableInteractorStyle::SetInteractionModeFromEnum(int InteractionMode)
{
this->UnActiveMeasure();
if (this->InteractionMode == 39 && InteractionMode != 39){
EllipsoidVolumeAnnotationActor::Default()->ClearRenderingState();
this->Interactor->Render();
}
this->InteractionMode = InteractionMode;
}
void ActorDraggableInteractorStyle::DispatchEvent() { void ActorDraggableInteractorStyle::DispatchEvent() {
} }

View File

@@ -72,10 +72,7 @@ vtkTypeMacro(ActorDraggableInteractorStyle, vtkInteractorStyleImage);
void SetCurrentImageNumber(int i) override; void SetCurrentImageNumber(int i) override;
void SetInteractionModeFromEnum(int InteractionMode) { void SetInteractionModeFromEnum(int InteractionMode);
this->UnActiveMeasure();
this->InteractionMode = InteractionMode;
}
//void SetInteractionModeToImageSlicing() { //void SetInteractionModeToImageSlicing() {
// this->UnActiveMeasure(); // this->UnActiveMeasure();
@@ -172,6 +169,8 @@ protected:
void MeasurePlace(); void MeasurePlace();
void VolumeMeasure();
void NoneStatePick(); void NoneStatePick();
void StartSyncSlicePoint(); void StartSyncSlicePoint();