Fraxinus  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 //---------------------------------------------------------
boost::shared_ptr< class Texture3DSlicerRep > Texture3DSlicerRepPtr
ViewPtr getView() const
Definition: cxRepImpl.cpp:83
Transform3D Transform3D
Transform3D is a representation of an affine 3D transform.
boost::shared_ptr< class SliceProxy > SliceProxyPtr
void setRenderWindow(vtkRenderWindowPtr window)
virtual void printSelf(std::ostream &os, Indent indent)
void setSliceProxy(SliceProxyPtr slicer)
static boost::shared_ptr< REP > wrap_new(REP *object, QString uid)
Definition: cxRepImpl.h:62
vtkSmartPointer< class vtkRenderWindow > vtkRenderWindowPtr
Texture3DSlicerRep(SharedOpenGLContextPtr context)
boost::shared_ptr< class View > ViewPtr
void setShaderPath(QString path)
virtual void removeRepActorsFromViewRenderer(ViewPtr view)
boost::shared_ptr< class SharedOpenGLContext > SharedOpenGLContextPtr
std::vector< ImagePtr > getImages()
virtual QString getType() const
static Texture3DSlicerRepPtr New(SharedOpenGLContextPtr context, const QString &uid="")
Formatting class for debug printing of the ssc library.
Definition: cxIndent.h:28
Default implementation of Rep.
Definition: cxRepImpl.h:42
void setImages(std::vector< ImagePtr > images)
Representation of a floating-point bounding box in 3D. The data are stored as {xmin,xmax,ymin,ymax,zmin,zmax}, in order to simplify communication with vtk.
virtual void addRepActorsToViewRenderer(ViewPtr view)
static bool isSupported(vtkRenderWindowPtr window)
static bool isSupported(vtkRenderWindowPtr window)
void setViewportData(const Transform3D &vpMs, const DoubleBoundingBox3D &vp)
static Texture3DSlicerProxyPtr New(SharedOpenGLContextPtr context)
Namespace for all CustusX production code.