Skip to content

Commit 2f7c39b

Browse files
author
Ayla Khan
authored
Rename Radial Basis Function (RBF) tool to Implicit Model (more gener… (#190)
* Rename Radial Basis Function (RBF) tool to Implicit Model (more general). Closes #186. * Try to improve reliability of custom step.
1 parent 3970e77 commit 2f7c39b

File tree

11 files changed

+115
-118
lines changed

11 files changed

+115
-118
lines changed

Superbuild/TetgenExternal.cmake

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,6 @@ SET(TETGEN_LIBRARY "tet")
3131
ExternalProject_Add(Tetgen_external
3232
URL "http://tetgen.org/files/tetgen1.4.3.tar.gz"
3333
PATCH_COMMAND ""
34-
#CONFIGURE_COMMAND ""
35-
#BUILD_IN_SOURCE ON
36-
#BUILD_COMMAND ""
3734
INSTALL_COMMAND ""
3835
CMAKE_CACHE_ARGS
3936
-DCMAKE_VERBOSE_MAKEFILE:BOOL=${CMAKE_VERBOSE_MAKEFILE}
@@ -45,6 +42,8 @@ ExternalProject_Add(Tetgen_external
4542
ExternalProject_Add_Step(Tetgen_external add_cmakelists
4643
COMMAND "${CMAKE_COMMAND}" -E copy ${SUPERBUILD_DIR}/TetgenCMakeLists.txt CMakeLists.txt
4744
DEPENDEES download
45+
DEPENDERS configure
46+
ALWAYS 1
4847
WORKING_DIRECTORY <SOURCE_DIR>
4948
)
5049

src/Application/Filters/Actions/ActionRadialBasisFunction.cc renamed to src/Application/Filters/Actions/ActionImplicitModel.cc

Lines changed: 43 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
DEALINGS IN THE SOFTWARE.
2727
*/
2828

29-
#include <Application/Filters/Actions/ActionRadialBasisFunction.h>
29+
#include <Application/Filters/Actions/ActionImplicitModel.h>
3030

3131
#include <Application/Filters/LayerFilter.h>
3232
#include <Application/Filters/Actions/ActionThreshold.h>
@@ -54,12 +54,12 @@
5454
#include <ScatteredData.h>
5555
#include <vec3.h>
5656

57-
CORE_REGISTER_ACTION( RadialBasisFunction, RadialBasisFunction )
57+
CORE_REGISTER_ACTION( ImplicitModel, ImplicitModel )
5858

59-
namespace RadialBasisFunction
59+
namespace ImplicitModel
6060
{
6161

62-
typedef boost::shared_ptr< ActionRadialBasisFunction > ActionRadialBasisFunctionHandle;
62+
typedef boost::shared_ptr< ActionImplicitModel > ActionImplicitModelHandle;
6363

6464
using namespace ::Seg3D;
6565
using namespace ::Core;
@@ -73,15 +73,15 @@ class NotifierRunnable : public Runnable, public ConnectionHandler
7373
std::string layerID_;
7474
ActionContextHandle layerContext_;
7575
NotifierHandle notifier_;
76-
ActionRadialBasisFunctionHandle action_;
76+
ActionImplicitModelHandle action_;
7777

78-
NotifierRunnable(const std::string& layerID, ActionContextHandle& layerContext, ActionRadialBasisFunctionHandle action) :
78+
NotifierRunnable(const std::string& layerID, ActionContextHandle& layerContext, ActionImplicitModelHandle action) :
7979
layerID_(layerID),
8080
layerContext_(layerContext),
8181
action_(action)
8282
{
8383
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) ) );
8585
}
8686

8787
~NotifierRunnable()
@@ -99,10 +99,10 @@ class NotifierRunnable : public Runnable, public ConnectionHandler
9999
}
100100
};
101101

102-
class ActionRadialBasisFunctionPrivate
102+
class ActionImplicitModelPrivate
103103
{
104104
public:
105-
ActionRadialBasisFunctionPrivate() :
105+
ActionImplicitModelPrivate() :
106106
normalOffset_(0),
107107
compute2DConvexHull_(true),
108108
invertSeedOrder_(false),
@@ -120,24 +120,24 @@ class ActionRadialBasisFunctionPrivate
120120
double thresholdValue_;
121121
};
122122

