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