Skip to content

Commit 4976fd5

Browse files
authored
Merge pull request #57 from dzenanz/itk5compatibility
ENH: adding compatibility with ITK 5.0
2 parents 09e4aae + 25e3e2a commit 4976fd5

19 files changed

+40
-32
lines changed

examples/Core/ThreadOverhead.cxx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ ProbeType time_it(unsigned int threads, unsigned int iterations, bool realtime =
9595

9696
FilterType::Pointer filter = FilterType::New();
9797
filter->SetInput(image);
98-
filter->SetNumberOfThreads( threads );
98+
filter->SET_PARALLEL_UNITS( threads );
9999

100100
// execute one time out of the loop to allocate memory
101101
filter->UpdateLargestPossibleRegion();
@@ -105,7 +105,7 @@ ProbeType time_it(unsigned int threads, unsigned int iterations, bool realtime =
105105

106106
const std::string name = ss.str();
107107

108-
for( int ii = 0; ii < iterations; ++ii )
108+
for( unsigned ii = 0; ii < iterations; ++ii )
109109
{
110110
image->Modified();
111111
collector.Start(name.c_str());
@@ -128,7 +128,7 @@ int main( int argc, char * argv[] )
128128

129129
const std::string timingsFileName = ReplaceOccurrence( argv[1], "__DATESTAMP__", PerfDateStamp());
130130
const int iterations = (argc>2) ? atoi( argv[2] ): 500;
131-
const int threads = (argc>3) ? atoi( argv[3] ) : itk::MultiThreader::GetGlobalDefaultNumberOfThreads();
131+
const int threads = (argc>3) ? atoi( argv[3] ) : MultiThreaderName::GetGlobalDefaultNumberOfThreads();
132132

133133
if (threads == 1)
134134
{

examples/Filtering/BinaryAddBenchmark.cxx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ int main( int argc, char * argv[] )
6767

6868
if( threads > 0 )
6969
{
70-
itk::MultiThreader::SetGlobalDefaultNumberOfThreads( threads );
70+
MultiThreaderName::SetGlobalDefaultNumberOfThreads( threads );
7171
}
7272

7373
constexpr unsigned int Dimension = 3;

examples/Filtering/GradientMagnitudeBenchmark.cxx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ int main( int argc, char * argv[] )
4040

4141
if( threads > 0 )
4242
{
43-
itk::MultiThreader::SetGlobalDefaultNumberOfThreads( threads );
43+
MultiThreaderName::SetGlobalDefaultNumberOfThreads( threads );
4444
}
4545

4646
constexpr unsigned int Dimension = 3;

examples/Filtering/MedianBenchmark.cxx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ int main( int argc, char * argv[] )
4040

4141
if( threads > 0 )
4242
{
43-
itk::MultiThreader::SetGlobalDefaultNumberOfThreads( threads );
43+
MultiThreaderName::SetGlobalDefaultNumberOfThreads( threads );
4444
}
4545

4646
constexpr unsigned int Dimension = 3;

examples/Filtering/MinMaxCurvatureFlowBenchmark.cxx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ int main( int argc, char * argv[] )
4040

4141
if( threads > 0 )
4242
{
43-
itk::MultiThreader::SetGlobalDefaultNumberOfThreads( threads );
43+
MultiThreaderName::SetGlobalDefaultNumberOfThreads( threads );
4444
}
4545

4646
constexpr unsigned int Dimension = 3;

examples/Filtering/ResampleBenchmark.cxx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ GetImageProperties( const std::string& filename, std::string& pixeltype, std::st
190190
}
191191

192192
// Extract the ImageIO from the reader
193-
ImageIOBaseType::Pointer imageIOBase = reader->GetImageIO();
193+
const ImageIOBaseType* imageIOBase = reader->GetImageIO();
194194

195195
// Get the component type, number of components, dimension and pixel type
196196
dimension = imageIOBase->GetNumberOfDimensions();
@@ -869,7 +869,7 @@ ProcessImage( const Parameters& _parameters )
869869
// Setting the threads
870870
if ( _parameters.threads > 0 )
871871
{
872-
itk::MultiThreader::SetGlobalDefaultNumberOfThreads( _parameters.threads );
872+
MultiThreaderName::SetGlobalDefaultNumberOfThreads( _parameters.threads );
873873
}
874874

875875
// Input image dimension
@@ -978,7 +978,7 @@ ProcessImage( const Parameters& _parameters )
978978
DefineExtrapolator< ExtrapolatorType >( extrapolator, _parameters.extrapolator );
979979

980980
// Print resample execution info
981-
std::cout << "Benchmarking Resample filter with " << itk::MultiThreaderBase::GetGlobalDefaultNumberOfThreads()
981+
std::cout << "Benchmarking Resample filter with " << MultiThreaderName::GetGlobalDefaultNumberOfThreads()
982982
<< " threads" << std::endl;
983983
std::cout << "Image size: " << imageSize << std::endl;
984984
std::cout << "Interpolator type: " << interpolator->GetNameOfClass() << std::endl;

examples/Filtering/UnaryAddBenchmark.cxx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ int main( int argc, char * argv[] )
6666

6767
if( threads > 0 )
6868
{
69-
itk::MultiThreader::SetGlobalDefaultNumberOfThreads( threads );
69+
MultiThreaderName::SetGlobalDefaultNumberOfThreads( threads );
7070
}
7171

7272
constexpr unsigned int Dimension = 3;

examples/Registration/DemonsRegistrationBenchmark.cxx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ int main( int argc, char * argv[] )
8181

8282
if( threads > 0 )
8383
{
84-
itk::MultiThreader::SetGlobalDefaultNumberOfThreads( threads );
84+
MultiThreaderName::SetGlobalDefaultNumberOfThreads( threads );
8585
}
8686

8787
constexpr unsigned int Dimension = 3;

examples/Registration/NormalizedCorrelationBenchmark.cxx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ int main(int argc, char * argv[])
4040

4141
if( threads > 0 )
4242
{
43-
itk::MultiThreader::SetGlobalDefaultNumberOfThreads( threads );
43+
MultiThreaderName::SetGlobalDefaultNumberOfThreads( threads );
4444
}
4545

4646
constexpr unsigned int Dimension = 3;

examples/Registration/RegistrationFrameworkBenchmark.cxx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ int main( int argc, char * argv[] )
8080

8181
if( threads > 0 )
8282
{
83-
itk::MultiThreader::SetGlobalDefaultNumberOfThreads( threads );
83+
MultiThreaderName::SetGlobalDefaultNumberOfThreads( threads );
8484
}
8585

8686
constexpr unsigned int Dimension = 3;

0 commit comments

Comments
 (0)