123-
class RadialBasisFunctionAlgo : public LayerFilter
123+
class ImplicitModelAlgo : public LayerFilter
124124
{
125125
public:
126-
ActionRadialBasisFunctionPrivateHandle actionInternal_;
126+
ActionImplicitModelPrivateHandle actionInternal_;
127127

128-
RadialBasisFunctionAlgo();
129-
virtual ~RadialBasisFunctionAlgo();
128+
ImplicitModelAlgo();
129+
virtual ~ImplicitModelAlgo();
130130

131131
SCI_BEGIN_RUN()
132132
{
133133
DataLayerHandle srcDataLayer = boost::dynamic_pointer_cast<DataLayer>(this->actionInternal_->srcLayer_);
134134
DataLayerHandle dstDataLayer = boost::dynamic_pointer_cast<DataLayer>(this->actionInternal_->dstLayer_);
135135
GridTransform srcGridTransform = srcDataLayer->get_grid_transform();
136136

137-
std::vector<vec3> rbfPointData;
137+
std::vector<vec3> modelPointData;
138138
for ( auto &vertex : this->actionInternal_->vertices_ )
139139
{
140-
rbfPointData.push_back( vec3(vertex.x(), vertex.y(), vertex.z()) );
140+
modelPointData.push_back( vec3(vertex.x(), vertex.y(), vertex.z()) );
141141
}
142142

143143
std::vector<axis_t> axisData;
@@ -164,12 +164,11 @@ class RadialBasisFunctionAlgo : public LayerFilter
164164
}
165165
}
166166

167-
168167
// origin and size from source data layer
169168
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());
173172

174173
// From RBF class. ThinPlate is the default kernel.
175174
Kernel kernel = ThinPlate;
@@ -182,12 +181,12 @@ class RadialBasisFunctionAlgo : public LayerFilter
182181
kernel = MultiQuadratic;
183182
}
184183

185-
RBFInterface rbfAlgo( rbfPointData, rbfOrigin, rbfGridSize, rbfGridSpacing,
184+
RBFInterface modelAlgo( modelPointData, modelOrigin, modelGridSize, modelGridSpacing,
186185
this->actionInternal_->normalOffset_, axisData,
187186
this->actionInternal_->compute2DConvexHull_,
188187
this->actionInternal_->invertSeedOrder_, kernel );
189188

190-
this->actionInternal_->thresholdValue_ = rbfAlgo.getThresholdValue();
189+
this->actionInternal_->thresholdValue_ = modelAlgo.getThresholdValue();
191190

192191
Core::DataBlockHandle dstDataBlock = Core::StdDataBlock::New( srcGridTransform, Core::DataType::DOUBLE_E );
193192
if ( ! dstDataBlock )
@@ -196,7 +195,7 @@ class RadialBasisFunctionAlgo : public LayerFilter
196195
return;
197196
}
198197

199-
const DataStorage rasterData = rbfAlgo.getRasterData();
198+
const DataStorage rasterData = modelAlgo.getRasterData();
200199
for (size_t i = 0; i < dstDataBlock->get_nx(); ++i)
201200
{
202201
for (size_t j = 0; j < dstDataBlock->get_ny(); ++j)
@@ -222,28 +221,28 @@ class RadialBasisFunctionAlgo : public LayerFilter
222221
// The name of the filter, this information is used for generating new layer labels.
223222
virtual std::string get_filter_name() const
224223
{
225-
return "RadialBasisFunction Tool";
224+
return "ImplicitModel Tool";
226225
}
227226

228227
// GET_LAYER_PREFIX:
229228
// This function returns the name of the filter. The latter is prepended to the new layer name,
230229
// when a new layer is generated.
231230
virtual std::string get_layer_prefix() const
232231
{
233-
return "RadialBasisFunction";
232+
return "ImplicitModel";
234233
}
235234
};
236235

237-
RadialBasisFunctionAlgo::RadialBasisFunctionAlgo()
236+
ImplicitModelAlgo::ImplicitModelAlgo()
238237
{
239238
}
240239

