]> Creatis software - clitk.git/commitdiff
Ensure compatibility with ITK5
authortbaudier <thomas.baudier@creatis.insa-lyon.fr>
Tue, 7 Aug 2018 08:26:42 +0000 (10:26 +0200)
committertbaudier <thomas.baudier@creatis.insa-lyon.fr>
Tue, 7 Aug 2018 08:26:42 +0000 (10:26 +0200)
Change NumberOfThreads to NumberOfWorkUnits

14 files changed:
itk/clitkForwardWarpImageFilter.h
itk/clitkForwardWarpImageFilter.txx
itk/clitkInvertVFFilter.h
itk/clitkInvertVFFilter.txx
itk/clitkResampleImageWithOptionsFilter.txx
registration/clitkAffineRegistrationGenericFilter.cxx
registration/clitkBLUTDIRGenericFilter.cxx
registration/clitkDemonsDeformableRegistrationGenericFilter.txx
registration/clitkOptNormalizedCorrelationImageToImageMetric.txx
registration/clitkOptNormalizedCorrelationImageToImageMetricFor3DBLUTFFD.txx
registration/itkOptMattesMutualInformationImageToImageMetricFor3DBLUTFFD.txx
registration/itkOptMeanSquaresImageToImageMetricFor3DBLUTFFD.txx
tools/clitkBackProjectImageGenericFilter.txx
tools/clitkInvertVFGenericFilter.txx

index 85a5c22605a46e89f8a2def0c6396138a5271f40..7efac8fc8268291bd3564fb0a1a03045a9744cbb 100644 (file)
@@ -71,10 +71,18 @@ namespace clitk
     itkSetMacro( Verbose, bool);
     itkSetMacro( EdgePaddingValue, PixelType );
     itkSetMacro( DeformationField, typename DeformationFieldType::Pointer);
+#if ITK_VERSION_MAJOR <= 4
     void SetNumberOfThreads(unsigned int r )
+#else
+    void SetNumberOfWorkUnits(unsigned int r )
+#endif
     {
       m_NumberOfThreadsIsGiven=true;
+#if ITK_VERSION_MAJOR <= 4
       m_NumberOfThreads=r;
+#else
+      m_NumberOfWorkUnits=r;
+#endif
     }
     itkSetMacro(ThreadSafe, bool);
  
@@ -102,7 +110,11 @@ namespace clitk
   private:
     bool m_Verbose;
     bool m_NumberOfThreadsIsGiven;
+#if ITK_VERSION_MAJOR <= 4
     unsigned int m_NumberOfThreads;
+#else
+    unsigned int m_NumberOfWorkUnits;
+#endif
     PixelType m_EdgePaddingValue;
     typename DeformationFieldType::Pointer m_DeformationField;
     bool m_ThreadSafe;
index f5e98536516cb5e1657d577c50b1c8bff54d1687..4d49b4dd7e98cf9d5797fcc4127eb29d86963614 100644 (file)
@@ -445,7 +445,13 @@ void ForwardWarpImageFilter<InputImageType, OutputImageType, DeformationFieldTyp
   typename HelperClass1Type::Pointer helper1=HelperClass1Type::New();
 
   //Set input
-  if(m_NumberOfThreadsIsGiven)helper1->SetNumberOfThreads(m_NumberOfThreads);
+  if(m_NumberOfThreadsIsGiven) {
+#if ITK_VERSION_MAJOR <= 4
+    helper1->SetNumberOfThreads(m_NumberOfThreads);
+#else
+    helper1->SetNumberOfWorkUnits(m_NumberOfWorkUnits);
+#endif
+  }
   helper1->SetInput(inputPtr);
   helper1->SetDeformationField(m_DeformationField);
   helper1->SetWeights(weights);
@@ -478,7 +484,13 @@ void ForwardWarpImageFilter<InputImageType, OutputImageType, DeformationFieldTyp
   typename HelperClass2Type::Pointer helper2=HelperClass2Type::New();
 
   //Set temporary output as input
-  if(m_NumberOfThreadsIsGiven)helper2->SetNumberOfThreads(m_NumberOfThreads);
+  if(m_NumberOfThreadsIsGiven) {
+#if ITK_VERSION_MAJOR <= 4
+    helper2->SetNumberOfThreads(m_NumberOfThreads);
+#else
+    helper2->SetNumberOfWorkUnits(m_NumberOfWorkUnits);
+#endif
+  }
   helper2->SetInput(temp);
   helper2->SetWeights(weights);
   helper2->SetEdgePaddingValue(m_EdgePaddingValue);
index 52edcd922238be7a444694d062d66b593b2df5c1..8ad84a2e969c6ba75ed7da41dbe50676b4ab6a0b 100644 (file)
@@ -65,10 +65,18 @@ namespace clitk
     //Set Methods(inline)
     itkSetMacro( Verbose, bool);
     itkSetMacro( EdgePaddingValue, PixelType );
+#if ITK_VERSION_MAJOR <= 4
     void SetNumberOfThreads(unsigned int r ) ITK_OVERRIDE
+#else
+    void SetNumberOfWorkUnits(unsigned int r ) ITK_OVERRIDE
+#endif
     {
       m_NumberOfThreadsIsGiven=true;
+#if ITK_VERSION_MAJOR <= 4
       m_NumberOfThreads=r;
+#else
+      m_NumberOfWorkUnits=r;
+#endif
     }
     itkSetMacro(ThreadSafe, bool);
     itkSetMacro(OutputSpacing, SpacingType);
@@ -84,7 +92,11 @@ namespace clitk
     bool m_NumberOfThreadsIsGiven;
     SpacingType m_OutputSpacing;
     SizeType m_OutputSize;
+#if ITK_VERSION_MAJOR <= 4
     unsigned int m_NumberOfThreads;
+#else
+    unsigned int m_NumberOfWorkUnits;
+#endif
     PixelType m_EdgePaddingValue;
     bool m_ThreadSafe;
   };
index 4b982308cf2afcf906e0fd955f2bbad3c8b27be6..b2485e0e51a5f6c260c3aeed26cfc5575c396543 100644 (file)
@@ -438,7 +438,13 @@ template <class InputImageType, class OutputImageType> void InvertVFFilter<Input
   typename HelperClass1Type::Pointer helper1=HelperClass1Type::New();
 
   //Set input
