142 lines
3.1 KiB
C++
142 lines
3.1 KiB
C++
//
|
|
// Created by Krad on 2022/8/9.
|
|
//
|
|
|
|
#ifndef OMEGAV_VOLUMERENDERINGVIEWER_H
|
|
#define OMEGAV_VOLUMERENDERINGVIEWER_H
|
|
|
|
#include "vtkObject.h"
|
|
#include "vtkNew.h"
|
|
#include "vtkMatrix4x4.h"
|
|
|
|
class vtkAlgorithm;
|
|
|
|
class vtkImageData;
|
|
|
|
class vtkInformation;
|
|
|
|
class vtkOrientationMarkerWidget;
|
|
|
|
class vtkRenderWindow;
|
|
|
|
class vtkRenderer;
|
|
|
|
class vtkRenderWindowInteractor;
|
|
|
|
class vtkInteractorStyle;
|
|
|
|
class vtkVolume;
|
|
|
|
class vtkVolumeMapper;
|
|
|
|
class FastCornerAnnotationActor;
|
|
|
|
class ExtendMedicalImageProperties;
|
|
|
|
class VolumeRenderingViewer:public vtkObject {
|
|
public:
|
|
static VolumeRenderingViewer *New();
|
|
|
|
vtkTypeMacro(VolumeRenderingViewer, vtkObject);
|
|
|
|
virtual void Render();
|
|
|
|
//@{
|
|
/**
|
|
* Set/Get the input image to the viewer.
|
|
*/
|
|
virtual void SetInputData(vtkImageData *in);
|
|
|
|
virtual vtkImageData *GetInput();
|
|
|
|
void SetCoordsTransformMatrix(ExtendMedicalImageProperties *pSeries);
|
|
|
|
//@{
|
|
/**
|
|
* Get the internal render window, renderer, image actor, and
|
|
* image map instances.
|
|
*/
|
|
vtkGetObjectMacro(RenderWindow, vtkRenderWindow);
|
|
|
|
vtkGetObjectMacro(Renderer, vtkRenderer);
|
|
|
|
//@}
|
|
|
|
//@{
|
|
/**
|
|
* Set your own renderwindow and renderer
|
|
*/
|
|
virtual void SetRenderWindow(vtkRenderWindow *arg);
|
|
|
|
virtual void SetRenderer(vtkRenderer *arg);
|
|
//@}
|
|
|
|
/**
|
|
* Attach an interactor for the internal render window.
|
|
*/
|
|
virtual void SetupInteractor(vtkRenderWindowInteractor *);
|
|
|
|
void SetInteractorStyleMode(int mode);
|
|
|
|
void SwitchViewDirection(int direction);
|
|
|
|
void ResetViewDirection(){
|
|
SwitchViewDirection(0);
|
|
}
|
|
|
|
void ResetView(){
|
|
ResetViewDirection();
|
|
ResetZoomFitWindow();
|
|
}
|
|
|
|
void ResetZoomFitWindow();
|
|
|
|
void ActiveMeasure(int type);
|
|
|
|
void UnActiveMeasure();
|
|
|
|
protected:
|
|
VolumeRenderingViewer();
|
|
|
|
~VolumeRenderingViewer() override;
|
|
|
|
virtual void InstallPipeline();
|
|
|
|
virtual void UnInstallPipeline();
|
|
|
|
void renderAnnotation();
|
|
void renderWindowAnnotation();
|
|
void renderOrientationAnnotation();
|
|
private:
|
|
VolumeRenderingViewer(const VolumeRenderingViewer &) = delete;
|
|
void operator=(const VolumeRenderingViewer &) = delete;
|
|
|
|
void DecreaseMaximumImageSampleDistance();
|
|
void ResetMaximumImageSampleDistance();
|
|
|
|
vtkRenderWindow *RenderWindow;
|
|
vtkRenderer *Renderer;
|
|
vtkRenderer *MeasureRenderer;
|
|
vtkVolume * VolumeActor;
|
|
vtkVolumeMapper *VolumeMapper;
|
|
vtkInteractorStyle *InteractorStyle;
|
|
vtkRenderWindowInteractor *Interactor;
|
|
FastCornerAnnotationActor* annotation;
|
|
vtkOrientationMarkerWidget* OrientationMarker;
|
|
vtkNew<vtkMatrix4x4> OrientationMatrix;
|
|
bool gpuMode = false;
|
|
bool firstRender = true;
|
|
|
|
void GetDirectionString(const double *directionVector, std::string &str) const;
|
|
char GetDirectionChar(const double *directionVector, int& worldDirection) const;
|
|
char GetDirectionChar(const double *directionVector) const{
|
|
int a;
|
|
return GetDirectionChar(directionVector, a);
|
|
}
|
|
void pressedOrientationMarker(vtkObject*, unsigned long, void*);
|
|
void resizeOrientationMarker();
|
|
};
|
|
|
|
|
|
#endif //OMEGAV_VOLUMERENDERINGVIEWER_H
|