[Insight-developers] Change in ITK[master]: BUG: Fixed signature of ThreadedGenerateData().

Bill Lorensen bill.lorensen at gmail.com
Fri Jun 10 16:19:02 EDT 2011


I agree that we should not depend on compiler warnings.

The proper way to handle this is to make the method pure virtual. But,
subclasses of ImageSource can implement either GenerateData or
ThreadedGenerateData. I think the correct way would be to have an
abstract subclass of ImageSource called ThreadedImageSource. The
ThreadedGenerateData for that abstract class would be pure virtual.
All threaded subclasses should inherit from this new class. We would
remove the ThreadedGenerateData from ImageSource. Then the compiler
will fail if a threaded subclass of ThreadedGenerateData does not
provide the proper implementation.

However, this is a lot of work that might defocus the alpha and beta efforts.

For the time being, we should expand the exception message to provide
the user with better information.

Bill



2011/6/10 Gaëtan Lehmann <gaetan.lehmann at jouy.inra.fr>:
>
> If not all the compilers are warning about that, then this is not enough.
>
> Many custom filters outside ITK must have implemented
> ThreadedGenerateData(). Those filters will build fine, and fail to run with
> a not so obvious message:
>
>  Description: itk::ERROR: MultiThreader(0x102031e00): Exception occurred
> during SingleMethodExecute
>  /playpen/blowekamp/MacOSX-gcc4.2-rel/ITK/Modules/Core/Common/include/itkImageSource.txx:274:
> itk::ERROR:
>  ZeroFluxNeumannPadImageFilter(0x101cf5150): Subclass should override this
> method!!!
>
> This should be at least very clearly documented.
> Or maybe we can change the message in itk::ImageSource to something more
> informative.
>
> Gaëtan
>
>
>
> Le 10 juin 11 à 20:46, Bill Lorensen a écrit :
>
>> If we got the warnings to 0, then we could turn on the option to make
>> warnings into errors.
>>
>>
>> On Fri, Jun 10, 2011 at 2:45 PM, Bill Lorensen <bill.lorensen at gmail.com>
>> wrote:
>>>
>>> Actually, the some compilers warned about this. This is why it is
>>> important to have green even in the warnings...
>>>
>>> On Fri, Jun 10, 2011 at 2:02 PM, Code Review <review at kitware.com> wrote:
>>>>
>>>> From Gaëtan Lehmann <gaetan.lehmann at jouy.inra.fr>:
>>>>
>>>> Gaëtan Lehmann has posted comments on this change.
>>>>
>>>> Change subject: BUG: Fixed signature of ThreadedGenerateData().
>>>> ......................................................................
>>>>
>>>>
>>>> Patch Set 1: Looks good to me, approved
>>>>
>>>> Having a run time failure is very problematic in my opinion.
>>>> We should at least add the error reported in the xml doc, if it is not
>>>> there yet, but a compile time failure would be way better.
>>>>
>>>> --
>>>> To view, visit http://review.source.kitware.com/1850
>>>> To unsubscribe, visit http://review.source.kitware.com/settings
>>>>
>>>> Gerrit-MessageType: comment
>>>> Gerrit-Change-Id: Ifbc06002a3e98b8507da869c09e5d9f912d7321e
>>>> Gerrit-PatchSet: 1
>>>> Gerrit-Project: ITK
>>>> Gerrit-Branch: master
>>>> Gerrit-Owner: Cory Quammen <cquammen at cs.unc.edu>
>>>> Gerrit-Reviewer: Bill Lorensen <bill.lorensen at gmail.com>
>>>> Gerrit-Reviewer: Gaëtan Lehmann <gaetan.lehmann at jouy.inra.fr>
>>>>
>>>
>
> --
> Gaëtan Lehmann
> Biologie du Développement et de la Reproduction
> INRA de Jouy-en-Josas (France)
> tel: +33 1 34 65 29 66    fax: 01 34 65 29 09
> http://mima2.jouy.inra.fr  http://www.itk.org
> http://www.bepo.fr
>
>


More information about the Insight-developers mailing list