-  if(m_NumberOfThreadsIsGiven)helper1->SetNumberOfThreads(m_NumberOfThreads);
+  if(m_NumberOfThreadsIsGiven) {
+#if ITK_VERSION_MAJOR <= 4
+    helper1->SetNumberOfThreads(m_NumberOfThreads);
+#else
+    helper1->SetNumberOfWorkUnits(m_NumberOfWorkUnits);
+#endif
+  }
   helper1->SetInput(inputPtr);
   helper1->SetWeights(weights);
 
@@ -468,7 +474,13 @@ template <class InputImageType, class OutputImageType> void InvertVFFilter<Input
   typename HelperClass2Type::Pointer helper2=HelperClass2Type::New();
 
   //Set temporary output as input
-  if(m_NumberOfThreadsIsGiven)helper2->SetNumberOfThreads(m_NumberOfThreads);
+  if(m_NumberOfThreadsIsGiven) {
+#if ITK_VERSION_MAJOR <= 4
+    helper2->SetNumberOfThreads(m_NumberOfThreads);
+#else
+    helper2->SetNumberOfWorkUnits(m_NumberOfWorkUnits);
+#endif
+  }
   helper2->SetInput(temp);
   helper2->SetWeights(weights);
   helper2->SetEdgePaddingValue(m_EdgePaddingValue);
index 4c949cec33eff1ade7b4fe43cfac3f4bf313a1fe..97f6f418c56bc88c0937079060002285d5184758 100644 (file)
@@ -224,7 +224,11 @@ GenerateData()
     case B_LUT: std::cout << "B-LUT " << m_BSplineOrder << " " << m_BLUTSamplingFactor << std::endl; break;
     case WSINC: std::cout << "Windowed Sinc" << std::endl; break;
     }
+#if ITK_VERSION_MAJOR <= 4
     std::cout << "Threads        = " << this->GetNumberOfThreads() << std::endl;
+#else
+    std::cout << "Threads        = " << this->GetNumberOfWorkUnits() << std::endl;
+#endif
     std::cout << "LastDimIsTime  = " << m_LastDimensionIsTime << std::endl;
   }
 
@@ -241,7 +245,11 @@ GenerateData()
   filter->SetOutputSpacing(m_OutputSpacing);
   filter->SetOutputOrigin(m_OutputOrigin);
   filter->SetDefaultPixelValue(m_DefaultPixelValue);
+#if ITK_VERSION_MAJOR <= 4
   filter->SetNumberOfThreads(this->GetNumberOfThreads());
+#else
+  filter->SetNumberOfWorkUnits(this->GetNumberOfWorkUnits());
+#endif
   filter->SetOutputDirection(m_OutputDirection); // <-- NEEDED if we want to keep orientation (in case of PermutAxes for example)
 
   // Select interpolator
index 17ebca95a720d5ec84b78286672fbdae2340dd05..d034912f7eea9497942f11d63100bfcde79e2760 100644 (file)
@@ -393,7 +393,13 @@ void AffineRegistrationGenericFilter::UpdateWithInputImageType()
   typename  MetricType::Pointer metric=genericMetric->GetMetricPointer();
   if (movingMask) metric->SetMovingImageMask(movingMask);
 
-  if (threadsGiven) metric->SetNumberOfThreads( threads );
+  if (threadsGiven) {
+#if ITK_VERSION_MAJOR <= 4
+    metric->SetNumberOfThreads( threads );
+#else
+    metric->SetNumberOfWorkUnits( threads );
+#endif
+  }
 
   //============================================================================
   // Initialize using image moments.
index 35ac6eb9e58b52d5baa09d255108657b83beaf8b..24d461361f9e27a232e54a9e3fcfd757de02f8db 100644 (file)
@@ -649,7 +649,11 @@ namespace clitk
       typename  MetricType::Pointer metric=genericMetric->GetMetricPointer();
       if (movingMask) metric->SetMovingImageMask(movingMask);
       if (threadsGiven) {
+#if ITK_VERSION_MAJOR <= 4
         metric->SetNumberOfThreads( threads );
+#else
+        metric->SetNumberOfWorkUnits( threads );
+#endif
         if (m_Verbose) std::cout<< "Using " << threads << " threads." << std::endl;
       }
 
@@ -675,7 +679,11 @@ namespace clitk
       registration->SetInterpolator(  interpolator  );
       registration->SetTransform (regTransform );
       if(threadsGiven) {
+#if ITK_VERSION_MAJOR <= 4
         registration->SetNumberOfThreads(threads);
+#else
+        registration->SetNumberOfWorkUnits(threads);
+#endif
         if (m_Verbose) std::cout<< "Using " << threads << " threads." << std::endl;
       }
       registration->SetFixedImage(  croppedFixedImage   );
@@ -793,7 +801,11 @@ namespace clitk
       typedef itk::TransformToDisplacementFieldFilter<DisplacementFieldType, double> ConvertorType;
 #endif
       typename ConvertorType::Pointer filter= ConvertorType::New();
+#if ITK_VERSION_MAJOR <= 4
       filter->SetNumberOfThreads(1);
+#else
+      filter->SetNumberOfWorkUnits(1);
+#endif
       if(m_ArgsInfo.itkbspline_flag)
         sTransform->SetBulkTransform(ITK_NULLPTR);
       else
index d4b0cb238c55665da8b57e9d9cc52f57bd0e1090..0c49dd790d771d481282ebf73c49d8f7de95d8d2 100644 (file)
@@ -335,7 +335,13 @@ namespace clitk
     // =======================================================
     // The multiresolution scheme
     // =======================================================
-    if (threadsGiven) multiResolutionFilter->SetNumberOfThreads(threads);
+    if (threadsGiven) {
+#if ITK_VERSION_MAJOR <= 4
+      multiResolutionFilter->SetNumberOfThreads(threads);
+#else
+      multiResolutionFilter->SetNumberOfWorkUnits(threads);
+#endif
+    }
     unsigned int nLevels=m_ArgsInfo.levels_arg;
     if (m_Verbose) std::cout<<"Setting the number of resolution levels to "<<nLevels<<"..."<<std::endl;
     multiResolutionFilter->SetFixedImage( fixedImage );
@@ -343,8 +349,14 @@ namespace clitk
     multiResolutionFilter->SetNumberOfLevels( nLevels );
     multiResolutionFilter->SetFixedImagePyramid( fixedImagePyramid );
     multiResolutionFilter->SetMovingImagePyramid( movingImagePyramid );
