NorMIT-nav  2023.01.05-dev+develop.0da12
An IGT application
cxTexture3DSlicerRep.cpp
Go to the documentation of this file.
1 /*=========================================================================
2 This file is part of CustusX, an Image Guided Therapy Application.
3 
4 Copyright (c) SINTEF Department of Medical Technology.
5 All rights reserved.
6 
7 CustusX is released under a BSD 3-Clause license.
8 
9 See Lisence.txt (https://github.com/SINTEFMedtek/CustusX/blob/master/License.txt) for details.
10 =========================================================================*/
11 
12 
13 #include "cxTexture3DSlicerRep.h"
14 
15 #include <vtkRenderer.h>
16 #include <vtkFloatArray.h>
17 #include <vtkPlaneSource.h>
18 #include <vtkPointData.h>
19 #include <vtkTriangleFilter.h>
20 #include <vtkStripper.h>
21 #include <vtkImageData.h>
22 #include <vtkLookupTable.h>
23 
24 #include "cxImage.h"
25 #include "cxView.h"
26 #include "cxImageLUT2D.h"
27 #include "cxSliceProxy.h"
28 #include "cxTypeConversions.h"
29 #include "cxGPUImageBuffer.h"
30 #include "cxTexture3DSlicerProxy.h"
31 
32 #include "cxSharedOpenGLContext.h"
33 
34 //---------------------------------------------------------
35 namespace cx
36 {
37 //---------------------------------------------------------
38 
40 {
41  mProxy->setTargetSpaceToR();
42 }
43 
45  RepImpl()
46 {
47  mProxy = Texture3DSlicerProxy::New(context);
48 }
49 
51 {
52 }
53 
55 {
56  return "Texture3DSlicerRep";
57 }
58 
60 {
61  return wrap_new(new Texture3DSlicerRep(context), uid);
62 }
63 
65 {
66  mProxy->setShaderPath(path);
67 }
68 
69 void Texture3DSlicerRep::viewChanged()
70 {
71  if (!this->getView())
72  return;
73  if (this->getView()->getZoomFactor() < 0)
74  return; // ignore if zoom is invalid
75  mProxy->setViewportData(this->getView()->get_vpMs(), this->getView()->getViewport());
76 }
77 
78 void Texture3DSlicerRep::setImages(std::vector<ImagePtr> images)
79 {
80  mProxy->setImages(images);
81 }
82 
83 std::vector<ImagePtr> Texture3DSlicerRep::getImages()
84 {
85  return mProxy->getImages();
86 }
87 
89 {
90  mProxy->setSliceProxy(slicer);
91 }
92 
94 {
95  view->getRenderer()->AddActor(mProxy->getActor());
96  connect(view.get(), SIGNAL(resized(QSize)), this, SLOT(viewChanged()));
97  this->viewChanged();
98 }
99 
101 {
102  view->getRenderer()->RemoveActor(mProxy->getActor());
103  disconnect(view.get(), SIGNAL(resized(QSize)), this, SLOT(viewChanged()));
104 }
105 
106 void Texture3DSlicerRep::printSelf(std::ostream & os, Indent indent)
107 {
108 
109 }
110 
112 {
113  mProxy->setViewportData(vpMs, vp);
114 }
115 
117 {
118  return Texture3DSlicerProxy::isSupported(window);
119 }
120 
122 {
123  mProxy->setRenderWindow(window);
124 }
125 
126 //---------------------------------------------------------
127 }//end namespace
128 //---------------------------------------------------------
cxSharedOpenGLContext.h
cx::Texture3DSlicerRep::getType
virtual QString getType() const
Definition: cxTexture3DSlicerRep.cpp:54
cx::Texture3DSlicerRep::setTargetSpaceToR
void setTargetSpaceToR()
Definition: cxTexture3DSlicerRep.cpp:39
cx::Texture3DSlicerRepPtr
boost::shared_ptr< class Texture3DSlicerRep > Texture3DSlicerRepPtr
Definition: cxForwardDeclarations.h:103
cx::DoubleBoundingBox3D
Representation of a floating-point bounding box in 3D. The data are stored as {xmin,...
Definition: cxBoundingBox3D.h:63
cx::Texture3DSlicerRep::~Texture3DSlicerRep
virtual ~Texture3DSlicerRep()
Definition: cxTexture3DSlicerRep.cpp:50
vtkRenderWindowPtr
vtkSmartPointer< class vtkRenderWindow > vtkRenderWindowPtr
Definition: vtkForwardDeclarations.h:124
cxTexture3DSlicerRep.h
cx
Namespace for all CustusX production code.
Definition: cx_dev_group_definitions.h:13
cxImage.h
cx::Texture3DSlicerRep::removeRepActorsFromViewRenderer
virtual void removeRepActorsFromViewRenderer(ViewPtr view)
Definition: cxTexture3DSlicerRep.cpp:100
cx::RepImpl::getView
ViewPtr getView() const
Definition: cxRepImpl.cpp:83
cx::Texture3DSlicerProxy::isSupported
static bool isSupported(vtkRenderWindowPtr window)
Definition: cxTexture3DSlicerProxy.h:75
cx::SliceProxyPtr
boost::shared_ptr< class SliceProxy > SliceProxyPtr
Definition: cxForwardDeclarations.h:96
cx::Texture3DSlicerRep::Texture3DSlicerRep
Texture3DSlicerRep(SharedOpenGLContextPtr context)
Definition: cxTexture3DSlicerRep.cpp:44
cx::Texture3DSlicerRep::setShaderPath
void setShaderPath(QString path)
Definition: cxTexture3DSlicerRep.cpp:64
cx::Texture3DSlicerRep::setRenderWindow
void setRenderWindow(vtkRenderWindowPtr window)
Definition: cxTexture3DSlicerRep.cpp:121
cx::Texture3DSlicerRep::getImages
std::vector< ImagePtr > getImages()
Definition: cxTexture3DSlicerRep.cpp:83
cx::Texture3DSlicerRep::printSelf
virtual void printSelf(std::ostream &os, Indent indent)
Definition: cxTexture3DSlicerRep.cpp:106
cx::Texture3DSlicerRep::setSliceProxy
void setSliceProxy(SliceProxyPtr slicer)
Definition: cxTexture3DSlicerRep.cpp:88
cx::Texture3DSlicerRep::setImages
void setImages(std::vector< ImagePtr > images)
Definition: cxTexture3DSlicerRep.cpp:78
cx::Texture3DSlicerRep::New
static Texture3DSlicerRepPtr New(SharedOpenGLContextPtr context, const QString &uid="")
Definition: cxTexture3DSlicerRep.cpp:59
cx::Transform3D
Transform3D Transform3D
Transform3D is a representation of an affine 3D transform.
Definition: cxLandmarkPatientRegistrationWidget.h:33
cx::Texture3DSlicerRep::addRepActorsToViewRenderer
virtual void addRepActorsToViewRenderer(ViewPtr view)
Definition: cxTexture3DSlicerRep.cpp:93
cxGPUImageBuffer.h
cxTypeConversions.h
cxView.h
cx::ViewPtr
boost::shared_ptr< class View > ViewPtr
Definition: cxForwardDeclarations.h:110
cx::RepImpl
Default implementation of Rep.
Definition: cxRepImpl.h:42
cx::Texture3DSlicerRep::isSupported
static bool isSupported(vtkRenderWindowPtr window)
Definition: cxTexture3DSlicerRep.cpp:116
cx::Texture3DSlicerRep::setViewportData
void setViewportData(const Transform3D &vpMs, const DoubleBoundingBox3D &vp)
Definition: cxTexture3DSlicerRep.cpp:111
cx::Indent
Formatting class for debug printing of the ssc library.
Definition: cxIndent.h:28
cxSliceProxy.h
cxImageLUT2D.h
cx::RepImpl::wrap_new
static boost::shared_ptr< REP > wrap_new(REP *object, QString uid)
Definition: cxRepImpl.h:62
cx::Texture3DSlicerProxy::New
static Texture3DSlicerProxyPtr New(SharedOpenGLContextPtr context)
Definition: cxTexture3DSlicerProxy.cpp:46
cxTexture3DSlicerProxy.h
cx::SharedOpenGLContextPtr
boost::shared_ptr< class SharedOpenGLContext > SharedOpenGLContextPtr
Definition: cxForwardDeclarations.h:166