241-
RadialBasisFunctionAlgo::~RadialBasisFunctionAlgo()
240+
ImplicitModelAlgo::~ImplicitModelAlgo()
242241
{
243242
}
244243

245-
ActionRadialBasisFunction::ActionRadialBasisFunction() :
246-
private_( new ActionRadialBasisFunctionPrivate )
244+
ActionImplicitModel::ActionImplicitModel() :
245+
private_( new ActionImplicitModelPrivate )
247246

248247
{
249248
this->add_layer_id( this->private_->targetLayerID_ );
@@ -256,7 +255,7 @@ ActionRadialBasisFunction::ActionRadialBasisFunction() :
256255
this->add_parameter( this->sandbox_ );
257256
}
258257

259-
bool ActionRadialBasisFunction::validate( ActionContextHandle& context )
258+
bool ActionImplicitModel::validate( ActionContextHandle& context )
260259
{
261260
if (this->private_->vertices_.size() < 3)
262261
{
@@ -282,9 +281,9 @@ bool ActionRadialBasisFunction::validate( ActionContextHandle& context )
282281
return true;
283282
}
284283

285-
bool ActionRadialBasisFunction::run( ActionContextHandle& context, ActionResultHandle& result )
284+
bool ActionImplicitModel::run( ActionContextHandle& context, ActionResultHandle& result )
286285
{
287-
boost::shared_ptr< RadialBasisFunctionAlgo > algo( new RadialBasisFunctionAlgo() );
286+
boost::shared_ptr< ImplicitModelAlgo > algo( new ImplicitModelAlgo() );
288287

289288
// Set up parameters
290289
algo->set_sandbox( this->sandbox_ );
@@ -327,14 +326,14 @@ bool ActionRadialBasisFunction::run( ActionContextHandle& context, ActionResultH
327326
NotifierRunnableHandle notifierThread_(
328327
new NotifierRunnable( this->private_->dstLayer_->get_layer_id(),
329328
layerContext,
330-
boost::dynamic_pointer_cast< ActionRadialBasisFunction >(this->shared_from_this()) ) );
329+
boost::dynamic_pointer_cast< ActionImplicitModel >(this->shared_from_this()) ) );
331330
Runnable::Start( notifierThread_ );
332331
}
333332

334333
return true;
335334
}
336335

