first commit
This commit is contained in:
233
src/include/view/dicomimageview.h
Normal file
233
src/include/view/dicomimageview.h
Normal file
@@ -0,0 +1,233 @@
|
||||
#pragma once
|
||||
#include <QFrame>
|
||||
#include <QOpenGLWidget>
|
||||
#include <QScrollBar>
|
||||
#include <QGridLayout>
|
||||
#include "base/SeriesInstance.h"
|
||||
#include "view/myQVTKOpenGLNativeWidget.h"
|
||||
|
||||
#include <QThread>
|
||||
class infinitiViewer;
|
||||
class vtkCornerAnnotation;
|
||||
class vtkGenericOpenGLRenderWindow;
|
||||
class MyTitleBar;
|
||||
class pqVCRController;
|
||||
class pqVCRToolbar;
|
||||
|
||||
|
||||
namespace scrollScope {
|
||||
enum TriggerType
|
||||
{
|
||||
USER_TRIGGER, //a,b,c
|
||||
STYLE_TRIGGER,//b,c
|
||||
SYNC_ONLY,//do nothing
|
||||
};
|
||||
}
|
||||
class DicomImageView : public QFrame
|
||||
{
|
||||
Q_OBJECT
|
||||
typedef QOpenGLWidget Superclass;
|
||||
public:
|
||||
//a:real effect
|
||||
//b:corner info update
|
||||
//c:scroll value sync
|
||||
explicit DicomImageView(QWidget* parent = Q_NULLPTR);
|
||||
~DicomImageView() override;
|
||||
|
||||
|
||||
void ShowMetaData();
|
||||
myQVTKOpenGLNativeWidget* getGLWidget()
|
||||
{
|
||||
return _glWidt;
|
||||
}
|
||||
vtkGenericOpenGLRenderWindow* getRenWin()
|
||||
{
|
||||
return m_glrenWin;
|
||||
}
|
||||
infinitiViewer* getImageViewer()
|
||||
{
|
||||
return _ImageViewer;
|
||||
}
|
||||
|
||||
void setScrollChangedType(int type)
|
||||
{
|
||||
_ScrollTriggerType = type;
|
||||
}
|
||||
void setHighlight(bool yes);
|
||||
void Render();
|
||||
|
||||
//Series
|
||||
void setDicomImageView(SeriesInstance *series);
|
||||
bool HasSeries();
|
||||
int getSeriesNumber();
|
||||
SeriesInstance* getSeriesInstance()
|
||||
{
|
||||
return _Series;
|
||||
}
|
||||
|
||||
//Reset
|
||||
void ResetView();
|
||||
|
||||
|
||||
//Corner Info
|
||||
void updateCornerInfoAll();
|
||||
void updateCornerInfoPrivacy();
|
||||
|
||||
//Window level
|
||||
void getWindowLevel(double &level, double &width);
|
||||
void setWindowLevel(double level, double width);
|
||||
|
||||
//Transformation
|
||||
void ClearTransformations();
|
||||
void HFlip();
|
||||
void VFlip();
|
||||
void Rotate(double angle, TransFormType operation);
|
||||
|
||||
|
||||
//Fusion
|
||||
bool IsFusion();
|
||||
void IncreFusionOpacity(double percent);
|
||||
void SetFusionInput(DicomImageView *overlap);
|
||||
void removeViewWithFusion();
|
||||
|
||||
|
||||
//Measure
|
||||
void ActiveMeasure(Measure *m);
|
||||
void DeleteSelectedMeasure();
|
||||
void DeleteCurrentSliceMeasure();
|
||||
void DeleteCurrentSeriesMeasure();
|
||||
void removeViewWithMeasure();
|
||||
|
||||
|
||||
//Sync slice
|
||||
void AddSlice(int step);
|
||||
void SetSlice(int slice);
|
||||
void SetZoomScale(double scale);
|
||||
void SetPanOffset(double * p);
|
||||
|
||||
//CineMode
|
||||
void onFirstFrame();
|
||||
void onPreviousFrame();
|
||||
void onNextFrame();
|
||||
void onLastFrame();
|
||||
bool IsCine() { return isCine; }
|
||||
void cineModeOn();
|
||||
bool isVCRVisible();
|
||||
void setVCRVisible(bool);
|
||||
void setVCRToolbar(pqVCRToolbar* toolbar)
|
||||
{
|
||||
_vcr_toolbar = toolbar;
|
||||
}
|
||||
pqVCRToolbar* getVCRToolbar()
|
||||
{
|
||||
return _vcr_toolbar;
|
||||
}
|
||||
pqVCRController* getVCRController()
|
||||
{
|
||||
return _vcr_ctrl;
|
||||
}
|
||||
|
||||
//Negative
|
||||
void ToggleNegativeMode();
|
||||
|
||||
|
||||
signals:
|
||||
/**
|
||||
* This signal will be emitted whenever a mouse event occurs within the QVTK window.
|
||||
*/
|
||||
|
||||
void scroll_ValueChanged(int);
|
||||
void Signal_ViewEmpty(DicomImageView *view);
|
||||
void Signal_ViewClicked(DicomImageView *view);
|
||||
void Signal_viewDoubleclicked(DicomImageView *view);
|
||||
void Signal_scrollValueChanged(DicomImageView *view, int slice);
|
||||
void Signal_DragDropEvent(DicomImageView *view,thumbnailImage* tb);
|
||||
void Signal_SyncEvent(DicomImageView *view, int interactionMode,void* calldata);
|
||||
void Signal_WindowLevelEventForFusion(double level,double width);
|
||||
void Signal_Transformation(TransFormType);
|
||||
|
||||
public slots:
|
||||
//for title bar use
|
||||
void Slot_viewDoubleclicked();
|
||||
void Slot_ViewEmpty();
|
||||
void Slot_scrollValueChanged(int);
|
||||
void Slot_WindowLevelEventForFusion(double level, double width);
|
||||
void Slot_UpdateOrienInfo(TransFormType);
|
||||
|
||||
protected:
|
||||
void mousePressEvent(QMouseEvent* event) Q_DECL_OVERRIDE;
|
||||
void mouseMoveEvent(QMouseEvent* event) Q_DECL_OVERRIDE;
|
||||
void mouseReleaseEvent(QMouseEvent* event) Q_DECL_OVERRIDE;
|
||||
void mouseDoubleClickEvent(QMouseEvent* event) Q_DECL_OVERRIDE;
|
||||
void wheelEvent(QWheelEvent *event) Q_DECL_OVERRIDE;
|
||||
|
||||
void dragEnterEvent(QDragEnterEvent *e);
|
||||
void dragMoveEvent(QDragMoveEvent *e);
|
||||
void dropEvent(QDropEvent *e);
|
||||
void dragLeaveEvent(QDragLeaveEvent *e);
|
||||
void resizeEvent(QResizeEvent *event);
|
||||
|
||||
|
||||
private:
|
||||
void removeFusion();
|
||||
|
||||
void OverlayOn()
|
||||
{
|
||||
isOverlay = true;
|
||||
}
|
||||
void OverlayOff()
|
||||
{
|
||||
isOverlay = false;
|
||||
}
|
||||
bool IsOverlay()
|
||||
{
|
||||
return isOverlay;
|
||||
}
|
||||
void SetBaseView(DicomImageView *v)
|
||||
{
|
||||
_base = v;
|
||||
}
|
||||
void SetOverlayView(DicomImageView *v)
|
||||
{
|
||||
_overlay = v;
|
||||
}
|
||||
|
||||
|
||||
|
||||
//Callback
|
||||
void doubleclickedEventCb(vtkObject* sender, unsigned long eventId, void* calldata = nullptr);
|
||||
void scalarEventCb(vtkObject* sender, unsigned long eventId, void* calldata = nullptr);
|
||||
void updateWindowLevelCb(vtkObject*caller, unsigned long eid, void *calldata);
|
||||
void syncEventFunc(vtkObject*caller, unsigned long eid, void *calldata);
|
||||
|
||||
|
||||
void initCineModeThread();
|
||||
MyTitleBar* createMyTitleBar();
|
||||
void orphanizeSeriesInstance();
|
||||
void ResetPanZoom();
|
||||
|
||||
//bool deleteOlderSeries(SeriesInstance* old);
|
||||
void initScrollbar();
|
||||
void CopyFromSeries(SeriesInstance *series);
|
||||
|
||||
vtkSmartPointer <vtkGenericOpenGLRenderWindow> m_glrenWin;
|
||||
|
||||
infinitiViewer* _ImageViewer = nullptr;
|
||||
SeriesInstance* _Series =nullptr;
|
||||
QScrollBar* _scrollBar =nullptr;
|
||||
MyTitleBar *_titleBar =nullptr;
|
||||
myQVTKOpenGLNativeWidget* _glWidt = nullptr;
|
||||
pqVCRToolbar* _vcr_toolbar = nullptr;
|
||||
pqVCRController *_vcr_ctrl = nullptr;
|
||||
QThread _thread;
|
||||
DicomImageView *_overlay = nullptr;
|
||||
DicomImageView *_base = nullptr;
|
||||
|
||||
int _SliceStep =0;
|
||||
int _PrevSlice =0;
|
||||
int _ScrollTriggerType = scrollScope::TriggerType::USER_TRIGGER;
|
||||
|
||||
bool isCine = false;
|
||||
bool isNegative = false;
|
||||
bool isOverlay = false;
|
||||
};
|
||||
Reference in New Issue
Block a user