[Insight-developers] Slicer4 changes needed because of ITKv4 API change

Bill Lorensen bill.lorensen at gmail.com
Fri Jun 17 13:35:52 EDT 2011


Folks,

For the record, I just changed almost 20 files in Slicer4 to
accommodate the change to the API of ThreadedGenerateData. The Slicer4
changes were made to work with both ITK 3.20 and ITKv4.

For the 10 filters that implemented ThreadedGenerateData I added to
the .h files:
#if ITK_VERSION_MAJOR < 4
void ThreadedGenerateData( const OutputImageRegionType &outputRegionForThread ,
                           int threadId ) ;
#else
void ThreadedGenerateData( const OutputImageRegionType &outputRegionForThread ,
                           ThreadIdType threadId ) ;
#endif

and to the .txx files lines similar to this:

#if ITK_VERSION_MAJOR < 4
void OtsuThreshold< TInputImage, TOutputImage>
::ThreadedGenerateData( const OutputImageRegionType&
outputRegionForThread, int threadId )
#else
void OtsuThreshold< TInputImage, TOutputImage>
::ThreadedGenerateData( const OutputImageRegionType&
outputRegionForThread, ThreadIdType threadId )

#endif

This is just a reminder of how our API changes affect our customers.

BTW, a recent commit by Gaetan did give an informative runtime message:
ITK test driver caught an ITK exception:

itk::ExceptionObject (0x9189340)
Location: "void itk::MultiThreader::SingleMethodExecute()"
File: /home/lorensen/ProjectsGIT/ITKPersonal/Modules/Core/Common/src/itkMultiThreader.cxx
Line: 337
Description: itk::ERROR: MultiThreader(0x91865b0): Exception occurred
during SingleMethodExecute
/home/lorensen/ProjectsGIT/ITKPersonal/Modules/Core/Common/include/itkImageSource.txx:276:
itk::ERROR: ImageToImageFilter(0x9186528): Subclass should override
this method!!!
The signature of ThreadedGenerateData() has been changed in ITK v4 to
use the new ThreadIdType.
ImageToImageFilter::ThreadedGenerateData() might need to be updated to used it.


Although you will notice that the message does not name the class that
needs to be changed.

Also, as far as I can see there is no migration document for this API change.

Bill


More information about the Insight-developers mailing list