Add orientation marker size and position logic.
This commit is contained in:
@@ -131,6 +131,10 @@ VolumeRenderingViewer::~VolumeRenderingViewer() {
|
|||||||
this->InteractorStyle->Delete();
|
this->InteractorStyle->Delete();
|
||||||
this->InteractorStyle = nullptr;
|
this->InteractorStyle = nullptr;
|
||||||
}
|
}
|
||||||
|
if (this->OrientationMarker) {
|
||||||
|
this->OrientationMarker->Delete();
|
||||||
|
this->OrientationMarker = nullptr;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void VolumeRenderingViewer::InstallPipeline() {
|
void VolumeRenderingViewer::InstallPipeline() {
|
||||||
@@ -159,11 +163,6 @@ void VolumeRenderingViewer::InstallPipeline() {
|
|||||||
Renderer->AddObserver(vtkCommand::EndEvent,this, &VolumeRenderingViewer::renderAnnotation);
|
Renderer->AddObserver(vtkCommand::EndEvent,this, &VolumeRenderingViewer::renderAnnotation);
|
||||||
this->Renderer->SetBackground(0.0, 0.0, 0.0);
|
this->Renderer->SetBackground(0.0, 0.0, 0.0);
|
||||||
}
|
}
|
||||||
if (this->OrientationMarker && this->OrientationMarker->GetOrientationMarker()){
|
|
||||||
this->OrientationMarker->SetInteractor(this->Interactor);
|
|
||||||
this->OrientationMarker->EnabledOn();
|
|
||||||
this->OrientationMarker->InteractiveOn();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void VolumeRenderingViewer::UnInstallPipeline() {
|
void VolumeRenderingViewer::UnInstallPipeline() {
|
||||||
@@ -188,11 +187,6 @@ void VolumeRenderingViewer::UnInstallPipeline() {
|
|||||||
this->Interactor->SetInteractorStyle(nullptr);
|
this->Interactor->SetInteractorStyle(nullptr);
|
||||||
this->Interactor->SetRenderWindow(nullptr);
|
this->Interactor->SetRenderWindow(nullptr);
|
||||||
}
|
}
|
||||||
if (this->OrientationMarker){
|
|
||||||
this->OrientationMarker->SetInteractor(nullptr);
|
|
||||||
this->OrientationMarker->EnabledOff();
|
|
||||||
this->OrientationMarker->InteractiveOff();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void VolumeRenderingViewer::SetupInteractor(vtkRenderWindowInteractor * arg) {
|
void VolumeRenderingViewer::SetupInteractor(vtkRenderWindowInteractor * arg) {
|
||||||
@@ -264,6 +258,11 @@ void VolumeRenderingViewer::Render() {
|
|||||||
RenderWindow->SetDesiredUpdateRate(Interactor->GetDesiredUpdateRate());
|
RenderWindow->SetDesiredUpdateRate(Interactor->GetDesiredUpdateRate());
|
||||||
Interactor->InvokeEvent(vtkCommand::StartInteractionEvent, nullptr);
|
Interactor->InvokeEvent(vtkCommand::StartInteractionEvent, nullptr);
|
||||||
SetViewDirection(0);
|
SetViewDirection(0);
|
||||||
|
this->OrientationMarker->RemoveAllObservers();
|
||||||
|
this->OrientationMarker->SetInteractor(this->Interactor);
|
||||||
|
this->OrientationMarker->EnabledOn();
|
||||||
|
this->OrientationMarker->InteractiveOff();
|
||||||
|
this->RenderWindow->AddObserver(vtkCommand::WindowResizeEvent, this, &VolumeRenderingViewer::resizeOrientationMarker);
|
||||||
Render();
|
Render();
|
||||||
}
|
}
|
||||||
Interactor->Render();
|
Interactor->Render();
|
||||||
@@ -401,7 +400,6 @@ void VolumeRenderingViewer::SetCoordsTransformMatrix(ExtendMedicalImagePropertie
|
|||||||
//冠状面
|
//冠状面
|
||||||
case 1:
|
case 1:
|
||||||
{
|
{
|
||||||
vtkErrorMacro("coronal")
|
|
||||||
cube->SetZFaceTextRotation(-90);
|
cube->SetZFaceTextRotation(-90);
|
||||||
cube->SetXFaceTextRotation(90);
|
cube->SetXFaceTextRotation(90);
|
||||||
cube->SetYFaceTextRotation(180);
|
cube->SetYFaceTextRotation(180);
|
||||||
@@ -410,7 +408,6 @@ void VolumeRenderingViewer::SetCoordsTransformMatrix(ExtendMedicalImagePropertie
|
|||||||
//矢状面
|
//矢状面
|
||||||
case 0:
|
case 0:
|
||||||
{
|
{
|
||||||
vtkErrorMacro("sagittal")
|
|
||||||
cube->SetZFaceTextRotation(-90);
|
cube->SetZFaceTextRotation(-90);
|
||||||
cube->SetXFaceTextRotation(90);
|
cube->SetXFaceTextRotation(90);
|
||||||
cube->SetYFaceTextRotation(-90);
|
cube->SetYFaceTextRotation(-90);
|
||||||
@@ -419,7 +416,6 @@ void VolumeRenderingViewer::SetCoordsTransformMatrix(ExtendMedicalImagePropertie
|
|||||||
case 2:
|
case 2:
|
||||||
default:
|
default:
|
||||||
{
|
{
|
||||||
vtkErrorMacro("transverse")
|
|
||||||
cube->SetZFaceTextRotation(-90);
|
cube->SetZFaceTextRotation(-90);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -428,9 +424,6 @@ void VolumeRenderingViewer::SetCoordsTransformMatrix(ExtendMedicalImagePropertie
|
|||||||
cube->GetTextEdgesProperty()->SetLineWidth(2.0);
|
cube->GetTextEdgesProperty()->SetLineWidth(2.0);
|
||||||
cube->GetCubeProperty()->SetColor(.0,.0,1.0);
|
cube->GetCubeProperty()->SetColor(.0,.0,1.0);
|
||||||
OrientationMarker->SetOrientationMarker(cube);
|
OrientationMarker->SetOrientationMarker(cube);
|
||||||
this->OrientationMarker->SetInteractor(this->Interactor);
|
|
||||||
this->OrientationMarker->EnabledOn();
|
|
||||||
this->OrientationMarker->InteractiveOn();
|
|
||||||
}
|
}
|
||||||
//change to WToM
|
//change to WToM
|
||||||
OrientationMatrix->Invert();
|
OrientationMatrix->Invert();
|
||||||
@@ -542,3 +535,8 @@ void VolumeRenderingViewer::ResetMaximumImageSampleDistance() {
|
|||||||
mapper->SetMaximumImageSampleDistance(4.0);
|
mapper->SetMaximumImageSampleDistance(4.0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void VolumeRenderingViewer::resizeOrientationMarker() {
|
||||||
|
int *size = this->Renderer->GetSize();
|
||||||
|
this->OrientationMarker->SetViewport(1.0-(80.0/(double)size[0]),1.0-(80.0/(double)size[1]),1.0,1.0);
|
||||||
|
}
|
||||||
|
|||||||
@@ -127,6 +127,7 @@ private:
|
|||||||
int a;
|
int a;
|
||||||
return GetDirectionChar(directionVector, a);
|
return GetDirectionChar(directionVector, a);
|
||||||
}
|
}
|
||||||
|
void resizeOrientationMarker();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user