Skip to content

Commit 6abbc79

Browse files
committed
Made USE_OPTIMIZED_REGISTRATION the default
The ITK_USE_OPTIMIZED_REGISTRATION is now the default behavior. There is no longer another option.
1 parent 73f66bd commit 6abbc79

43 files changed

Lines changed: 5035 additions & 10954 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

CMake/itkSampleBuildTest.cmake.in

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,6 @@ BUILD_EXAMPLES:BOOL=@BUILD_EXAMPLES@
111111
ITK_USE_PATENTED:BOOL=@ITK_USE_PATENTED@
112112
ITK_USE_REVIEW:BOOL=@ITK_USE_REVIEW@
113113
ITK_USE_CONCEPT_CHECKING:BOOL=@ITK_USE_CONCEPT_CHECKING@
114-
ITK_USE_OPTIMIZED_REGISTRATION_METHODS:BOOL=@ITK_USE_OPTIMIZED_REGISTRATION_METHODS@
115114
ITK_USE_CONSOLIDATED_MORPHOLOGY:BOOL=@ITK_USE_CONSOLIDATED_MORPHOLOGY@
116115
ITK_USE_TEMPLATE_META_PROGRAMMING_LOOP_UNROLLING:BOOL=@ITK_USE_TEMPLATE_META_PROGRAMMING_LOOP_UNROLLING@
117116
ITK_USE_TRANSFORM_IO_FACTORIES:BOOL=@ITK_USE_TRANSFORM_IO_FACTORIES@

CMakeLists.txt

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -174,26 +174,6 @@ MARK_AS_ADVANCED(ITK_USE_CONCEPT_CHECKING)
174174
OPTION(ITK_USE_STRICT_CONCEPT_CHECKING "Turn on Strict concept checking to give more stringent errors at compile time if a type cannot be used as a template parameter." OFF)
175175
MARK_AS_ADVANCED(ITK_USE_STRICT_CONCEPT_CHECKING)
176176

177-
# ITK turn on experimental version of accelerated image registration
178-
OPTION(ITK_USE_OPTIMIZED_REGISTRATION_METHODS "Turn on the experimental version of accelerated registration methods." OFF)
179-
MARK_AS_ADVANCED(ITK_USE_OPTIMIZED_REGISTRATION_METHODS)
180-
IF(ITK_USE_OPTIMIZED_REGISTRATION_METHODS)
181-
IF(NOT ITK_USE_REVIEW)
182-
MESSAGE(FATAL_ERROR "ITK_USE_REVIEW is currently OFF but it should be ON if you want to use the experimental optimized registration methods.")
183-
ENDIF(NOT ITK_USE_REVIEW)
184-
# Warn the user about the implications of turning optimized registration methods ON
185-
SET(msg "Attention: You have chosen to enable the use of Optimized Registration Methods.")
186-
SET(msg "${msg} These methods add multi-threading capabilities to several image metrics")
187-
SET(msg "${msg} as well as some Transforms and Interpolators. In order to take full advantage")
188-
SET(msg "${msg} of these new features you will have to also add some new calls to these components.")
189-
SET(msg "${msg} Please look at the files in the Examples/Review directory for further details.")
190-
191-
# display the message during the setup
192-
MESSAGE("${msg}")
193-
194-
195-
ENDIF(ITK_USE_OPTIMIZED_REGISTRATION_METHODS)
196-
197177
#-----------------------------------------------------------------------------
198178
# ITK turn on experimental version of accelerated image registration
199179
OPTION(ITK_USE_CONSOLIDATED_MORPHOLOGY "Turn on the experimental consolidated morphology." OFF)

Code/Algorithms/itkImageRegistrationMethod.txx

Lines changed: 31 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99
Copyright (c) Insight Software Consortium. All rights reserved.
1010
See ITKCopyright.txt or http://www.itk.org/HTML/Copyright.htm for details.
1111
12-
This software is distributed WITHOUT ANY WARRANTY; without even
13-
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12+
This software is distributed WITHOUT ANY WARRANTY; without even
13+
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
1414
PURPOSE. See the above copyright notices for more information.
1515
1616
=========================================================================*/
@@ -50,18 +50,13 @@ ImageRegistrationMethod<TFixedImage,TMovingImage>
5050
m_FixedImageRegionDefined = false;
5151

5252

53-
TransformOutputPointer transformDecorator =
54-
static_cast< TransformOutputType * >(
53+
TransformOutputPointer transformDecorator =
54+
static_cast< TransformOutputType * >(
5555
this->MakeOutput(0).GetPointer() );
5656

5757
this->ProcessObject::SetNthOutput( 0, transformDecorator.GetPointer() );
5858

59-
#ifdef ITK_USE_OPTIMIZED_REGISTRATION_METHODS
6059
this->SetNumberOfThreads( this->GetMultiThreader()->GetNumberOfThreads() );
61-
#else
62-
this->SetNumberOfThreads( 1 );
63-
this->GetMultiThreader()->SetNumberOfThreads( this->GetNumberOfThreads() );
64-
#endif
6560
}
6661

6762

@@ -79,7 +74,7 @@ ImageRegistrationMethod<TFixedImage,TMovingImage>
7974

8075
// Some of the following should be removed once ivars are put in the
8176
// input and output lists
82-
77+
8378
if (m_Transform)
8479
{
8580
m = m_Transform->GetMTime();
@@ -117,7 +112,7 @@ ImageRegistrationMethod<TFixedImage,TMovingImage>
117112
}
118113

119114
return mtime;
120-
115+
121116
}
122117

