26
26
DEALINGS IN THE SOFTWARE.
27
27
*/
28
28
29
- #include < Application/Filters/Actions/ActionRadialBasisFunction .h>
29
+ #include < Application/Filters/Actions/ActionImplicitModel .h>
30
30
31
31
#include < Application/Filters/LayerFilter.h>
32
32
#include < Application/Filters/Actions/ActionThreshold.h>
54
54
#include < ScatteredData.h>
55
55
#include < vec3.h>
56
56
57
- CORE_REGISTER_ACTION ( RadialBasisFunction, RadialBasisFunction )
57
+ CORE_REGISTER_ACTION ( ImplicitModel, ImplicitModel )
58
58
59
- namespace RadialBasisFunction
59
+ namespace ImplicitModel
60
60
{
61
61
62
- typedef boost::shared_ptr< ActionRadialBasisFunction > ActionRadialBasisFunctionHandle ;
62
+ typedef boost::shared_ptr< ActionImplicitModel > ActionImplicitModelHandle ;
63
63
64
64
using namespace ::Seg3D;
65
65
using namespace ::Core;
@@ -73,15 +73,15 @@ class NotifierRunnable : public Runnable, public ConnectionHandler
73
73
std::string layerID_;
74
74
ActionContextHandle layerContext_;
75
75
NotifierHandle notifier_;
76
- ActionRadialBasisFunctionHandle action_;
76
+ ActionImplicitModelHandle action_;
77
77
78
- NotifierRunnable (const std::string& layerID, ActionContextHandle& layerContext, ActionRadialBasisFunctionHandle action) :
78
+ NotifierRunnable (const std::string& layerID, ActionContextHandle& layerContext, ActionImplicitModelHandle action) :
79
79
layerID_ (layerID),
80
80
layerContext_ (layerContext),
81
81
action_ (action)
82
82
{
83
83
this ->add_connection (
84
- this ->runThresholdSignal_ .connect ( boost::bind (&ActionRadialBasisFunction ::run_threshold, action_, _1) ) );
84
+ this ->runThresholdSignal_ .connect ( boost::bind (&ActionImplicitModel ::run_threshold, action_, _1) ) );
85
85
}
86
86
87
87
~NotifierRunnable ()
@@ -99,10 +99,10 @@ class NotifierRunnable : public Runnable, public ConnectionHandler
99
99
}
100
100
};
101
101
102
- class ActionRadialBasisFunctionPrivate
102
+ class ActionImplicitModelPrivate
103
103
{
104
104
public:
105
- ActionRadialBasisFunctionPrivate () :
105
+ ActionImplicitModelPrivate () :
106
106
normalOffset_ (0 ),
107
107
compute2DConvexHull_ (true ),
108
108
invertSeedOrder_ (false ),
@@ -120,24 +120,24 @@ class ActionRadialBasisFunctionPrivate
120
120
double thresholdValue_;
121
121
};
122
122
123
- class RadialBasisFunctionAlgo : public LayerFilter
123
+ class ImplicitModelAlgo : public LayerFilter
124
124
{
125
125
public:
126
- ActionRadialBasisFunctionPrivateHandle actionInternal_;
126
+ ActionImplicitModelPrivateHandle actionInternal_;
127
127
128
- RadialBasisFunctionAlgo ();
129
- virtual ~RadialBasisFunctionAlgo ();
128
+ ImplicitModelAlgo ();
129
+ virtual ~ImplicitModelAlgo ();
130
130
131
131
SCI_BEGIN_RUN ()
132
132
{
133
133
DataLayerHandle srcDataLayer = boost::dynamic_pointer_cast<DataLayer>(this ->actionInternal_ ->srcLayer_ );
134
134
DataLayerHandle dstDataLayer = boost::dynamic_pointer_cast<DataLayer>(this ->actionInternal_ ->dstLayer_ );
135
135
GridTransform srcGridTransform = srcDataLayer->get_grid_transform ();
136
136
137
- std::vector<vec3> rbfPointData ;
137
+ std::vector<vec3> modelPointData ;
138
138
for ( auto &vertex : this ->actionInternal_ ->vertices_ )
139
139
{
140
- rbfPointData .push_back ( vec3 (vertex.x (), vertex.y (), vertex.z ()) );
140
+ modelPointData .push_back ( vec3 (vertex.x (), vertex.y (), vertex.z ()) );
141
141
}
142
142
143
143
std::vector<axis_t > axisData;
@@ -164,12 +164,11 @@ class RadialBasisFunctionAlgo : public LayerFilter
164
164
}
165
165
}
166
166
167
-
168
167
// origin and size from source data layer
169
168
Point origin = srcGridTransform.get_origin ();
170
- vec3 rbfOrigin (origin.x (), origin.y (), origin.z ());
171
- vec3 rbfGridSize (srcGridTransform.get_nx (), srcGridTransform.get_ny (), srcGridTransform.get_nz ());
172
- vec3 rbfGridSpacing (srcGridTransform.spacing_x (), srcGridTransform.spacing_y (), srcGridTransform.spacing_z ());
169
+ vec3 modelOrigin (origin.x (), origin.y (), origin.z ());
170
+ vec3 modelGridSize (srcGridTransform.get_nx (), srcGridTransform.get_ny (), srcGridTransform.get_nz ());
171
+ vec3 modelGridSpacing (srcGridTransform.spacing_x (), srcGridTransform.spacing_y (), srcGridTransform.spacing_z ());
173
172
174
173
// From RBF class. ThinPlate is the default kernel.
175
174
Kernel kernel = ThinPlate;
@@ -182,12 +181,12 @@ class RadialBasisFunctionAlgo : public LayerFilter
182
181
kernel = MultiQuadratic;
183
182
}
184
183
185
- RBFInterface rbfAlgo ( rbfPointData, rbfOrigin, rbfGridSize, rbfGridSpacing ,
184
+ RBFInterface modelAlgo ( modelPointData, modelOrigin, modelGridSize, modelGridSpacing ,
186
185
this ->actionInternal_ ->normalOffset_ , axisData,
187
186
this ->actionInternal_ ->compute2DConvexHull_ ,
188
187
this ->actionInternal_ ->invertSeedOrder_ , kernel );
189
188
190
- this ->actionInternal_ ->thresholdValue_ = rbfAlgo .getThresholdValue ();
189
+ this ->actionInternal_ ->thresholdValue_ = modelAlgo .getThresholdValue ();
191
190
192
191
Core::DataBlockHandle dstDataBlock = Core::StdDataBlock::New ( srcGridTransform, Core::DataType::DOUBLE_E );
193
192
if ( ! dstDataBlock )
@@ -196,7 +195,7 @@ class RadialBasisFunctionAlgo : public LayerFilter
196
195
return ;
197
196
}
198
197
199
- const DataStorage rasterData = rbfAlgo .getRasterData ();
198
+ const DataStorage rasterData = modelAlgo .getRasterData ();
200
199
for (size_t i = 0 ; i < dstDataBlock->get_nx (); ++i)
201
200
{
202
201
for (size_t j = 0 ; j < dstDataBlock->get_ny (); ++j)
@@ -222,28 +221,28 @@ class RadialBasisFunctionAlgo : public LayerFilter
222
221
// The name of the filter, this information is used for generating new layer labels.
223
222
virtual std::string get_filter_name () const
224
223
{
225
- return " RadialBasisFunction Tool" ;
224
+ return " ImplicitModel Tool" ;
226
225
}
227
226
228
227
// GET_LAYER_PREFIX:
229
228
// This function returns the name of the filter. The latter is prepended to the new layer name,
230
229
// when a new layer is generated.
231
230
virtual std::string get_layer_prefix () const
232
231
{
233
- return " RadialBasisFunction " ;
232
+ return " ImplicitModel " ;
234
233
}
235
234
};
236
235
237
- RadialBasisFunctionAlgo::RadialBasisFunctionAlgo ()
236
+ ImplicitModelAlgo::ImplicitModelAlgo ()
238
237
{
239
238
}
240
239
241
- RadialBasisFunctionAlgo ::~RadialBasisFunctionAlgo ()
240
+ ImplicitModelAlgo ::~ImplicitModelAlgo ()
242
241
{
243
242
}
244
243
245
- ActionRadialBasisFunction::ActionRadialBasisFunction () :
246
- private_ ( new ActionRadialBasisFunctionPrivate )
244
+ ActionImplicitModel::ActionImplicitModel () :
245
+ private_ ( new ActionImplicitModelPrivate )
247
246
248
247
{
249
248
this ->add_layer_id ( this ->private_ ->targetLayerID_ );
@@ -256,7 +255,7 @@ ActionRadialBasisFunction::ActionRadialBasisFunction() :
256
255
this ->add_parameter ( this ->sandbox_ );
257
256
}
258
257
259
- bool ActionRadialBasisFunction ::validate ( ActionContextHandle& context )
258
+ bool ActionImplicitModel ::validate ( ActionContextHandle& context )
260
259
{
261
260
if (this ->private_ ->vertices_ .size () < 3 )
262
261
{
@@ -282,9 +281,9 @@ bool ActionRadialBasisFunction::validate( ActionContextHandle& context )
282
281
return true ;
283
282
}
284
283
285
- bool ActionRadialBasisFunction ::run ( ActionContextHandle& context, ActionResultHandle& result )
284
+ bool ActionImplicitModel ::run ( ActionContextHandle& context, ActionResultHandle& result )
286
285
{
287
- boost::shared_ptr< RadialBasisFunctionAlgo > algo ( new RadialBasisFunctionAlgo () );
286
+ boost::shared_ptr< ImplicitModelAlgo > algo ( new ImplicitModelAlgo () );
288
287
289
288
// Set up parameters
290
289
algo->set_sandbox ( this ->sandbox_ );
@@ -327,14 +326,14 @@ bool ActionRadialBasisFunction::run( ActionContextHandle& context, ActionResultH
327
326
NotifierRunnableHandle notifierThread_ (
328
327
new NotifierRunnable ( this ->private_ ->dstLayer_ ->get_layer_id (),
329
328
layerContext,
330
- boost::dynamic_pointer_cast< ActionRadialBasisFunction >(this ->shared_from_this ()) ) );
329
+ boost::dynamic_pointer_cast< ActionImplicitModel >(this ->shared_from_this ()) ) );
331
330
Runnable::Start ( notifierThread_ );
332
331
}
333
332
334
333
return true ;
335
334
}
336
335
337
- bool ActionRadialBasisFunction ::run_threshold ( ActionContextHandle& context )
336
+ bool ActionImplicitModel ::run_threshold ( ActionContextHandle& context )
338
337
{
339
338
DataLayerHandle dstDataLayer = boost::dynamic_pointer_cast<DataLayer>( this ->private_ ->dstLayer_ );
340
339
double dstMaxValue = dstDataLayer->get_data_volume ()->get_data_block ()->get_max ();
@@ -346,18 +345,18 @@ bool ActionRadialBasisFunction::run_threshold( ActionContextHandle& context )
346
345
return true ;
347
346
}
348
347
349
- void ActionRadialBasisFunction ::Dispatch (
350
- ActionContextHandle context,
351
- const std::string& target,
352
- const VertexList& vertices,
353
- const ViewModeList& viewModes,
354
- double normalOffset,
355
- bool compute2DConvexHull,
356
- bool invertSeedOrder,
357
- const std::string& kernel
358
- )
348
+ void ActionImplicitModel ::Dispatch (
349
+ ActionContextHandle context,
350
+ const std::string& target,
351
+ const VertexList& vertices,
352
+ const ViewModeList& viewModes,
353
+ double normalOffset,
354
+ bool compute2DConvexHull,
355
+ bool invertSeedOrder,
356
+ const std::string& kernel
357
+ )
359
358
{
360
- ActionRadialBasisFunction * action = new ActionRadialBasisFunction ;
359
+ ActionImplicitModel * action = new ActionImplicitModel ;
361
360
action->private_ ->targetLayerID_ = target;
362
361
action->private_ ->vertices_ = vertices;
363
362
action->private_ ->view_modes_ = viewModes;
0 commit comments