@@ -95,32 +95,50 @@ ToolFactory::~ToolFactory()
9595{
9696}
9797
98- void ToolFactory::register_tool ( ToolBuilderBase* builder, ToolInfoHandle info,
99- std::string tool_name )
98+ #ifdef SEG3D_MANUAL_TOOLS_ONLY
99+ static std::set<std::string> nonManualTools = { " croptool" , " resampletool" , " thresholdtool" , " cannyedgedetectionfilter" ,
100+ " confidenceconnectedfilter" , " connectedcomponentfilter" , " curvatureanisotropicdiffusionfilter" ,
101+ " discretegaussianfilter" , " distancefilter" , " extractdatalayer" , " gradientanisotropicdiffusionfilter" ,
102+ " gradientmagnitudefilter" , " histogramequalizationfilter" , " intensitycorrectionfilter" ,
103+ " maskdatafilter" , " medianfilter" , " meanfilter" , " neighborhoodconnectedfilter" ,
104+ " otsuthresholdfilter" , " thresholdsegmentationlsfilter" , " transformtool" , " measurementtool" ,
105+ " pointsetfilter" , " speedlinetool" , " pointsselecttool" , " padtool" , " implicitmodeltool" , " watershedfilter" };
106+ #endif
107+
108+ void ToolFactory::register_tool (ToolBuilderBase* builder, ToolInfoHandle info,
109+ std::string tool_name)
100110{
101- tool_name = Core::StringToLower ( tool_name );
111+ tool_name = Core::StringToLower (tool_name);
102112
103- lock_type lock ( this ->get_mutex () );
113+ #ifdef SEG3D_MANUAL_TOOLS_ONLY
114+ // When building a library, we don't want to include the tools in nonManualTools
115+ if (nonManualTools.find (tool_name) != nonManualTools.end ())
116+ {
117+ return ;
118+ }
119+ #endif
120+
121+ lock_type lock (this ->get_mutex ());
104122
105123 // Test is tool was registered before.
106- if ( this ->private_ ->tools_ .find ( tool_name ) != this ->private_ ->tools_ .end () )
124+ if (this ->private_ ->tools_ .find (tool_name) != this ->private_ ->tools_ .end ())
107125 {
108126 // Actions that are registered twice, will cause problems
109127 // Hence the program will throw an exception.
110128 // As registration is done on startup, this will cause a
111129 // faulty program to fail always on startup.
112- CORE_THROW_LOGICERROR ( std::string ( " Tool '" ) + tool_name + " ' is registered twice" );
130+ CORE_THROW_LOGICERROR (std::string (" Tool '" ) + tool_name + " ' is registered twice" );
113131 }
114132
115133 // Register the action and set its properties
116134 ToolEntry entry;
117135 entry.builder_ = builder;
118136 entry.info_ = info;
119- this ->private_ ->tools_ [ tool_name ] = entry;
137+ this ->private_ ->tools_ [tool_name] = entry;
120138
121- this ->private_ ->tool_menus_ .insert ( info->get_menu () );
122-
123- CORE_LOG_DEBUG ( std::string ( " Registering tool : " ) + tool_name );
139+ this ->private_ ->tool_menus_ .insert (info->get_menu ());
140+
141+ CORE_LOG_DEBUG (std::string (" Registering tool : " ) + tool_name);
124142}
125143
126144void ToolFactory::register_toolinterface ( ToolInterfaceBuilderBase* builder,
0 commit comments