Fraxinus  16.5.0-fx-rc9
An IGT application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
cxMehdiGPURayCastMultiVolumeRep.h
Go to the documentation of this file.
1 /*=========================================================================
2 This file is part of CustusX, an Image Guided Therapy Application.
3 
4 Copyright (c) 2008-2014, SINTEF Department of Medical Technology
5 All rights reserved.
6 
7 Redistribution and use in source and binary forms, with or without
8 modification, are permitted provided that the following conditions are met:
9 
10 1. Redistributions of source code must retain the above copyright notice,
11  this list of conditions and the following disclaimer.
12 
13 2. Redistributions in binary form must reproduce the above copyright notice,
14  this list of conditions and the following disclaimer in the documentation
15  and/or other materials provided with the distribution.
16 
17 3. Neither the name of the copyright holder nor the names of its contributors
18  may be used to endorse or promote products derived from this software
19  without specific prior written permission.
20 
21 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
22 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
24 DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
25 FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26 DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
27 SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
28 CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
29 OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 =========================================================================*/
32 #ifndef CXMEHDIGPURAYCASTMULTIVOLUMEREP_H
33 #define CXMEHDIGPURAYCASTMULTIVOLUMEREP_H
34 
35 #include "cxResourceVisualizationExport.h"
36 
37 #include "cxRepImpl.h"
38 #include "cxForwardDeclarations.h"
39 #include <vector>
40 #include "vtkForwardDeclarations.h"
41 
42 #include "cxConfig.h"
43 
44 #include "cxImageMapperMonitor.h"
45 
46 typedef vtkSmartPointer<class vtkOpenGLGPUMultiVolumeRayCastMapper> vtkOpenGLGPUMultiVolumeRayCastMapperPtr;
47 
48 
49 namespace cx
50 {
51 
52 
53 typedef boost::shared_ptr<class ImageEnveloper> ImageEnveloperPtr;
54 typedef boost::shared_ptr<class MehdiGPURayCastMultiVolumeRep> MehdiGPURayCastMultiVolumeRepPtr;
55 typedef boost::shared_ptr<class VolumeProperty> VolumePropertyPtr;
56 typedef boost::shared_ptr<class ImageMapperMonitor> ImageMapperMonitorPtr;
57 
58 class cxResourceVisualization_EXPORT MehdiGPURayCastMultiVolumeRepImageMapperMonitor : public ImageMapperMonitor
59 {
60 public:
61  static ImageMapperMonitorPtr create(vtkVolumePtr volume, ImagePtr image, int volumeIndex);
62 protected:
63  virtual void clearClipping();
66  virtual void applyClipping();
67  virtual void applyCropping();
69 private:
71  int mVolumeIndex;
72 };
73 
74 
80 class cxResourceVisualization_EXPORT MehdiGPURayCastMultiVolumeRepBase: public RepImpl
81 {
82 Q_OBJECT
83 public:
86  virtual void setMaxVolumeSize(long maxVoxels);
87 
88 protected:
89  long mMaxVoxels;
90 
91 private slots:
92  virtual void transformChangedSlot() = 0;
93  virtual void vtkImageDataChangedSlot() = 0;
94 };
95 
96 #ifdef CX_BUILD_MEHDI_VTKMULTIVOLUME
97 
106 class cxResourceVisualization_EXPORT MehdiGPURayCastMultiVolumeRep: public MehdiGPURayCastMultiVolumeRepBase
107 {
108  Q_OBJECT
109 public:
110  static MehdiGPURayCastMultiVolumeRepPtr New(QString uid="") { return wrap_new(new MehdiGPURayCastMultiVolumeRep(), uid); }
111  virtual ~MehdiGPURayCastMultiVolumeRep();
112 
113  virtual QString getType() const { return "MehdiGPURayCastMultiVolumeRep"; }
114 
115  void setImages(std::vector<ImagePtr> images);
116 
117 protected:
118  MehdiGPURayCastMultiVolumeRep();
119  virtual void addRepActorsToViewRenderer(View* view);
120  virtual void removeRepActorsFromViewRenderer(View* view);
121 
122 private slots:
123  void transformChangedSlot();
124  void vtkImageDataChangedSlot();
125 
126 private:
127  void initializeMapper();
128  void updateTransforms();
129  void clearVolume();
130  void setupVolume();
131  ImagePtr getEnvelopingImage();
132  void disconnectImages();
133  void connectImages();
134  void setupMonitor();
135  void setupVolumeProperties();
136  void setupReferenceVolumeAndPropertiesAndConnectToVolume();
137 
138  vtkVolumePtr mVolume;
140  std::vector<VolumePropertyPtr> mVolumeProperties;
141  VolumePropertyPtr mReferenceProperty;
142  std::vector<ImagePtr> mImages;
143  ImagePtr mReferenceImage;
144  std::vector<ImageMapperMonitorPtr> mMonitors;
145 };
146 
147 #endif // CXMEHDIGPURAYCASTMULTIVOLUMEREP_H
148 
149 
150 } // namespace cx
151 
152 
153 #endif //CX_BUILD_MEHDI_VTKMULTIVOLUME
154 
155 
vtkSmartPointer< class vtkVolume > vtkVolumePtr
vtkSmartPointer< class vtkOpenGLGPUMultiVolumeRayCastMapper > vtkOpenGLGPUMultiVolumeRayCastMapperPtr
boost::shared_ptr< class Image > ImagePtr
Definition: cxDicomWidget.h:48
boost::shared_ptr< class ImageMapperMonitor > ImageMapperMonitorPtr
boost::shared_ptr< class MehdiGPURayCastMultiVolumeRep > MehdiGPURayCastMultiVolumeRepPtr
Default implementation of Rep.
Definition: cxRepImpl.h:63
boost::shared_ptr< class VolumeProperty > VolumePropertyPtr
long mMaxVoxels
always resample volume below this size.
boost::shared_ptr< class ImageEnveloper > ImageEnveloperPtr