File tree Expand file tree Collapse file tree 1 file changed +11
-9
lines changed
src/Core/ComponentBaseClasses Expand file tree Collapse file tree 1 file changed +11
-9
lines changed Original file line number Diff line number Diff line change @@ -156,21 +156,23 @@ MetricBase< TElastix >
156
156
thisAsAdvanced->SetScaleGradientWithRespectToMovingImageOrientation ( wrtMoving );
157
157
}
158
158
159
- /* * Temporary?: Use the multi-threaded version or not. Default true. */
160
- std::string tmp = this ->m_Configuration ->GetCommandLineArgument ( " -mtm" ); // mtm: multi-threaded metrics
161
- if ( tmp == " true" || tmp == " " )
159
+ /* * Should the metric use multi-threading? */
160
+ bool useMultiThreading = true ;
161
+ this ->GetConfiguration ()->ReadParameter ( useMultiThreading,
162
+ " UseMultiThreadingForMetrics" , this ->GetComponentLabel (), level, 0 );
163
+
164
+ thisAsAdvanced->SetUseMultiThread ( useMultiThreading );
165
+ if ( useMultiThreading )
162
166
{
163
- thisAsAdvanced->SetUseMultiThread ( true );
164
- std::string tmp2 = this ->m_Configuration ->GetCommandLineArgument ( " -threads" );
165
- unsigned int nrOfThreads = atoi ( tmp2.c_str () );
166
- if ( tmp2 != " " )
167
+ std::string tmp = this ->m_Configuration ->GetCommandLineArgument ( " -threads" );
168
+ if ( tmp != " " )
167
169
{
170
+ const unsigned int nrOfThreads = atoi ( tmp.c_str () );
168
171
thisAsAdvanced->SetNumberOfThreads ( nrOfThreads );
169
172
}
170
173
}
171
- else { thisAsAdvanced->SetUseMultiThread ( false ); }
172
174
173
- } // end Advanced metric
175
+ } // end advanced metric
174
176
175
177
} // end BeforeEachResolutionBase()
176
178
You can’t perform that action at this time.
0 commit comments