337-
bool ActionRadialBasisFunction::run_threshold( ActionContextHandle& context )
336+
bool ActionImplicitModel::run_threshold( ActionContextHandle& context )
338337
{
339338
DataLayerHandle dstDataLayer = boost::dynamic_pointer_cast<DataLayer>( this->private_->dstLayer_ );
340339
double dstMaxValue = dstDataLayer->get_data_volume()->get_data_block()->get_max();
@@ -346,18 +345,18 @@ bool ActionRadialBasisFunction::run_threshold( ActionContextHandle& context )
346345
return true;
347346
}
348347

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+
)
359358
{
360-
ActionRadialBasisFunction* action = new ActionRadialBasisFunction;
359+
ActionImplicitModel* action = new ActionImplicitModel;
361360
action->private_->targetLayerID_ = target;
362361
action->private_->vertices_ = vertices;
363362
action->private_->view_modes_ = viewModes;

src/Application/Filters/Actions/ActionRadialBasisFunction.h renamed to src/Application/Filters/Actions/ActionImplicitModel.h

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -26,45 +26,45 @@
2626
DEALINGS IN THE SOFTWARE.
2727
*/
2828

29-
#ifndef APPLICATION_TOOLS_ACTIONS_ACTIONRRADIALBASISFUNCTION_H
30-
#define APPLICATION_TOOLS_ACTIONS_ACTIONRRADIALBASISFUNCTION_H
29+
#ifndef APPLICATION_TOOLS_ACTIONS_ACTIONIMPLICITMODEL_H
30+
#define APPLICATION_TOOLS_ACTIONS_ACTIONIMPLICITMODEL_H
3131

3232
#include <Application/Layer/LayerAction.h>
3333
#include <Application/Layer/LayerManager.h>
3434

35-
namespace RadialBasisFunction
35+
namespace ImplicitModel
3636
{
3737

3838
class NotifierRunnable;
3939
typedef boost::shared_ptr<NotifierRunnable> NotifierRunnableHandle;
4040

41-
class ActionRadialBasisFunctionPrivate;
42-
typedef boost::shared_ptr< ActionRadialBasisFunctionPrivate > ActionRadialBasisFunctionPrivateHandle;
41+
class ActionImplicitModelPrivate;
42+
typedef boost::shared_ptr< ActionImplicitModelPrivate > ActionImplicitModelPrivateHandle;
4343

4444
typedef Core::Point VertexCoord;
4545
typedef std::vector< VertexCoord > VertexList;
4646

4747
typedef std::vector< std::string > ViewModeList;
4848

49-
class ActionRadialBasisFunction : public Seg3D::LayerAction
49+
class ActionImplicitModel : public Seg3D::LayerAction
5050
{
5151
CORE_ACTION(
52-
CORE_ACTION_TYPE( "RadialBasisFunction", "Implicit function action interface" )
52+
CORE_ACTION_TYPE( "ImplicitModel", "Implicit model function action interface" )
5353
CORE_ACTION_ARGUMENT( "layerid", "The layerid on which this filter needs to be run." )
54-
CORE_ACTION_ARGUMENT( "vertices", "The 3D points needed to generate the radial basis function." )
54+
CORE_ACTION_ARGUMENT( "vertices", "The 3D points needed to generate the implicit model function." )
5555
CORE_ACTION_ARGUMENT( "view_modes", "The 2D view where each point was picked (axial or sagittal or coronal)." )
5656
CORE_ACTION_ARGUMENT( "normal_offset", "Normal vector offset parameter." )
5757
CORE_ACTION_OPTIONAL_ARGUMENT( "convex_hull_2D", "true", "" )
5858
CORE_ACTION_OPTIONAL_ARGUMENT( "invert_seed_order", "false", "" )
59-
CORE_ACTION_OPTIONAL_ARGUMENT( "kernel", "thin_plate", "Radial basis function kernel (thin_plate or gaussian or multi_quadratic)." )
59+
CORE_ACTION_OPTIONAL_ARGUMENT( "kernel", "thin_plate", "Implicit model function kernel (thin_plate or gaussian or multi_quadratic)." )
6060
CORE_ACTION_OPTIONAL_ARGUMENT( "sandbox", "-1", "The sandbox in which to run the action." )
6161
CORE_ACTION_ARGUMENT_IS_NONPERSISTENT( "sandbox" )
6262
CORE_ACTION_CHANGES_PROJECT_DATA()
6363
CORE_ACTION_IS_UNDOABLE()
6464
)
6565

6666
public:
67-
ActionRadialBasisFunction();
67+
ActionImplicitModel();
6868

6969
// VALIDATE:
7070
// Each action needs to be validated just before it is posted. This way we
@@ -79,7 +79,7 @@ CORE_ACTION(
7979
bool run_threshold( Core::ActionContextHandle& context );
8080

8181
private:
82-
ActionRadialBasisFunctionPrivateHandle private_;
82+
ActionImplicitModelPrivateHandle private_;
8383
Seg3D::SandboxID sandbox_;
8484

8585
public:

src/Application/Filters/CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -143,8 +143,8 @@ SET(APPLICATION_FILTERS_ACTIONS_SRCS
143143
Actions/ActionPointSetRegisterFilter.cc
144144
Actions/ActionPointSetTransformFilter.h
145145
Actions/ActionPointSetTransformFilter.cc
146-
Actions/ActionRadialBasisFunction.h
147-
Actions/ActionRadialBasisFunction.cc
146+
Actions/ActionImplicitModel.h
147+
Actions/ActionImplicitModel.cc
148148
Actions/ActionPadFilter.h
149149
Actions/ActionPadFilter.cc
150150
Actions/ActionSingleThreshold.h

src/Application/Tools/CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,8 +125,8 @@ SET(APPLICATION_TOOLS_SRCS
125125
PointsSelectTool.cc
126126
PadTool.h
127127
PadTool.cc
128-
RadialBasisFunctionTool.h
129-
RadialBasisFunctionTool.cc
128+
ImplicitModelTool.h
129+
ImplicitModelTool.cc
130130
WatershedFilter.h
131131
WatershedFilter.cc
132132
)

0 commit comments

Comments
 (0)