volumerenderer.h 6.02 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
28
// 
// ================================================================================================

#ifndef VOLUMERENDERER_H__
#define VOLUMERENDERER_H__

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

32
#include "modules/modulesapi.h"
33
34
35
#include "modules/vis/processors/eepgenerator.h"
#include "modules/vis/processors/proxygeometrygenerator.h"
#include "modules/vis/processors/simpleraycaster.h"
Hossain Mahmud's avatar
Hossain Mahmud committed
36
#include "../../processorfactory.h"
37

38
namespace cgt {
39
40
41
42
43
44
45
46
    class Shader;
}

namespace campvis {
    /**
     * Combines proxy geometry generator, entry/exit point generator and raycasting into one
     * easy-to-use volume renderer.
     */
47
    class CAMPVIS_MODULES_API VolumeRenderer : public VisualizationProcessor {
48
    public:
49
50
51
        /// Additional invalidation levels for this processor.
        /// Not the most beautiful design though.
        enum ProcessorInvalidationLevel {
52
53
54
            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
55
56
        };

57
58
        /**
         * Constructs a new VolumeRenderer Processor
59
60
61
62
         * \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));
63
64
65
66
67
68
69
70
71
72
73

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

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

        /// \see AbstractProcessor::deinit
        virtual void deinit();
Hossain Mahmud's avatar
Hossain Mahmud committed
74
75
76
77
78
        
        /** 
         * To be used in ProcessorFactory static methods
         */
        static const std::string getId() { return "VolumeRenderer"; };
79
        /// \see AbstractProcessor::getName()
Hossain Mahmud's avatar
Hossain Mahmud committed
80
        virtual const std::string getName() const { return getId(); };
81
82
        /// \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."; };
83
84
85
        /// \see AbstractProcessor::getAuthor()
        virtual const std::string getAuthor() const { return "Christian Schulte zu Berge <christian.szb@in.tum.de>"; };
        /// \see AbstractProcessor::getProcessorState()
86
        virtual ProcessorState getProcessorState() const { return AbstractProcessor::TESTING; };
87

88
89
90
        /// \see VisualizationPipeline::setViewportSizeProperty()
        virtual void setViewportSizeProperty(IVec2Property* viewportSizeProp);

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

        DataNameProperty p_inputVolume;             ///< image ID for first input image
98
        DataNameProperty p_camera;                  ///< Camera ID
99
100
101
102
        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
103

104
105
        MetaProperty p_pgProps;                     ///< MetaProperty for properties of the ProxyGeometryGenerator processor
        MetaProperty p_eepProps;                    ///< MetaProperty for properties of the EEPGenerator processor
106
107
        MetaProperty p_raycasterProps;              ///< MetaProperty for properties of the raycasting processor

108
    protected:
109
110
        /// \see AbstractProcessor::updateResult
        virtual void updateResult(DataContainer& dataContainer);
111
112
        /// \see    AbstractProcessor::updateProperties
        virtual void updateProperties(DataContainer& dataContainer);
113

114
115
        /**
         * Slot getting called when one of the observed processors got invalidated.
116
         * Invalidates this meta-processor with the corresponding level.
117
118
119
120
         * \param   processor   The processor that emitted the signal
         */
        virtual void onProcessorInvalidated(AbstractProcessor* processor);

121
122
123
        /**
         * \see VisualizationProcessor::onPropertyChanged
         */
124
125
126
127
        virtual void onPropertyChanged(const AbstractProperty* prop);

        ProxyGeometryGenerator _pgGenerator;
        EEPGenerator _eepGenerator;
128
        RaycastingProcessor* _raycaster;
129
130
131
132

        static const std::string loggerCat_;
    };

Hossain Mahmud's avatar
Hossain Mahmud committed
133
    // Instantiate template to register the pipelines.
134
    template class ProcessorRegistrar2<VolumeRenderer>;
135
136
137
}

#endif // VOLUMERENDERER_H__