-    if (threadsGiven) multiResolutionFilter->SetNumberOfThreads( threads );
-    
+    if (threadsGiven) {
+#if ITK_VERSION_MAJOR <= 4
+      multiResolutionFilter->SetNumberOfThreads( threads );
+#else
+      multiResolutionFilter->SetNumberOfWorkUnits( threads );
+#endif
+    }
+
     //------------------------------------
     //Set the number of iterations
     //------------------------------------
index 0f8fa64c5d975dbb3c4083e6699e2dd7bc91bc2d..146fb0050198de6dc12f58e489011f5ae8b00696 100644 (file)
@@ -130,44 +130,74 @@ NormalizedCorrelationImageToImageMetric<TFixedImage,TMovingImage>
   if(m_ThreaderSFF != NULL) {
     delete [] m_ThreaderSFF;
   }
+#if ITK_VERSION_MAJOR <= 4
   m_ThreaderSFF = new double[this->m_NumberOfThreads];
+#else
+  m_ThreaderSFF = new double[this->m_NumberOfWorkUnits];
+#endif
 
 
   if(m_ThreaderSMM != NULL) {
     delete [] m_ThreaderSMM;
   }
+#if ITK_VERSION_MAJOR <= 4
   m_ThreaderSMM = new double[this->m_NumberOfThreads];
+#else
+  m_ThreaderSMM = new double[this->m_NumberOfWorkUnits];
+#endif
 
   if(m_ThreaderSFM != NULL) {
     delete [] m_ThreaderSFM;
   }
+#if ITK_VERSION_MAJOR <= 4
   m_ThreaderSFM = new double[this->m_NumberOfThreads];
+#else
+  m_ThreaderSFM = new double[this->m_NumberOfWorkUnits];
+#endif
 
   if(this->m_SubtractMean) {
     if(m_ThreaderSF != NULL) {
       delete [] m_ThreaderSF;
     }
+#if ITK_VERSION_MAJOR <= 4
     m_ThreaderSF = new double[this->m_NumberOfThreads];
+#else
+    m_ThreaderSF = new double[this->m_NumberOfWorkUnits];
+#endif
 
     if(m_ThreaderSM != NULL) {
       delete [] m_ThreaderSM;
     }
+#if ITK_VERSION_MAJOR <= 4
     m_ThreaderSM = new double[this->m_NumberOfThreads];
+#else
+    m_ThreaderSM = new double[this->m_NumberOfWorkUnits];
+#endif
   }
 
   if(m_ThreaderDerivativeF != NULL) {
     delete [] m_ThreaderDerivativeF;
   }
