[Insight-developers] Slicer4 changes needed because of ITKv4 API change
Bill Lorensen
bill.lorensen at gmail.com
Fri Jun 17 15:45:35 EDT 2011
Brad,
That is a good idea. I'll investigate.
Bill
On Fri, Jun 17, 2011 at 1:50 PM, Bradley Lowekamp
<blowekamp at mail.nih.gov> wrote:
> Bill,
> I agree that this change is very disruptive. I have several filters quietly
> not work, because the super-classes implementation was called, and Gaetan's
> warning would not help these situations.
> A perhaps better compatibility fix in applications is to add the following
> to a common header:
> #if ITK_VERSION_MAJOR < 4
> typedef ThreadIdType int;
> #endif
>
> Thereby you can just use the typedef everywhere else in your code, without
> the ifdef.
> Brad
> On Jun 17, 2011, at 1:35 PM, Bill Lorensen wrote:
>
> 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
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Kitware offers ITK Training Courses, for more information visit:
> http://kitware.com/products/protraining.html
>
> Please keep messages on-topic and check the ITK FAQ at:
> http://www.itk.org/Wiki/ITK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.itk.org/mailman/listinfo/insight-developers
>
> ========================================================
>
> Bradley Lowekamp
>
> Lockheed Martin Contractor for
>
> Office of High Performance Computing and Communications
>
> National Library of Medicine
>
> blowekamp at mail.nih.gov
>
>
More information about the Insight-developers
mailing list