predicatevolumeexplorer.h 5.22 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 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
// 
// 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 PREDICATEVOLUMEEXPLORER_H__
#define PREDICATEVOLUMEEXPLORER_H__

28
#include "modules/modulesapi.h"
29 30 31 32 33 34 35 36 37
#include "modules/vis/processors/volumeexplorer.h"
#include "modules/advancedusvis/processors/pointpredicateraycaster.h"
#include "modules/advancedusvis/processors/pointpredicateevaluator.h"


namespace campvis {
    /**
     * Combines a volume raycaster and 3 slice views for explorative volume visualization.
     */
38
    class CAMPVIS_MODULES_API PredicateVolumeExplorer : public VolumeExplorer {
39 40 41 42 43 44 45 46 47
        /// voxel type of the bitmask image (hardcoding this is not the most beautiful design though...)
        typedef uint8_t BitmaskType;

    public:
        /**
         * Constructs a new VolumeExplorer Processor
         * \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.
         **/
48
        explicit PredicateVolumeExplorer(IVec2Property* viewportSizeProp);
49 50 51 52 53 54 55 56 57 58 59 60

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

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

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

61 62
        /// To be used in ProcessorFactory static methods
        static const std::string getId() { return "PredicateVolumeExplorer"; };
63
        /// \see AbstractProcessor::getName()
64
        virtual const std::string getName() const { return getId(); };
65 66 67 68 69 70 71
        /// \see AbstractProcessor::getDescription()
        virtual const std::string getDescription() const { return "Combines a volume raycaster and 3 slice views for explorative volume visualization."; };
        /// \see AbstractProcessor::getAuthor()
        virtual const std::string getAuthor() const { return "Christian Schulte zu Berge <christian.szb@in.tum.de>"; };
        /// \see AbstractProcessor::getProcessorState()
        virtual ProcessorState getProcessorState() const { return AbstractProcessor::EXPERIMENTAL; };
        
72 73
        /// \see cgt::EventListener::onEvent()
        virtual void onEvent(cgt::Event* e);
74 75 76 77 78 79 80 81 82 83 84 85 86

        DataNameProperty p_inputLabels;
        DataNameProperty p_inputSnr;
        DataNameProperty p_inputVesselness;
        DataNameProperty p_inputConfidence;

        PointPredicateHistogramProperty p_histogram;
        MetaProperty p_pbProperties;

    protected:
        /// Additional invalidation levels for this processor.
        /// Not the most beautiful design though.
        enum ProcessorInvalidationLevel {
87
            BITSET_INVALID = SCRIBBLE_INVALID << 1
88 89 90 91 92 93 94 95 96 97 98 99
        };

        /// \see AbstractProcessor::updateResult
        virtual void updateResult(DataContainer& dataContainer);

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

100
        /// \see VisualizationProcessor::onPropertyChanged
101 102
        virtual void onPropertyChanged(const AbstractProperty* prop);

103 104 105
        /**
         * Updates the point predicate histogram from the current scribble geometry.
         */
106 107
        void updatePredicateHistogramFromScribbles();

108 109 110 111 112
        /**
         * Returns the predicate bit histogram of the given vector of voxels.
         * \param   voxels  List of voxels to compute the bit histogram for.
         * \return  A histogram where each bit corresponds to the number of voxels in \a voxels where the corresponding predicate yields true.
         */
113
        std::vector<int> computeBitHistogram(const std::vector<cgt::vec3>& voxels);
114

115
        PointPredicateEvaluator _predicateEvaluation;   ///< Processor to perform the point predicate evaluation on.
116 117
        DataHandle _bitmaskHandle;                      ///< DataHandle storing the predicate bitmask

118
    private:
119 120 121 122 123 124
        static const std::string loggerCat_;
    };

}

#endif // PREDICATEVOLUMEEXPLORER_H__