Fraxinus  16.5.0-fx-rc9
An IGT application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
cxVideoGraphics.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 
33 
34 #ifndef CXVIDEOGRAPHICS_H_
35 #define CXVIDEOGRAPHICS_H_
36 
37 #include "cxResourceVisualizationExport.h"
38 
39 #include "vtkForwardDeclarations.h"
40 #include "cxForwardDeclarations.h"
41 
42 typedef vtkSmartPointer<class vtkTransformTextureCoords> vtkTransformTextureCoordsPtr;
43 typedef vtkSmartPointer<class vtkDataSetMapper> vtkDataSetMapperPtr;
44 typedef vtkSmartPointer<class vtkImageMask> vtkImageMaskPtr;
45 typedef vtkSmartPointer<class UltrasoundSectorSource> UltrasoundSectorSourcePtr;
46 
47 namespace cx
48 {
49 typedef boost::shared_ptr<class VideoSourceGraphics> VideoSourceGraphicsPtr;
50 
62 class cxResourceVisualization_EXPORT VideoGraphics
63 {
64 public:
65  VideoGraphics();
66  virtual ~VideoGraphics();
67 
68  vtkActorPtr getActor();
69  void setActorUserMatrix(vtkMatrix4x4Ptr rMu);
70  void setVisibility(bool visible);
75  void setFlipVertical(bool on);
76  bool getFlipVertical();
77 
83  void setMask(vtkImageDataPtr mask);
84 
90  void setClip(vtkPolyDataPtr sector);
91 
94  void setInputVideo(vtkImageDataPtr video);
95 
98  void update();
99 
100 private:
101  void setLookupTable();
102 
103  void setupPipeline();
104  void connectVideoImageToPipeline();
105  void updatePlaneSourceBounds();
106  void updateLUT();
107  bool inputImageIsEmpty();
108 
109  vtkImageDataPtr mInputMask;
110  vtkPolyDataPtr mInputSector;
111  vtkImageDataPtr mInputVideo;
112 
113  vtkLookupTablePtr mLUT;
114  vtkImageChangeInformationPtr mDataRedirecter;
115  vtkActorPtr mPlaneActor;
116  vtkPlaneSourcePtr mPlaneSource;
117  vtkTexturePtr mTexture;
118  UltrasoundSectorSourcePtr mUSSource;
119  vtkDataSetMapperPtr mDataSetMapper;
120  vtkTransformTextureCoordsPtr mTransformTextureCoords;
121  vtkTextureMapToPlanePtr mTextureMapToPlane;
122 
123  vtkImageThresholdPtr mMapZeroToOne;
124  vtkImageMaskPtr mMaskFilter;
125 };
126 typedef boost::shared_ptr<VideoGraphics> VideoGraphicsPtr;
127 
128 } // namespace cx
129 
130 #endif // CXVIDEOGRAPHICS_H_
vtkSmartPointer< class vtkImageThreshold > vtkImageThresholdPtr
vtkSmartPointer< class vtkMatrix4x4 > vtkMatrix4x4Ptr
Definition: cxMathBase.h:58
vtkSmartPointer< class vtkTexture > vtkTexturePtr
vtkSmartPointer< class vtkActor > vtkActorPtr
vtkSmartPointer< class vtkDataSetMapper > vtkDataSetMapperPtr
Wrap vtkActor displaying a video image, possibly clipped by a sector.
vtkSmartPointer< vtkImageChangeInformation > vtkImageChangeInformationPtr
Definition: cxImage.cpp:67
vtkSmartPointer< class UltrasoundSectorSource > UltrasoundSectorSourcePtr
boost::shared_ptr< VideoGraphics > VideoGraphicsPtr
vtkSmartPointer< class vtkTextureMapToPlane > vtkTextureMapToPlanePtr
vtkSmartPointer< class vtkImageMask > vtkImageMaskPtr
vtkSmartPointer< class vtkPolyData > vtkPolyDataPtr
boost::shared_ptr< class VideoSourceGraphics > VideoSourceGraphicsPtr
vtkSmartPointer< class vtkLookupTable > vtkLookupTablePtr
vtkSmartPointer< vtkDataSetMapper > vtkDataSetMapperPtr
vtkSmartPointer< class vtkPlaneSource > vtkPlaneSourcePtr
vtkSmartPointer< vtkImageMask > vtkImageMaskPtr
vtkSmartPointer< class vtkImageData > vtkImageDataPtr
vtkSmartPointer< class vtkTransformTextureCoords > vtkTransformTextureCoordsPtr