Move VTKIS_ MODE to Define header ,move DraggableStyleEvents to Define header.
This commit is contained in:
@@ -12,7 +12,6 @@
|
||||
|
||||
#define aLLEventMacro() \
|
||||
_add_Event(DefaultEvent)\
|
||||
_add_Event(DragEvent)\
|
||||
_add_Event(SyncStateChanged)\
|
||||
_add_Event(AnnotationStateChanged)\
|
||||
_add_Event(AnonymizeStateChanged)\
|
||||
|
||||
@@ -13,15 +13,7 @@
|
||||
#include "functional"
|
||||
#include "vtkCornerAnnotation.h"
|
||||
#include "vtkCommand.h"
|
||||
|
||||
#define VTKIS_DRAG 33
|
||||
#define VTKIS_MEASURE 36
|
||||
#define VTKIS_COLORMAP 37
|
||||
|
||||
#define VTKIS_IMAGE_PAN 5
|
||||
#define VTKIS_IMAGE_ZOOM 6
|
||||
#define VTKIS_IMAGE_WINDOWLEVEL 7
|
||||
|
||||
#include "Rendering/Core/RenderingDefines.h"
|
||||
|
||||
class vtkProp;
|
||||
|
||||
@@ -35,22 +27,7 @@ public:
|
||||
|
||||
vtkTypeMacro(ActorDraggableInteractorStyle, vtkInteractorStyleImage);
|
||||
|
||||
enum DraggableStyleEvents {
|
||||
DragEvent = vtkCommand::UserEvent + 300,
|
||||
DragEndEvent,
|
||||
StartMeasureEvent,
|
||||
EndMeasureEvent,
|
||||
SliceEvent,
|
||||
SlicedEvent,
|
||||
EndDollyEvent,
|
||||
PopPropEvent,
|
||||
DoubleClickEvent,
|
||||
DeleteMeasureEvent,
|
||||
RightButtonClickEvent,
|
||||
ScalarOpacityEvent,
|
||||
ScalarShiftEvent,
|
||||
AfterViewerClicked
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Called when the user moves the mouse
|
||||
|
||||
@@ -39,23 +39,23 @@ void VolumeInteractorStyle::OnLeftButtonDown() {
|
||||
|
||||
this->GrabFocus(this->EventCallbackCommand);
|
||||
switch(this->InteractionMode) {
|
||||
case VOLUME_ROTATE3D: {
|
||||
case VTKIS_VOLUME_ROTATE3D: {
|
||||
this->StartRotate();
|
||||
break;
|
||||
}
|
||||
case VOLUME_PAN: {
|
||||
case VTKIS_VOLUME_PAN: {
|
||||
this->StartPan();
|
||||
break;
|
||||
}
|
||||
case VOLUME_ROTATE2D: {
|
||||
case VTKIS_VOLUME_ROTATE2D: {
|
||||
this->StartSpin();
|
||||
break;
|
||||
}
|
||||
case VOLUME_ZOOM: {
|
||||
case VTKIS_VOLUME_ZOOM: {
|
||||
this->StartDolly();
|
||||
break;
|
||||
}
|
||||
case VOLUME_WINDOW: {
|
||||
case VTKIS_VOLUME_WINDOW: {
|
||||
this->WindowLevelStartPosition[0] = x;
|
||||
this->WindowLevelStartPosition[1] = y;
|
||||
this->StartWindowLevel();
|
||||
@@ -66,7 +66,7 @@ void VolumeInteractorStyle::OnLeftButtonDown() {
|
||||
|
||||
void VolumeInteractorStyle::OnLeftButtonUp() {
|
||||
switch (this->State) {
|
||||
case VTKIS_WINDOW_LEVEL:
|
||||
case VTKIS_VOLUME_WINDOW:
|
||||
this->EndWindowLevel();
|
||||
if (this->Interactor) {
|
||||
this->ReleaseFocus();
|
||||
@@ -81,7 +81,7 @@ void VolumeInteractorStyle::StartWindowLevel() {
|
||||
{
|
||||
return;
|
||||
}
|
||||
this->StartState(VTKIS_WINDOW_LEVEL);
|
||||
this->StartState(VTKIS_VOLUME_WINDOW);
|
||||
|
||||
if (this->HandleObservers &&
|
||||
this->HasObserver(vtkCommand::StartWindowLevelEvent))
|
||||
@@ -101,7 +101,7 @@ void VolumeInteractorStyle::StartWindowLevel() {
|
||||
}
|
||||
|
||||
void VolumeInteractorStyle::EndWindowLevel() {
|
||||
if (this->State != VTKIS_WINDOW_LEVEL)
|
||||
if (this->State != VTKIS_VOLUME_WINDOW)
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -115,11 +115,9 @@ void VolumeInteractorStyle::EndWindowLevel() {
|
||||
void VolumeInteractorStyle::OnMouseMove() {
|
||||
int x = this->Interactor->GetEventPosition()[0];
|
||||
int y = this->Interactor->GetEventPosition()[1];
|
||||
|
||||
switch (this->State)
|
||||
{
|
||||
case VTKIS_WINDOW_LEVEL:
|
||||
this->FindPokedRenderer(x, y);
|
||||
switch (this->State) {
|
||||
case VTKIS_VOLUME_WINDOW:
|
||||
this->FindPokedRenderer(x,y);
|
||||
this->WindowLevel();
|
||||
this->InvokeEvent(vtkCommand::InteractionEvent, nullptr);
|
||||
break;
|
||||
|
||||
@@ -6,14 +6,7 @@
|
||||
#define OMEGAV_VOLUMEINTERACTORSTYLE_H
|
||||
|
||||
#include <vtkInteractorStyleTrackballCamera.h>
|
||||
|
||||
#define VOLUME_ROTATE3D 0
|
||||
#define VOLUME_ROTATE2D 1
|
||||
#define VOLUME_ZOOM 2
|
||||
#define VOLUME_PAN 3
|
||||
#define VOLUME_WINDOW 4
|
||||
|
||||
#define VTKIS_WINDOW_LEVEL 1024
|
||||
#include "Rendering/Core/RenderingDefines.h"
|
||||
|
||||
class vtkVolumeProperty;
|
||||
|
||||
|
||||
40
src/src/Rendering/Core/RenderingDefines.h
Normal file
40
src/src/Rendering/Core/RenderingDefines.h
Normal file
@@ -0,0 +1,40 @@
|
||||
//
|
||||
// Created by Krad on 2022/11/3.
|
||||
//
|
||||
|
||||
#ifndef OMEGAV_DEFINES_H
|
||||
#define OMEGAV_DEFINES_H
|
||||
|
||||
#include <vtkCommand.h>
|
||||
|
||||
#define VTKIS_DRAG 33
|
||||
#define VTKIS_MEASURE 36
|
||||
#define VTKIS_COLORMAP 37
|
||||
#define VTKIS_IMAGE_PAN 5
|
||||
#define VTKIS_IMAGE_ZOOM 6
|
||||
#define VTKIS_IMAGE_WINDOWLEVEL 7
|
||||
#define VTKIS_VOLUME_ROTATE3D 0
|
||||
#define VTKIS_VOLUME_ROTATE2D 1
|
||||
#define VTKIS_VOLUME_ZOOM 2
|
||||
#define VTKIS_VOLUME_PAN 3
|
||||
#define VTKIS_VOLUME_WINDOW 7
|
||||
|
||||
enum DraggableStyleEvents {
|
||||
DragEvent = vtkCommand::UserEvent + 1200,
|
||||
DragEndEvent,
|
||||
StartMeasureEvent,
|
||||
EndMeasureEvent,
|
||||
SliceEvent,
|
||||
SlicedEvent,
|
||||
EndDollyEvent,
|
||||
PopPropEvent,
|
||||
DoubleClickEvent,
|
||||
DeleteMeasureEvent,
|
||||
RightButtonClickEvent,
|
||||
ScalarOpacityEvent,
|
||||
ScalarShiftEvent,
|
||||
AfterViewerClicked
|
||||
};
|
||||
|
||||
|
||||
#endif //OMEGAV_DEFINES_H
|
||||
@@ -34,7 +34,7 @@ RulerAnnotationActor::RulerAnnotationActor() {
|
||||
//textProperty->SetFrameColor(1.0,0.0,0.0);
|
||||
textProperty->SetBackgroundColor(1.0, 0.0, 0.0);
|
||||
textProperty->SetBackgroundOpacity(0.3);
|
||||
this->AddObserver(ActorDraggableInteractorStyle::DraggableStyleEvents::RightButtonClickEvent, this,
|
||||
this->AddObserver(DraggableStyleEvents::RightButtonClickEvent, this,
|
||||
&RulerAnnotationActor::selfCalibCb);
|
||||
}
|
||||
|
||||
|
||||
@@ -68,7 +68,7 @@ TextAnnotationActor::TextAnnotationActor() {
|
||||
BaseDataPoints->SetPoint(1, 512, 512, 0);
|
||||
renderPoints->SetNumberOfPoints(2);
|
||||
this->AddObserver(DraggableActorEvents::DragEvent, this, &TextAnnotationActor::selfDragCb);
|
||||
this->AddObserver(ActorDraggableInteractorStyle::DraggableStyleEvents::PopPropEvent, this,
|
||||
this->AddObserver(DraggableStyleEvents::PopPropEvent, this,
|
||||
&TextAnnotationActor::selfPickCb);
|
||||
text = vtkActor2D::New();
|
||||
vtkNew<vtkTextMapper> textMapper;
|
||||
|
||||
@@ -296,17 +296,17 @@ void DICOMImageViewer::InstallPipeline() {
|
||||
this->InteractorStyle->SetCurrentImageNumber(0);
|
||||
this->InteractorStyle->SetCornerAnnotation(cornerAnnotation);
|
||||
|
||||
this->InteractorStyle->AddObserver(ActorDraggableInteractorStyle::DraggableStyleEvents::EndMeasureEvent,
|
||||
this->InteractorStyle->AddObserver(DraggableStyleEvents::EndMeasureEvent,
|
||||
this, &DICOMImageViewer::AddMeasures);
|
||||
this->InteractorStyle->AddObserver(ActorDraggableInteractorStyle::DraggableStyleEvents::DeleteMeasureEvent,
|
||||
this->InteractorStyle->AddObserver(DraggableStyleEvents::DeleteMeasureEvent,
|
||||
this, &DICOMImageViewer::RemoveMeasures);
|
||||
this->InteractorStyle->AddObserver(ActorDraggableInteractorStyle::DraggableStyleEvents::SliceEvent, this,
|
||||
this->InteractorStyle->AddObserver(DraggableStyleEvents::SliceEvent, this,
|
||||
&DICOMImageViewer::ChangeSlice);
|
||||
|
||||
//for convert vtkEvent to Qt signal
|
||||
this->InteractorStyle->AddObserver(ActorDraggableInteractorStyle::DraggableStyleEvents::SlicedEvent, this,
|
||||
this->InteractorStyle->AddObserver(DraggableStyleEvents::SlicedEvent, this,
|
||||
&DICOMImageViewer::raiseEvent);
|
||||
this->InteractorStyle->AddObserver(ActorDraggableInteractorStyle::DraggableStyleEvents::EndDollyEvent, this,
|
||||
this->InteractorStyle->AddObserver(DraggableStyleEvents::EndDollyEvent, this,
|
||||
&DICOMImageViewer::raiseEvent);
|
||||
this->InteractorStyle->AddObserver(vtkCommand::EventIds::EndWindowLevelEvent, this,
|
||||
&DICOMImageViewer::raiseEvent);
|
||||
@@ -478,7 +478,7 @@ void DICOMImageViewer::SetSlice(int slice) {
|
||||
double focusPoint[5] = {.0, .0, .0 };
|
||||
GetSlicePoint(focusPoint);
|
||||
double sliceData[5] ={focusPoint[0], focusPoint[1], focusPoint[2], offset, direction};
|
||||
InteractorStyle->InvokeEvent(ActorDraggableInteractorStyle::SlicedEvent, sliceData);
|
||||
InteractorStyle->InvokeEvent(SlicedEvent, sliceData);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -170,11 +170,11 @@ void DicomImageView::loadSeries(SeriesImageSet *series) {
|
||||
//目前 替换了一部分包括SlicedEvent,EndDollyEvent,EndWindowLevelEvent,EndPanEvent,主要关联到sync
|
||||
|
||||
ActorDraggableInteractorStyle *style = mImageViewer->GetInteractorStyle();
|
||||
style->AddObserver(ActorDraggableInteractorStyle::AfterViewerClicked, this, &DicomImageView::clicked);
|
||||
style->AddObserver(AfterViewerClicked, this, &DicomImageView::clicked);
|
||||
style->AddObserver(vtkCommand::EventIds::WindowLevelEvent, this, &DicomImageView::windowLevelHandle);
|
||||
style->AddObserver(ActorDraggableInteractorStyle::DoubleClickEvent, this, &DicomImageView::doubleClickHandle);
|
||||
style->AddObserver(ActorDraggableInteractorStyle::ScalarOpacityEvent, this, &DicomImageView::scalarEventHandle);
|
||||
style->AddObserver(ActorDraggableInteractorStyle::ScalarShiftEvent, this, &DicomImageView::scalarEventHandle);
|
||||
style->AddObserver(DoubleClickEvent, this, &DicomImageView::doubleClickHandle);
|
||||
style->AddObserver(ScalarOpacityEvent, this, &DicomImageView::scalarEventHandle);
|
||||
style->AddObserver(ScalarShiftEvent, this, &DicomImageView::scalarEventHandle);
|
||||
|
||||
}
|
||||
initScrollbar();
|
||||
@@ -410,12 +410,12 @@ void DicomImageView::windowLevelHandle() {
|
||||
void DicomImageView::scalarEventHandle(vtkObject *, unsigned long eventId, void *calldata) {
|
||||
double *r = (double *) calldata;
|
||||
switch (eventId) {
|
||||
case (ActorDraggableInteractorStyle::ScalarShiftEvent):
|
||||
case (ScalarShiftEvent):
|
||||
qDebug() << "ScalarShiftEvent";
|
||||
mImageViewer->SwitchToNextPreset();
|
||||
|
||||
break;
|
||||
case (ActorDraggableInteractorStyle::ScalarOpacityEvent):
|
||||
case (ScalarOpacityEvent):
|
||||
qDebug() << "ScalarOpacityEvent" << r[0];
|
||||
setFusionOpacity(r[0]);
|
||||
break;
|
||||
@@ -444,11 +444,11 @@ void DicomImageView::dispatchEvent(vtkObject *, unsigned long eid, void *callDat
|
||||
mImageViewer->GetColorWindow());
|
||||
break;
|
||||
}
|
||||
case (ActorDraggableInteractorStyle::DraggableStyleEvents::EndDollyEvent):{
|
||||
case (DraggableStyleEvents::EndDollyEvent):{
|
||||
emit onEndZoom(this, (double *) callData);
|
||||
break;
|
||||
}
|
||||
case (ActorDraggableInteractorStyle::DraggableStyleEvents::SlicedEvent): {
|
||||
case (DraggableStyleEvents::SlicedEvent): {
|
||||
mScrollBar->SetValueSilently(mImageViewer->GetSlice());
|
||||
//invoke event
|
||||
emit onSlice(this, callData);
|
||||
|
||||
@@ -70,7 +70,7 @@ VolumeRenderingToolBar::VolumeRenderingToolBar(QWidget *parent) : QToolBar(paren
|
||||
group->addButton(btnRotate,1);
|
||||
group->addButton(btnZoom,2);
|
||||
group->addButton(btnPan,3);
|
||||
group->addButton(btnWindow,1024);
|
||||
group->addButton(btnWindow,7);
|
||||
group->setExclusive(true);
|
||||
|
||||
connect(group, static_cast<void(QButtonGroup::*)(int)>(&QButtonGroup::buttonClicked),this,&VolumeRenderingToolBar::modeButtonClicked);
|
||||
|
||||
Reference in New Issue
Block a user