cudaconfidencemapssolver.h 4.53 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
// ================================================================================================
// 
// This file is part of the CAMPVis Software Framework.
// 
// If not explicitly stated otherwise: Copyright (C) 2012-2014, all rights reserved,
//      Christian Schulte zu Berge <christian.szb@in.tum.de>
//      Chair for Computer Aided Medical Procedures
//      Technische Universitaet Muenchen
//      Boltzmannstr. 3, 85748 Garching b. Muenchen, Germany
// 
// For a full list of authors and contributors, please refer to the file "AUTHORS.txt".
// 
// 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
// 
// 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.
// 
// ================================================================================================

#ifndef CUDACONFIDENCEMAPSSOLVER_H__
#define CUDACONFIDENCEMAPSSOLVER_H__

#include <string>
#include <map>

#include <cgt/matrix.h>

#include <ext/threading.h>
#include <tbb/atomic.h>
#include <tbb/mutex.h>

#include "core/pipeline/abstractprocessor.h"
#include "core/properties/buttonproperty.h"
#include "core/properties/datanameproperty.h"
#include "core/properties/floatingpointproperty.h"

#include "core/datastructures/imagedata.h"

Declara Denis's avatar
Declara Denis committed
44
#include "modules/cudaconfidencemaps/core/cudaconfidencemaps_cuda.h"
45

46
47

namespace campvis {
48

49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
    class CudaConfidenceMapsSolver : public AbstractProcessor {
    public:
        /**
         * Constructs a new CampcomMhdReceiver Processor
         **/
        CudaConfidenceMapsSolver();

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

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

        /// \see AbstractProcessor::getName()
        virtual const std::string getName() const { return "CudaConfidenceMapsSolver"; };
        /// \see AbstractProcessor::getDescription()
        virtual const std::string getDescription() const { return "Solves the confidence maps problem iterativelly on the GPU"; };
        /// \see AbstractProcessor::getAuthor()
        virtual const std::string getAuthor() const { return "Denis Declara <denis.declara@in.tum.de>"; };
        /// \see AbstractProcessor::getProcessorState()
        virtual ProcessorState getProcessorState() const { return AbstractProcessor::EXPERIMENTAL; };
        /**
         * Updates the data container with the latest received transformation/position/image data
         * \param   dataContainer    DataContainer to work on
         */
        virtual void updateResult(DataContainer& dataContainer);

80
        virtual void onPropertyChanged(const AbstractProperty* prop);
81

82
83
84
        int getActualConjugentGradientIterations() const;
        float getResidualNorm() const;

85
        DataNameProperty p_inputImage;              ///< ID for input volume
86
        DataNameProperty p_outputConfidenceMap;     ///< ID for output gradient volume
87

88
        ButtonProperty p_resetResult;               ///< Resets solution vector to a linear confidence ramp
89

90
        BoolProperty  p_use8Neighbourhood;          ///< Wether to use 8- or 4-neighbourhood
91
        BoolProperty  p_useFixedIterationCount;     ///< If set to true the CG iterations are fixed, and not determined by time budget
92

93
        FloatProperty p_millisecondBudget;          ///< Maximum number of ms the solver can run
94
        IntProperty   p_iterationBudget;            ///< Number of CG iterations to perform per frame
95

96
        FloatProperty p_gradientScaling;            ///< Multiplicaton factor for gradients
97
98
99
        FloatProperty p_paramAlpha;
        FloatProperty p_paramBeta;
        FloatProperty p_paramGamma;
100
101
102
103

        BoolProperty  p_useAlphaBetaFilter;
        FloatProperty p_filterAlpha;                ///< Alpha parameter for Alpha-Beta Filter
        FloatProperty p_filterBeta;                 ///< Beta parameter for Alpha-Beta Filter
104
105
        
    protected:
106
        void resetSolutionVector();
107
        void updatePropertyVisibility();
108

Declara Denis's avatar
Declara Denis committed
109
        cuda::CudaConfidenceMapsSystemSolver _solver;
110
111
112
113
114
115
116
117
        
        static const std::string loggerCat_;
    };

}

#endif // CUDACONFIDENCEMAPSSOLVER_H__