+#if ITK_VERSION_MAJOR <= 4
   m_ThreaderDerivativeF = new DerivativeType[this->m_NumberOfThreads];
   for(unsigned int threadID=0; threadID<this->m_NumberOfThreads; threadID++) {
+#else
+  m_ThreaderDerivativeF = new DerivativeType[this->m_NumberOfWorkUnits];
+  for(unsigned int threadID=0; threadID<this->m_NumberOfWorkUnits; threadID++) {
+#endif
     m_ThreaderDerivativeF[threadID].SetSize( this->m_NumberOfParameters );
   }
 
   if(m_ThreaderDerivativeM != NULL) {
     delete [] m_ThreaderDerivativeM;
   }
+#if ITK_VERSION_MAJOR <= 4
   m_ThreaderDerivativeM = new DerivativeType[this->m_NumberOfThreads];
   for(unsigned int threadID=0; threadID<this->m_NumberOfThreads; threadID++) {
+#else
+  m_ThreaderDerivativeM = new DerivativeType[this->m_NumberOfWorkUnits];
+  for(unsigned int threadID=0; threadID<this->m_NumberOfWorkUnits; threadID++) {
+#endif
     m_ThreaderDerivativeM[threadID].SetSize( this->m_NumberOfParameters );
   }
 }
@@ -208,12 +238,23 @@ NormalizedCorrelationImageToImageMetric<TFixedImage,TMovingImage>
 
 
   //Reset the accumulators
+#if ITK_VERSION_MAJOR <= 4
   memset( m_ThreaderSFF,  0,  this->m_NumberOfThreads * sizeof(AccumulateType) );
   memset( m_ThreaderSMM,  0,  this->m_NumberOfThreads * sizeof(AccumulateType) );
   memset( m_ThreaderSFM,  0,  this->m_NumberOfThreads * sizeof(AccumulateType) );
+#else
+  memset( m_ThreaderSFF,  0,  this->m_NumberOfWorkUnits * sizeof(AccumulateType) );
+  memset( m_ThreaderSMM,  0,  this->m_NumberOfWorkUnits * sizeof(AccumulateType) );
+  memset( m_ThreaderSFM,  0,  this->m_NumberOfWorkUnits * sizeof(AccumulateType) );
+#endif
   if(this->m_SubtractMean) {
+#if ITK_VERSION_MAJOR <= 4
     memset( m_ThreaderSF,  0,  this->m_NumberOfThreads * sizeof(AccumulateType) );
     memset( m_ThreaderSM,  0,  this->m_NumberOfThreads * sizeof(AccumulateType) );
+#else
+    memset( m_ThreaderSF,  0,  this->m_NumberOfWorkUnits * sizeof(AccumulateType) );
+    memset( m_ThreaderSM,  0,  this->m_NumberOfWorkUnits * sizeof(AccumulateType) );
+#endif
   }
 
 
@@ -244,7 +285,11 @@ NormalizedCorrelationImageToImageMetric<TFixedImage,TMovingImage>
   sf  = m_ThreaderSF[0];
   sm  = m_ThreaderSM[0];
 
+#if ITK_VERSION_MAJOR <= 4
   for(unsigned int t=1; t<this->m_NumberOfThreads; t++) {
+#else
+  for(unsigned int t=1; t<this->m_NumberOfWorkUnits; t++) {
+#endif
     sff +=  m_ThreaderSFF[t];
     smm +=  m_ThreaderSMM[t];
     sfm +=  m_ThreaderSFM[t];
@@ -282,12 +327,23 @@ NormalizedCorrelationImageToImageMetric<TFixedImage,TMovingImage>
 {
   //No checking for the fixed image,  done in the caller
   //Reset the accumulators
+#if ITK_VERSION_MAJOR <= 4
   memset( m_ThreaderSFF,  0,  this->m_NumberOfThreads * sizeof(AccumulateType) );
   memset( m_ThreaderSMM,  0,  this->m_NumberOfThreads * sizeof(AccumulateType) );
   memset( m_ThreaderSFM,  0,  this->m_NumberOfThreads * sizeof(AccumulateType) );
+#else
+  memset( m_ThreaderSFF,  0,  this->m_NumberOfWorkUnits * sizeof(AccumulateType) );
+  memset( m_ThreaderSMM,  0,  this->m_NumberOfWorkUnits * sizeof(AccumulateType) );
+  memset( m_ThreaderSFM,  0,  this->m_NumberOfWorkUnits * sizeof(AccumulateType) );
+#endif
   if(this->m_SubtractMean) {
+#if ITK_VERSION_MAJOR <= 4
     memset( m_ThreaderSF,  0,  this->m_NumberOfThreads * sizeof(AccumulateType) );
     memset( m_ThreaderSM,  0,  this->m_NumberOfThreads * sizeof(AccumulateType) );
+#else
+    memset( m_ThreaderSF,  0,  this->m_NumberOfWorkUnits * sizeof(AccumulateType) );
+    memset( m_ThreaderSM,  0,  this->m_NumberOfWorkUnits * sizeof(AccumulateType) );
+#endif
   }
 
 
@@ -317,7 +373,11 @@ NormalizedCorrelationImageToImageMetric<TFixedImage,TMovingImage>
   m_SF  = m_ThreaderSF[0];
   m_SM  = m_ThreaderSM[0];
 
+#if ITK_VERSION_MAJOR <= 4
   for(unsigned int t=1; t<this->m_NumberOfThreads; t++) {
+#else
+  for(unsigned int t=1; t<this->m_NumberOfWorkUnits; t++) {
+#endif
     m_SFF +=  m_ThreaderSFF[t];
     m_SMM +=  m_ThreaderSMM[t];
     m_SFM +=  m_ThreaderSFM[t];
@@ -431,8 +491,11 @@ NormalizedCorrelationImageToImageMetric<TFixedImage,TMovingImage>
   memset( derivative.data_block(),
           0,
           this->m_NumberOfParameters * sizeof(typename DerivativeType::ValueType) );
-
+#if ITK_VERSION_MAJOR <= 4
   for( unsigned int threadID = 0; threadID<this->m_NumberOfThreads; threadID++ ) {
+#else
+  for( unsigned int threadID = 0; threadID<this->m_NumberOfWorkUnits; threadID++ ) {
+#endif
     memset( m_ThreaderDerivativeF[threadID].data_block(),
             0,
             this->m_NumberOfParameters * sizeof(typename DerivativeType::ValueType) );
@@ -447,7 +510,11 @@ NormalizedCorrelationImageToImageMetric<TFixedImage,TMovingImage>
 
   // Accumulate over the threads
   DerivativeType derivativeF(this->m_NumberOfParameters), derivativeM(this->m_NumberOfParameters);
+#if ITK_VERSION_MAJOR <= 4
   for(unsigned int t=0; t<this->m_NumberOfThreads; t++) {
+#else
+  for(unsigned int t=0; t<this->m_NumberOfWorkUnits; t++) {
+#endif
     for(unsigned int parameter = 0; parameter < this->m_NumberOfParameters; parameter++) {
       derivativeF[parameter] += m_ThreaderDerivativeF[t][parameter];
       derivativeM[parameter] += m_ThreaderDerivativeM[t][parameter];
index 959bfed1afd56d50dca9a3ec725c8f2f306873c6..5ed23c31418da0a1b88f4a2dd9c604c1c62118b4 100644 (file)
@@ -130,44 +130,74 @@ NormalizedCorrelationImageToImageMetricFor3DBLUTFFD<TFixedImage,TMovingImage>
   if(m_ThreaderSFF != NULL) {
     delete [] m_ThreaderSFF;
   }
+#if ITK_VERSION_MAJOR <= 4
   m_ThreaderSFF = new double[this->m_NumberOfThreads];
+#else
+  m_ThreaderSFF = new double[this->m_NumberOfWorkUnits];
+#endif
 
 
   if(m_ThreaderSMM != NULL) {
     delete [] m_ThreaderSMM;
   }
+#if ITK_VERSION_MAJOR <= 4
   m_ThreaderSMM = new double[this->m_NumberOfThreads];
+#else
+  m_ThreaderSMM = new double[this->m_NumberOfWorkUnits];
+#endif
 
   if(m_ThreaderSFM != NULL) {
     delete [] m_ThreaderSFM;
   }
+#if ITK_VERSION_MAJOR <= 4
   m_ThreaderSFM = new double[this->m_NumberOfThreads];
+#else
+  m_ThreaderSFM = new double[this->m_NumberOfWorkUnits];
+#endif
 
   if(this->m_SubtractMean) {
     if(m_ThreaderSF != NULL) {
       delete [] m_ThreaderSF;
     }
+#if ITK_VERSION_MAJOR <= 4
     m_ThreaderSF = new double[this->m_NumberOfThreads];
+#else
+    m_ThreaderSF = new double[this->m_NumberOfWorkUnits];
+#endif
 
     if(m_ThreaderSM != NULL) {
       delete [] m_ThreaderSM;
     }
+#if ITK_VERSION_MAJOR <= 4
     m_ThreaderSM = new double[this->m_NumberOfThreads];
+#else
+    m_ThreaderSM = new double[this->m_NumberOfWorkUnits];
+#endif
   }
 
   if(m_ThreaderDerivativeF != NULL) {
     delete [] m_ThreaderDerivativeF;
   }
+#if ITK_VERSION_MAJOR <= 4
   m_ThreaderDerivativeF = new DerivativeType[this->m_NumberOfThreads];
   for(unsigned int threadID=0; threadID<this->m_NumberOfThreads; threadID++) {
+#else
+  m_ThreaderDerivativeF = new DerivativeType[this->m_NumberOfWorkUnits];
+  for(unsigned int threadID=0; threadID<this->m_NumberOfWorkUnits; threadID++) {
+#endif
     m_ThreaderDerivativeF[threadID].SetSize( this->m_NumberOfParameters );
   }
 
   if(m_ThreaderDerivativeM != NULL) {
     delete [] m_ThreaderDerivativeM;
   }
+#if ITK_VERSION_MAJOR <= 4
   m_ThreaderDerivativeM = new DerivativeType[this->m_NumberOfThreads];
   for(unsigned int threadID=0; threadID<this->m_NumberOfThreads; threadID++) {
+#else
+  m_ThreaderDerivativeM = new DerivativeType[this->m_NumberOfWorkUnits];
+  for(unsigned int threadID=0; threadID<this->m_NumberOfWorkUnits; threadID++) {
+#endif
     m_ThreaderDerivativeM[threadID].SetSize( this->m_NumberOfParameters );
   }
 }
@@ -208,12 +238,23 @@ NormalizedCorrelationImageToImageMetricFor3DBLUTFFD<TFixedImage,TMovingImage>
 
 
   //Reset the accumulators
+#if ITK_VERSION_MAJOR <= 4
   memset( m_ThreaderSFF,  0,  this->m_NumberOfThreads * sizeof(AccumulateType) );
   memset( m_ThreaderSMM,  0,  this->m_NumberOfThreads * sizeof(AccumulateType) );
   memset( m_ThreaderSFM,  0,  this->m_NumberOfThreads * sizeof(AccumulateType) );
+#else
+  memset( m_ThreaderSFF,  0,  this->m_NumberOfWorkUnits * sizeof(AccumulateType) );
+  memset( m_ThreaderSMM,  0,  this->m_NumberOfWorkUnits * sizeof(AccumulateType) );
+  memset( m_ThreaderSFM,  0,  this->m_NumberOfWorkUnits * sizeof(AccumulateType) );
+#endif
   if(this->m_SubtractMean) {
+#if ITK_VERSION_MAJOR <= 4
     memset( m_ThreaderSF,  0,  this->m_NumberOfThreads * sizeof(AccumulateType) );
     memset( m_ThreaderSM,  0,  this->m_NumberOfThreads * sizeof(AccumulateType) );
+#else
+    memset( m_ThreaderSF,  0,  this->m_NumberOfWorkUnits * sizeof(AccumulateType) );
+    memset( m_ThreaderSM,  0,  this->m_NumberOfWorkUnits * sizeof(AccumulateType) );
+#endif
   }
 
 
@@ -244,7 +285,11 @@ NormalizedCorrelationImageToImageMetricFor3DBLUTFFD<TFixedImage,TMovingImage>
   sf  = m_ThreaderSF[0];
   sm  = m_ThreaderSM[0];
 
+#if ITK_VERSION_MAJOR <= 4
   for(unsigned int t=1; t<this->m_NumberOfThreads; t++) {
+#else
+  for(unsigned int t=1; t<this->m_NumberOfWorkUnits; t++) {
+#endif
     sff +=  m_ThreaderSFF[t];
     smm +=  m_ThreaderSMM[t];
     sfm +=  m_ThreaderSFM[t];
@@ -282,12 +327,23 @@ NormalizedCorrelationImageToImageMetricFor3DBLUTFFD<TFixedImage,TMovingImage>
 {
   //No checking for the fixed image,  done in the caller
   //Reset the accumulators
+#if ITK_VERSION_MAJOR <= 4
   memset( m_ThreaderSFF,  0,  this->m_NumberOfThreads * sizeof(AccumulateType) );
   memset( m_ThreaderSMM,  0,  this->m_NumberOfThreads * sizeof(AccumulateType) );
   memset( m_ThreaderSFM,  0,  this->m_NumberOfThreads * sizeof(AccumulateType) );
+#else
+  memset( m_ThreaderSFF,  0,  this->m_NumberOfWorkUnits * sizeof(AccumulateType) );
+  memset( m_ThreaderSMM,  0,  this->m_NumberOfWorkUnits * sizeof(AccumulateType) );
+  memset( m_ThreaderSFM,  0,  this->m_NumberOfWorkUnits * sizeof(AccumulateType) );
+#endif
   if(this->m_SubtractMean) {
+#if ITK_VERSION_MAJOR <= 4
     memset( m_ThreaderSF,  0,  this->m_NumberOfThreads * sizeof(AccumulateType) );
     memset( m_ThreaderSM,  0,  this->m_NumberOfThreads * sizeof(AccumulateType) );
+#else
+    memset( m_ThreaderSF,  0,  this->m_NumberOfWorkUnits * sizeof(AccumulateType) );
+    memset( m_ThreaderSM,  0,  this->m_NumberOfWorkUnits * sizeof(AccumulateType) );
+#endif
   }
 
 
@@ -317,7 +373,11 @@ NormalizedCorrelationImageToImageMetricFor3DBLUTFFD<TFixedImage,TMovingImage>
   m_SF  = m_ThreaderSF[0];
   m_SM  = m_ThreaderSM[0];
 
+#if ITK_VERSION_MAJOR <= 4
   for(unsigned int t=1; t<this->m_NumberOfThreads; t++) {
+#else
+  for(unsigned int t=1; t<this->m_NumberOfWorkUnits; t++) {
+#endif
     m_SFF +=  m_ThreaderSFF[t];
     m_SMM +=  m_ThreaderSMM[t];
     m_SFM +=  m_ThreaderSFM[t];
@@ -457,7 +517,11 @@ NormalizedCorrelationImageToImageMetricFor3DBLUTFFD<TFixedImage,TMovingImage>
           0,
           this->m_NumberOfParameters * sizeof(typename DerivativeType::ValueType) );
 
+#if ITK_VERSION_MAJOR <= 4
   for( unsigned int threadID = 0; threadID<this->m_NumberOfThreads; threadID++ ) {
+#else
+  for( unsigned int threadID = 0; threadID<this->m_NumberOfWorkUnits; threadID++ ) {
+#endif
     memset( m_ThreaderDerivativeF[threadID].data_block(),
             0,
             this->m_NumberOfParameters * sizeof(typename DerivativeType::ValueType) );
@@ -472,7 +536,11 @@ NormalizedCorrelationImageToImageMetricFor3DBLUTFFD<TFixedImage,TMovingImage>
 
   // Accumulate over the threads
   DerivativeType derivativeF(this->m_NumberOfParameters), derivativeM(this->m_NumberOfParameters);
+#if ITK_VERSION_MAJOR <= 4
   for(unsigned int t=0; t<this->m_NumberOfThreads; t++) {
+#else
+  for(unsigned int t=0; t<this->m_NumberOfWorkUnits; t++) {
+#endif
     for(unsigned int parameter = 0; parameter < this->m_NumberOfParameters; parameter++) {
       derivativeF[parameter] += m_ThreaderDerivativeF[t][parameter];
       derivativeM[parameter] += m_ThreaderDerivativeM[t][parameter];
index dec3acff0b59f079ae9922cd8828cdd057eb0941..96e8f0a125bf4d10df79bc2553d6ec33b75b0fb7 100644 (file)
@@ -192,7 +192,11 @@ MattesMutualInformationImageToImageMetricFor3DBLUTFFD<TFixedImage,TMovingImage>
   typename FixedImageStatisticsFilterType::Pointer fixedImageStats =
     FixedImageStatisticsFilterType::New();
   fixedImageStats->SetInput( this->m_FixedImage );
+#if ITK_VERSION_MAJOR <= 4
   fixedImageStats->SetNumberOfThreads( this->m_NumberOfThreads );
+#else
+  fixedImageStats->SetNumberOfWorkUnits( this->m_NumberOfWorkUnits );
+#endif
   fixedImageStats->Update();
 
   m_FixedImageTrueMin = fixedImageStats->GetMinimum();
@@ -205,7 +209,11 @@ MattesMutualInformationImageToImageMetricFor3DBLUTFFD<TFixedImage,TMovingImage>
   typename MovingImageStatisticsFilterType::Pointer movingImageStats =
     MovingImageStatisticsFilterType::New();
   movingImageStats->SetInput( this->m_MovingImage );
+#if ITK_VERSION_MAJOR <= 4
   movingImageStats->SetNumberOfThreads( this->m_NumberOfThreads );
+#else
+  movingImageStats->SetNumberOfWorkUnits( this->m_NumberOfWorkUnits );
+#endif
   movingImageStats->Update();
 
   m_MovingImageTrueMin = movingImageStats->GetMinimum();
@@ -362,35 +370,62 @@ MattesMutualInformationImageToImageMetricFor3DBLUTFFD<TFixedImage,TMovingImage>
   }
   // Assumes number of threads doesn't change between calls to Initialize
   m_ThreaderFixedImageMarginalPDF = new
-  PDFValueType[(this->m_NumberOfThreads-1)
-               * m_NumberOfHistogramBins];
+#if ITK_VERSION_MAJOR <= 4
+  PDFValueType[(this->m_NumberOfThreads-1) * m_NumberOfHistogramBins];
+#else
+  PDFValueType[(this->m_NumberOfWorkUnits-1) * m_NumberOfHistogramBins];
+#endif
 
   if(m_ThreaderJointPDF != NULL) {
     delete [] m_ThreaderJointPDF;
   }
   m_ThreaderJointPDF = new typename
+#if ITK_VERSION_MAJOR <= 4
   JointPDFType::Pointer[this->m_NumberOfThreads-1];
+#else
+  JointPDFType::Pointer[this->m_NumberOfWorkUnits-1];
+#endif
 
   if(m_ThreaderJointPDFStartBin != NULL) {
     delete [] m_ThreaderJointPDFStartBin;
   }
+#if ITK_VERSION_MAJOR <= 4
   m_ThreaderJointPDFStartBin = new int[this->m_NumberOfThreads];
+#else
+  m_ThreaderJointPDFStartBin = new int[this->m_NumberOfWorkUnits];
+#endif
 
   if(m_ThreaderJointPDFEndBin != NULL) {
     delete [] m_ThreaderJointPDFEndBin;
   }
+#if ITK_VERSION_MAJOR <= 4
   m_ThreaderJointPDFEndBin = new int[this->m_NumberOfThreads];
+#else
+  m_ThreaderJointPDFEndBin = new int[this->m_NumberOfWorkUnits];
+#endif
 
   if(m_ThreaderJointPDFSum != NULL) {
     delete [] m_ThreaderJointPDFSum;
   }
+#if ITK_VERSION_MAJOR <= 4
   m_ThreaderJointPDFSum = new double[this->m_NumberOfThreads];
+#else
+  m_ThreaderJointPDFSum = new double[this->m_NumberOfWorkUnits];
+#endif
 
   unsigned int threadID;
 
+#if ITK_VERSION_MAJOR <= 4
   int binRange = m_NumberOfHistogramBins / this->m_NumberOfThreads;
+#else
+  int binRange = m_NumberOfHistogramBins / this->m_NumberOfWorkUnits;
+#endif
 
+#if ITK_VERSION_MAJOR <= 4
   for(threadID = 0; threadID < this->m_NumberOfThreads-1; threadID++) {
+#else
+  for(threadID = 0; threadID < this->m_NumberOfWorkUnits-1; threadID++) {
+#endif
     m_ThreaderJointPDF[threadID] = JointPDFType::New();
     m_ThreaderJointPDF[threadID]->SetRegions( jointPDFRegion );
     m_ThreaderJointPDF[threadID]->Allocate();
@@ -399,10 +434,13 @@ MattesMutualInformationImageToImageMetricFor3DBLUTFFD<TFixedImage,TMovingImage>
     m_ThreaderJointPDFEndBin[threadID] = (threadID + 1) * binRange - 1;
   }
 
-  m_ThreaderJointPDFStartBin[this->m_NumberOfThreads-1] =
-    (this->m_NumberOfThreads - 1 ) * binRange;
-
+#if ITK_VERSION_MAJOR <= 4
+  m_ThreaderJointPDFStartBin[this->m_NumberOfThreads-1] = (this->m_NumberOfThreads - 1 ) * binRange;
   m_ThreaderJointPDFEndBin[this->m_NumberOfThreads-1] = m_NumberOfHistogramBins - 1;
+#else
+  m_ThreaderJointPDFStartBin[this->m_NumberOfWorkUnits-1] = (this->m_NumberOfWorkUnits - 1 ) * binRange;
+  m_ThreaderJointPDFEndBin[this->m_NumberOfWorkUnits-1] = m_NumberOfHistogramBins - 1;
+#endif
 
   // Release memory of arrays that may have been used for
   // previous executions of this metric with different settings
@@ -420,18 +458,34 @@ MattesMutualInformationImageToImageMetricFor3DBLUTFFD<TFixedImage,TMovingImage>
 
   if( this->m_UseExplicitPDFDerivatives ) {
     m_ThreaderJointPDFDerivatives = new typename
+#if ITK_VERSION_MAJOR <= 4
     JointPDFDerivativesType::Pointer[this->m_NumberOfThreads-1];
+#else
+    JointPDFDerivativesType::Pointer[this->m_NumberOfWorkUnits-1];
+#endif
 
+#if ITK_VERSION_MAJOR <= 4
     for(threadID = 0; threadID < this->m_NumberOfThreads-1; threadID++) {
+#else
+    for(threadID = 0; threadID < this->m_NumberOfWorkUnits-1; threadID++) {
+#endif
       m_ThreaderJointPDFDerivatives[threadID] = JointPDFDerivativesType::New();
       m_ThreaderJointPDFDerivatives[threadID]->SetRegions(
         jointPDFDerivativesRegion );
       m_ThreaderJointPDFDerivatives[threadID]->Allocate();
     }
   } else {
+#if ITK_VERSION_MAJOR <= 4
     m_ThreaderMetricDerivative = new DerivativeType[this->m_NumberOfThreads-1];
+#else
+    m_ThreaderMetricDerivative = new DerivativeType[this->m_NumberOfWorkUnits-1];
+#endif
 
+#if ITK_VERSION_MAJOR <= 4
     for(threadID = 0; threadID < this->m_NumberOfThreads-1; threadID++) {
+#else
+    for(threadID = 0; threadID < this->m_NumberOfWorkUnits-1; threadID++) {
+#endif
       this->m_ThreaderMetricDerivative[threadID] = DerivativeType( this->GetNumberOfParameters() );
     }
   }
@@ -595,7 +649,11 @@ MattesMutualInformationImageToImageMetricFor3DBLUTFFD<TFixedImage,TMovingImage>
   unsigned int       tPdfPtrOffset;
   tPdfPtrOffset = ( m_ThreaderJointPDFStartBin[threadID]
                     * m_JointPDF->GetOffsetTable()[1] );
+#if ITK_VERSION_MAJOR <= 4
   for(t=0; t<this->m_NumberOfThreads-1; t++) {
+#else
+  for(t=0; t<this->m_NumberOfWorkUnits-1; t++) {
+#endif
     pdfPtr = pdfPtrStart;
     tPdfPtr = m_ThreaderJointPDF[t]->GetBufferPointer() + tPdfPtrOffset;
     tPdfPtrEnd = tPdfPtr + maxI;
@@ -637,7 +695,11 @@ MattesMutualInformationImageToImageMetricFor3DBLUTFFD<TFixedImage,TMovingImage>
   // MUST BE CALLED TO INITIATE PROCESSING
   this->GetValueMultiThreadedPostProcessInitiate();
 
+#if ITK_VERSION_MAJOR <= 4
   for(unsigned int threadID = 0; threadID<this->m_NumberOfThreads-1; threadID++) {
+#else
+  for(unsigned int threadID = 0; threadID<this->m_NumberOfWorkUnits-1; threadID++) {
+#endif
     m_JointPDFSum += m_ThreaderJointPDFSum[threadID];
   }
   if ( m_JointPDFSum == 0.0 ) {
@@ -883,7 +945,11 @@ MattesMutualInformationImageToImageMetricFor3DBLUTFFD<TFixedImage,TMovingImage>
     JointPDFDerivativesValueType *tPdfDPtrEnd;
     unsigned int tPdfDPtrOffset;
     tPdfDPtrOffset = m_ThreaderJointPDFStartBin[threadID] *  rowSize;
+#if ITK_VERSION_MAJOR <= 4
     for(unsigned int t=0; t<this->m_NumberOfThreads-1; t++) {
+#else
+    for(unsigned int t=0; t<this->m_NumberOfWorkUnits-1; t++) {
+#endif
       pdfDPtr = pdfDPtrStart;
       tPdfDPtr = m_ThreaderJointPDFDerivatives[t]->GetBufferPointer()
                  + tPdfDPtrOffset;
@@ -930,7 +996,11 @@ MattesMutualInformationImageToImageMetricFor3DBLUTFFD<TFixedImage,TMovingImage>
   } else {
     this->m_PRatioArray.Fill( 0.0 );
     this->m_MetricDerivative.Fill( NumericTraits< MeasureType >::Zero );
+#if ITK_VERSION_MAJOR <= 4
     for(unsigned int threadID = 0; threadID < this->m_NumberOfThreads-1; threadID++ ) {
+#else
+    for(unsigned int threadID = 0; threadID < this->m_NumberOfWorkUnits-1; threadID++ ) {
+#endif
       this->m_ThreaderMetricDerivative[threadID].Fill( NumericTraits< MeasureType >::Zero );
     }
     this->m_ImplicitDerivativesSecondPass = false;
@@ -945,7 +1015,11 @@ MattesMutualInformationImageToImageMetricFor3DBLUTFFD<TFixedImage,TMovingImage>
   // CALL IF DOING THREADED POST PROCESSING
   this->GetValueAndDerivativeMultiThreadedPostProcessInitiate();
 
+#if ITK_VERSION_MAJOR <= 4
   for(unsigned int threadID = 0; threadID<this->m_NumberOfThreads-1; threadID++) {
+#else
+  for(unsigned int threadID = 0; threadID<this->m_NumberOfWorkUnits-1; threadID++) {
+#endif
     m_JointPDFSum += m_ThreaderJointPDFSum[threadID];
   }
   if ( m_JointPDFSum == 0.0 ) {
@@ -1054,7 +1128,11 @@ MattesMutualInformationImageToImageMetricFor3DBLUTFFD<TFixedImage,TMovingImage>
 
     // Consolidate the contributions from each one of the threads to the total
     // derivative.
+#if ITK_VERSION_MAJOR <= 4
     for(unsigned int t = 0; t < this->m_NumberOfThreads-1; t++ ) {
+#else
+    for(unsigned int t = 0; t < this->m_NumberOfWorkUnits-1; t++ ) {
+#endif
       DerivativeType * source = &(this->m_ThreaderMetricDerivative[t]);
       for(unsigned int pp=0; pp < this->m_NumberOfParameters; pp++ ) {
         this->m_MetricDerivative[pp] += (*source)[pp];
index dd7000ddec171559063f684d1218d9014cdeddd4..39cfa8ea688374fcf04cdc7cd3baf08b35f10499 100644 (file)
@@ -109,13 +109,22 @@ MeanSquaresImageToImageMetricFor3DBLUTFFD<TFixedImage,TMovingImage>
   if(m_ThreaderMSE != NULL) {
     delete [] m_ThreaderMSE;
   }
+#if ITK_VERSION_MAJOR <= 4
   m_ThreaderMSE = new double[this->m_NumberOfThreads];
+#else
+  m_ThreaderMSE = new double[this->m_NumberOfWorkUnits];
+#endif
 
   if(m_ThreaderMSEDerivatives != NULL) {
     delete [] m_ThreaderMSEDerivatives;
   }
+#if ITK_VERSION_MAJOR <= 4
   m_ThreaderMSEDerivatives = new DerivativeType[this->m_NumberOfThreads];
   for(unsigned int threadID=0; threadID<this->m_NumberOfThreads; threadID++) {
+#else
+  m_ThreaderMSEDerivatives = new DerivativeType[this->m_NumberOfWorkUnits];
+  for(unsigned int threadID=0; threadID<this->m_NumberOfWorkUnits; threadID++) {
+#endif
     m_ThreaderMSEDerivatives[threadID].SetSize( this->m_NumberOfParameters );
   }
 }
@@ -147,9 +156,11 @@ MeanSquaresImageToImageMetricFor3DBLUTFFD<TFixedImage,TMovingImage>
     itkExceptionMacro( << "Fixed image has not been assigned" );
   }
 
-  memset( m_ThreaderMSE,
-          0,
-          this->m_NumberOfThreads * sizeof(MeasureType) );
+#if ITK_VERSION_MAJOR <= 4
+  memset( m_ThreaderMSE, 0, this->m_NumberOfThreads * sizeof(MeasureType) );
+#else
+  memset( m_ThreaderMSE, 0, this->m_NumberOfWorkUnits * sizeof(MeasureType) );
+#endif
 
   // Set up the parameters in the transform
   this->m_Transform->SetParameters( parameters );
@@ -171,7 +182,11 @@ MeanSquaresImageToImageMetricFor3DBLUTFFD<TFixedImage,TMovingImage>
   }
 
   double mse = m_ThreaderMSE[0];
+#if ITK_VERSION_MAJOR <= 4
   for(unsigned int t=1; t<this->m_NumberOfThreads; t++) {
+#else
+  for(unsigned int t=1; t<this->m_NumberOfWorkUnits; t++) {
+#endif
     mse += m_ThreaderMSE[t];
   }
   mse /= this->m_NumberOfPixelsCounted;
@@ -252,9 +267,11 @@ MeanSquaresImageToImageMetricFor3DBLUTFFD<TFixedImage,TMovingImage>
   this->m_Transform->SetParameters( parameters );
 
   // Reset the joint pdfs to zero
-  memset( m_ThreaderMSE,
-          0,
-          this->m_NumberOfThreads * sizeof(MeasureType) );
+#if ITK_VERSION_MAJOR <= 4
+  memset( m_ThreaderMSE, 0, this->m_NumberOfThreads * sizeof(MeasureType) );
+#else
+  memset( m_ThreaderMSE, 0, this->m_NumberOfWorkUnits * sizeof(MeasureType) );
+#endif
 
   // Set output values to zero
   if(derivative.GetSize() != this->m_NumberOfParameters) {
@@ -264,7 +281,11 @@ MeanSquaresImageToImageMetricFor3DBLUTFFD<TFixedImage,TMovingImage>
           0,
           this->m_NumberOfParameters * sizeof(double) );
 
+#if ITK_VERSION_MAJOR <= 4
   for( unsigned int threadID = 0; threadID<this->m_NumberOfThreads; threadID++ ) {
+#else
+  for( unsigned int threadID = 0; threadID<this->m_NumberOfWorkUnits; threadID++ ) {
+#endif
     memset( m_ThreaderMSEDerivatives[threadID].data_block(),
             0,
             this->m_NumberOfParameters * sizeof(double) );
@@ -287,7 +308,11 @@ MeanSquaresImageToImageMetricFor3DBLUTFFD<TFixedImage,TMovingImage>
   }
 
   value = 0;
+#if ITK_VERSION_MAJOR <= 4
   for(unsigned int t=0; t<this->m_NumberOfThreads; t++) {
+#else
+  for(unsigned int t=0; t<this->m_NumberOfWorkUnits; t++) {
+#endif
     value += m_ThreaderMSE[t];
     for(unsigned int parameter = 0; parameter < this->m_NumberOfParameters;
         parameter++) {
index b13186e8646e19348d9551527a87e65e55b1bbd7..d5a552d3e582cd56a1ab8f3276adb069ee406acc 100644 (file)
@@ -62,7 +62,13 @@ namespace clitk
     //---------------------------------
     unsigned int i=0;
     filter->SetInput(input);
-    if (m_ArgsInfo.threads_given) filter->SetNumberOfThreads(m_ArgsInfo.threads_arg);
+    if (m_ArgsInfo.threads_given) {
+#if ITK_VERSION_MAJOR <= 4
+      filter->SetNumberOfThreads(m_ArgsInfo.threads_arg);
+#else
+      filter->SetNumberOfWorkUnits(m_ArgsInfo.threads_arg);
+#endif
+    }
 
     //Projection parameters
     OutputImageType::PointType iso;
index a18a6417c6b0ad26c3efc14225fba5d1c7444153..405540c41f4494b3e4c3c0749dbaab07f6f5673e 100644 (file)
@@ -156,7 +156,13 @@ InvertVFGenericFilter<args_info_type>::UpdateWithDimAndPixelType()
       filter->SetInput(input);
 
     filter->SetVerbose(m_Verbose);
-    if (m_ArgsInfo.threads_given) filter->SetNumberOfThreads(m_ArgsInfo.threads_arg);
+    if (m_ArgsInfo.threads_given) {
+#if ITK_VERSION_MAJOR <= 4
+      filter->SetNumberOfThreads(m_ArgsInfo.threads_arg);
+#else
+      filter->SetNumberOfWorkUnits(m_ArgsInfo.threads_arg);
+#endif
+    }
     if (m_ArgsInfo.pad_given) {
       PixelType pad;
       if (m_ArgsInfo.pad_given !=  (pad.GetNumberOfComponents()) )
@@ -187,7 +193,13 @@ InvertVFGenericFilter<args_info_type>::UpdateWithDimAndPixelType()
     }
 
     filter->SetVerbose(m_Verbose);
-    if (m_ArgsInfo.threads_given) filter->SetNumberOfThreads(m_ArgsInfo.threads_arg);
+    if (m_ArgsInfo.threads_given) {
+#if ITK_VERSION_MAJOR <= 4
+      filter->SetNumberOfThreads(m_ArgsInfo.threads_arg);
+#else
+      filter->SetNumberOfWorkUnits(m_ArgsInfo.threads_arg);
+#endif
+    }
     if (m_ArgsInfo.pad_given) {
       PixelType pad;
       if (m_ArgsInfo.pad_given !=  (pad.GetNumberOfComponents()) )