1
//---------------------------------------------------------------------------
3
// Project: OpenWalnut ( http://www.openwalnut.org )
5
// Copyright 2009 OpenWalnut Community, BSV@Uni-Leipzig and CNCF@MPI-CBS
6
// For more information see http://www.openwalnut.org/copying
8
// This file is part of OpenWalnut.
10
// OpenWalnut is free software: you can redistribute it and/or modify
11
// it under the terms of the GNU Lesser General Public License as published by
12
// the Free Software Foundation, either version 3 of the License, or
13
// (at your option) any later version.
15
// OpenWalnut is distributed in the hope that it will be useful,
16
// but WITHOUT ANY WARRANTY; without even the implied warranty of
17
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18
// GNU Lesser General Public License for more details.
20
// You should have received a copy of the GNU Lesser General Public License
21
// along with OpenWalnut. If not, see <http://www.gnu.org/licenses/>.
23
//---------------------------------------------------------------------------
25
#ifndef WROIARBITRARY_H
26
#define WROIARBITRARY_H
32
#include <boost/thread.hpp>
34
#include "../common/math/linearAlgebra/WLinearAlgebra.h"
35
#include "../common/math/WMatrix.h"
36
#include "../common/WColor.h"
37
#include "WPickHandler.h"
38
#include "WGEViewer.h"
40
#include "WTriangleMesh.h"
43
#include "WExportWGE.h"
48
* A box containing information on an arbitrarily shaped a region of interest.
50
class WGE_EXPORT WROIArbitrary : public WROI
55
* \param nbCoordsX number of vertices in X direction
56
* \param nbCoordsY number of vertices in Y direction
57
* \param nbCoordsZ number of vertices in Z direction
58
* \param mat the matrix transforming the vertices from canonical space
59
* \param vals the values at the vertices
62
* \param maxThreshold The maximum of the values.
63
* \param color the color to use for the ROI.
65
WROIArbitrary( size_t nbCoordsX, size_t nbCoordsY, size_t nbCoordsZ,
66
const WMatrix< double >& mat,
67
const std::vector< float >& vals,
68
boost::shared_ptr< WTriangleMesh > triMesh,
75
* \param nbCoordsX number of vertices in X direction
76
* \param nbCoordsY number of vertices in Y direction
77
* \param nbCoordsZ number of vertices in Z direction
78
* \param mat the matrix transforming the vertices from canonical space
79
* \param vals the values at the vertices
80
* \param maxThreshold The maximum of the values.
81
* \param color the color to use for the ROI.
83
WROIArbitrary( size_t nbCoordsX, size_t nbCoordsY, size_t nbCoordsZ,
84
const WMatrix< double >& mat,
85
const std::vector< float >& vals,
93
virtual ~WROIArbitrary();
96
* initalizes the properties
103
void propertyChanged();
109
void setThreshold( double threshold );
114
* \return The threshold on the data in box which leads to the arbitrary ROI
116
double getThreshold();
119
* Get the number of vertices in the three coordinate directions
121
* \return A vector containing the numbers of vertices
123
std::vector< size_t > getCoordDimensions();
126
* Get the vertex offsets in the three coordinate directions
128
* \return The offsets between point in each of the three coordinate directions
130
std::vector< double > getCoordOffsets();
133
* Get the i-th value of the data defining the ROI
134
* \param i the index of the value
136
* \return The value at the given index.
138
float getValue( size_t i );
141
* updates the graphics
143
virtual void updateGFX();
147
std::vector< size_t > m_nbCoordsVec; //!< The data's number of vertices in X, Y and Z direction.
149
WMatrix< double > m_matrix; //!< The 4x4 transformation matrix for the vertices.
151
const std::vector< float > m_vals; //!< The data at the vertices.
153
boost::shared_ptr< WTriangleMesh > m_triMesh; //!< This triangle mesh is provided as output through the connector.
155
WPropDouble m_threshold; //!< the threshold
163
* Node callback to handle updates properly
165
class ROIArbNodeCallback : public osg::NodeCallback
171
* \param node the osg node
172
* \param nv the node visitor
174
virtual void operator()( osg::Node* node, osg::NodeVisitor* nv )
176
osg::ref_ptr< WROIArbitrary > module = static_cast< WROIArbitrary* > ( node->getUserData() );
181
traverse( node, nv );
186
#endif // WROIARBITRARY_H