123118
/*
@@ -141,15 +136,15 @@ template < typename TFixedImage, typename TMovingImage >
141136
void
142137
ImageRegistrationMethod<TFixedImage,TMovingImage>
143138
::SetFixedImageRegion( const FixedImageRegionType & region )
144-
{
139+
{
145140
m_FixedImageRegion = region;
146141
m_FixedImageRegionDefined = true;
147142
this->Modified();
148143
}
149144

150145

151146
/**
152-
* Initialize by setting the interconnects between components.
147+
* Initialize by setting the interconnects between components.
153148
*/
154149
template < typename TFixedImage, typename TMovingImage >
155150
void
@@ -185,22 +180,19 @@ ImageRegistrationMethod<TFixedImage,TMovingImage>
185180
//
186181
// Connect the transform to the Decorator.
187182
//
188-
TransformOutputType * transformOutput =
183+
TransformOutputType * transformOutput =
189184
static_cast< TransformOutputType * >( this->ProcessObject::GetOutput(0) );
190185

191186
transformOutput->Set( m_Transform.GetPointer() );
192187

193-
194188
if( !m_Interpolator )
195189
{
196190
itkExceptionMacro(<<"Interpolator is not present");
197191
}
198192

199193
// Setup the metric
200-
#ifdef ITK_USE_OPTIMIZED_REGISTRATION_METHODS
201194
this->GetMultiThreader()->SetNumberOfThreads( this->GetNumberOfThreads() );
202195
this->m_Metric->SetNumberOfThreads( this->GetNumberOfThreads() );
203-
#endif
204196
m_Metric->SetMovingImage( m_MovingImage );
205197
m_Metric->SetFixedImage( m_FixedImage );
206198
m_Metric->SetTransform( m_Transform );
@@ -221,7 +213,7 @@ ImageRegistrationMethod<TFixedImage,TMovingImage>
221213
m_Optimizer->SetCostFunction( m_Metric );
222214

223215
// Validate initial transform parameters
224-
if ( m_InitialTransformParameters.Size() !=
216+
if ( m_InitialTransformParameters.Size() !=
225217
m_Transform->GetNumberOfParameters() )
226218
{
227219
itkExceptionMacro(<<"Size mismatch between initial parameters and transform." <<
@@ -241,7 +233,7 @@ template < typename TFixedImage, typename TMovingImage >
241233
void
242234
ImageRegistrationMethod<TFixedImage,TMovingImage>
243235
::StartRegistration( void )
244-
{
236+
{
245237

246238
// StartRegistration is an old API from before
247239
// ImageRegistrationMethod was a subclass of ProcessObject.
@@ -252,7 +244,7 @@ ImageRegistrationMethod<TFixedImage,TMovingImage>
252244
//
253245
// Since we cannot eliminate StartRegistration for backward
254246
// compability reasons, we check whether StartRegistration was
255-
// called directly or whether Update() (which in turn called
247+
// called directly or whether Update() (which in turn called
256248
// StartRegistration()).
257249
if (!m_Updating)
258250
{
@@ -270,11 +262,11 @@ ImageRegistrationMethod<TFixedImage,TMovingImage>
270262
catch( ExceptionObject& err )
271263
{
272264
m_LastTransformParameters = empty;
273-
265+
274266
// pass exception to caller
275267
throw err;
276268
}
277-
269+
278270
this->StartOptimization();
279271
}
280272
}
@@ -287,7 +279,7 @@ template < typename TFixedImage, typename TMovingImage >
287279
void
288280
ImageRegistrationMethod<TFixedImage,TMovingImage>
289281
::StartOptimization( void )
290-
{
282+
{
291283

292284
try
293285
{
@@ -372,41 +364,41 @@ ImageRegistrationMethod<TFixedImage,TMovingImage>
372364

373365

374366
template < typename TFixedImage, typename TMovingImage >
375-
void
367+
void
376368
ImageRegistrationMethod<TFixedImage,TMovingImage>
377369
::SetFixedImage( const FixedImageType * fixedImage )
378370
{
379-
itkDebugMacro("setting Fixed Image to " << fixedImage );
371+
itkDebugMacro("setting Fixed Image to " << fixedImage );
380372

381-
if (this->m_FixedImage.GetPointer() != fixedImage )
382-
{
373+
if (this->m_FixedImage.GetPointer() != fixedImage )
374+
{
383375
this->m_FixedImage = fixedImage;
384376

385377
// Process object is not const-correct so the const_cast is required here
386-
this->ProcessObject::SetNthInput(0,
378+
this->ProcessObject::SetNthInput(0,
387379
const_cast< FixedImageType *>( fixedImage ) );
388-
389-
this->Modified();
390-
}
380+
381+
this->Modified();
382+
}
391383
}
392384

393385
template < typename TFixedImage, typename TMovingImage >
394-
void
386+
void
395387
ImageRegistrationMethod<TFixedImage,TMovingImage>
396388
::SetMovingImage( const MovingImageType * movingImage )
397389
{
398-
itkDebugMacro("setting Moving Image to " << movingImage );
390+
itkDebugMacro("setting Moving Image to " << movingImage );
399391

400-
if (this->m_MovingImage.GetPointer() != movingImage )
401-
{
392+
if (this->m_MovingImage.GetPointer() != movingImage )
393+
{
402394
this->m_MovingImage = movingImage;
403395

404396
// Process object is not const-correct so the const_cast is required here
405-
this->ProcessObject::SetNthInput(1,
397+
this->ProcessObject::SetNthInput(1,
406398
const_cast< MovingImageType *>( movingImage ) );
407-
408-
this->Modified();
409-
}
399+
400+
this->Modified();
401+
}
410402
}
411403

412404
} // end namespace itk

0 commit comments

Comments
 (0)