volumerenderer.h 6.42 KB
Newer Older
1
2
3
4
// ================================================================================================
// 
// This file is part of the CAMPVis Software Framework.
// 
5
// If not explicitly stated otherwise: Copyright (C) 2012-2014, all rights reserved,
6
7
//      Christian Schulte zu Berge <christian.szb@in.tum.de>
//      Chair for Computer Aided Medical Procedures
8
9
//      Technische Universitaet Muenchen
//      Boltzmannstr. 3, 85748 Garching b. Muenchen, Germany
10
// 
11
12
// For a full list of authors and contributors, please refer to the file "AUTHORS.txt".
// 
13
14
15
16
// Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file 
// except in compliance with the License. You may obtain a copy of the License at
// 
// http://www.apache.org/licenses/LICENSE-2.0
17
// 
18
19
20
21
// Unless required by applicable law or agreed to in writing, software distributed under the 
// License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 
// either express or implied. See the License for the specific language governing permissions 
// and limitations under the License.
22
23
24
25
26
27
// 
// ================================================================================================

#ifndef VOLUMERENDERER_H__
#define VOLUMERENDERER_H__

28
#include "sigslot/sigslot.h"
29
#include "core/pipeline/visualizationprocessor.h"
30
#include "core/pipeline/raycastingprocessor.h"
31
#include "core/properties/allproperties.h"
32

33
#include "modules/modulesapi.h"
34
35
#include "modules/vis/processors/eepgenerator.h"
#include "modules/vis/processors/proxygeometrygenerator.h"
36
#include "modules/vis/processors/orientationoverlay.h"
37
#include "modules/vis/processors/simpleraycaster.h"
38
#include "modules/processorfactory.h"
39

40
namespace cgt {
41
42
43
44
45
46
47
48
    class Shader;
}

namespace campvis {
    /**
     * Combines proxy geometry generator, entry/exit point generator and raycasting into one
     * easy-to-use volume renderer.
     */
49
    class CAMPVIS_MODULES_API VolumeRenderer : public VisualizationProcessor {
50
    public:
51
52
53
        /// Additional invalidation levels for this processor.
        /// Not the most beautiful design though.
        enum ProcessorInvalidationLevel {
54
55
56
            PG_INVALID = AbstractProcessor::FIRST_FREE_TO_USE_INVALIDATION_LEVEL << 1,
            EEP_INVALID = AbstractProcessor::FIRST_FREE_TO_USE_INVALIDATION_LEVEL << 2,
            RAYCASTER_INVALID = AbstractProcessor::FIRST_FREE_TO_USE_INVALIDATION_LEVEL << 3
57
58
        };

59
60
        /**
         * Constructs a new VolumeRenderer Processor
61
62
63
64
         * \param   viewportSizeProp    Pointer to the property defining the viewport size, must not be 0.
         * \param   raycaster           Raycaster to use for rendering, must not be 0, VolumeRenderer will take ownership.
         */
        VolumeRenderer(IVec2Property* viewportSizeProp, RaycastingProcessor* raycaster = new SimpleRaycaster(0));
65
66
67
68
69
70
71
72
73
74
75

        /**
         * Destructor
         **/
        virtual ~VolumeRenderer();

        /// \see AbstractProcessor::init
        virtual void init();

        /// \see AbstractProcessor::deinit
        virtual void deinit();
Hossain Mahmud's avatar
Hossain Mahmud committed
76
77
78
79
80
        
        /** 
         * To be used in ProcessorFactory static methods
         */
        static const std::string getId() { return "VolumeRenderer"; };
81
        /// \see AbstractProcessor::getName()
Hossain Mahmud's avatar
Hossain Mahmud committed
82
        virtual const std::string getName() const { return getId(); };
83
84
        /// \see AbstractProcessor::getDescription()
        virtual const std::string getDescription() const { return "Combines proxy geometry generator, entry/exit point generator and raycasting into one easy-to-use volume renderer."; };
85
86
87
        /// \see AbstractProcessor::getAuthor()
        virtual const std::string getAuthor() const { return "Christian Schulte zu Berge <christian.szb@in.tum.de>"; };
        /// \see AbstractProcessor::getProcessorState()
88
        virtual ProcessorState getProcessorState() const { return AbstractProcessor::TESTING; };
89

90
91
92
        /// \see VisualizationPipeline::setViewportSizeProperty()
        virtual void setViewportSizeProperty(IVec2Property* viewportSizeProp);

93
94
95
96
97
98
99
        /**
         * Returns the used RaycastingProcessor.
         * \return  _raycaster
         */
        RaycastingProcessor* getRaycastingProcessor();

        DataNameProperty p_inputVolume;             ///< image ID for first input image
100
        DataNameProperty p_camera;                  ///< Camera ID
101
102
103
104
        DataNameProperty p_outputImage;             ///< image ID for output image

        BoolProperty p_profileRaycaster;            ///< Flag whether the raycaster's execution time shall be profiled
        GLuint _timerQueryRaycaster;                ///< OpenGL timer query for raycaster
105

106
107
        MetaProperty p_pgProps;                     ///< MetaProperty for properties of the ProxyGeometryGenerator processor
        MetaProperty p_eepProps;                    ///< MetaProperty for properties of the EEPGenerator processor
108
        MetaProperty p_raycasterProps;              ///< MetaProperty for properties of the raycasting processor
109
        MetaProperty p_orientationOverlayProps;     ///< MetaProperty for properties of the OrientationOverlay processor
110
111
        
        sigslot::signal2<RaycastingProcessor*, RaycastingProcessor*> s_raycasterChanged;    ///< Signal emited when the raycaster is changed
112

113
    protected:
114
115
        /// \see AbstractProcessor::updateResult
        virtual void updateResult(DataContainer& dataContainer);
116
117
        /// \see    AbstractProcessor::updateProperties
        virtual void updateProperties(DataContainer& dataContainer);
118

119
120
        /**
         * Slot getting called when one of the observed processors got invalidated.
121
         * Invalidates this meta-processor with the corresponding level.
122
123
124
125
         * \param   processor   The processor that emitted the signal
         */
        virtual void onProcessorInvalidated(AbstractProcessor* processor);

126
127
128
        /**
         * \see VisualizationProcessor::onPropertyChanged
         */
129
130
131
132
        virtual void onPropertyChanged(const AbstractProperty* prop);

        ProxyGeometryGenerator _pgGenerator;
        EEPGenerator _eepGenerator;
133
        RaycastingProcessor* _raycaster;
134

135
136
        OrientationOverlay _orientationOverlay;

137
138
139
        static const std::string loggerCat_;
    };

Hossain Mahmud's avatar
Hossain Mahmud committed
140
    // Instantiate template to register the pipelines.
141
    template class SmartProcessorRegistrar<VolumeRenderer>;
142
143
144
}

#endif // VOLUMERENDERER_H__