[Insight-developers] Borland/VS issues with new checkins

Gaëtan Lehmann gaetan.lehmann at jouy.inra.fr
Wed Aug 5 03:47:59 EDT 2009


Le 5 août 09 à 01:20, Bill Lorensen a écrit :

> Luis,
>
> Looks like Borland likes it too.
>

I'm still not sure about what is the best fix:
* this one doesn't put the GenerateData() implementation in a  
separated file, but it adds a not used parameter to  
TemplatedGenerateData() and put the implementation in the header.
* the one I proposed puts the GenerateData() implementation in a  
separated file, but doesn't add unused parameter and keeps the  
implementation outside the .h.

Putting the GenerateData() implementation in another file makes the  
code harder to read, but may be a good point, because it avoid some  
code duplication with the more generic versions of those classes, like  
AttributeRelabelLabelMapFilter.
Another option to avoid code duplication is to implement the class  
inheritance that way:

ImageToImageFilter
    ^
    |
LabelMapFilter
    ^
    |
InPlaceLabelMapFilter
    ^
    |
AttributeRelabelLabelMapFilter
    ^
    |
ShapeRelabelLabelMapFilter
    ^
    |
StatisticsRelableLabelMapFilter

with Luis' version of TemplatedGenerateData() implementation only in  
AttributeRelabelLabelMapFilter and reused in the subclasses.
It looks quite good. I'm not sure why I didn't made it that way from  
the beginning.


> I noticed that you placed the TemplatedGenerateData in the protected
> section. Should it not be in the private section?

No, it is reused in StatisticsRelabelLabelMapFilter and similar classes.

> Also, there is
> member data in the protected section. That should also be private I
> think.

I also think so. I've put them in the protected section to use them in  
the subclass StatisticsRelabelLabelMapFilter, but they shouldn't be  
used there anymore.

>
> Bill
>
> On Tue, Aug 4, 2009 at 6:10 PM, Luis Ibanez<luis.ibanez at kitware.com>  
> wrote:
>>
>> Bill, Gaetan,
>>
>>
>> Thanks for the help.
>>
>> Looking closer at the VS60 with Sophie, we think we identified that
>>
>>
>> VS60 will only manage to compile templated methods if:
>>
>>
>>       A) The template parameter is part of
>>           the method arguments
>>
>> and
>>
>>      B) The method is implemented in the header
>>           file instead of the txx file.
>>
>>
>> We have modified the TemplatedGenerateData() method accordingly.
>> It now takes as argument an Accessor, that it most cases, doesn't use
>> for anything. This argument only serves the purpose of resolving the
>> instantiation of the templated method.
>>
>> This matches the pattern that we have in:
>>
>>        ImageBase::TransformPhysicalPointToIndex
>>
>> Namely:
>>
>> Templated class
>> Templated method
>> Method takes arguments whose type depend on the method template  
>> parameter
>> Method is implemented in the header (not the .txx) file.
>>
>> With this changes, the code compiles on Visual Studio 6.0.
>>
>> Still remains to be seen if the same construct will work on  
>> Borland....
>>
>>
>>        Luis
>>
>>
>> -------------------------------------------------------------------------------
>> On Tue, Aug 4, 2009 at 5:04 PM, Bill Lorensen <bill.lorensen at gmail.com 
>> >
>> wrote:
>>>
>>> Gaëtan,
>>>
>>> That is certainly better than the macro code I proposed. Where is it
>>> used in the toolkit?
>>>
>>> Bill
>>>
>>> 2009/8/4 Gaëtan Lehmann <gaetan.lehmann at jouy.inra.fr>:
>>>>
>>>> I've proposed a fix for that problem some time ago, by using  
>>>> templated
>>>> functions instead of templated methods.
>>>>
>>>> It is implemented for the UniqueLabelMapFilters:
>>>>
>>>>
>>>> http://voxel.jouy.inra.fr/darcs/contrib-itk/binaryAttributeMorphology/itkLabelMapUtilities.txx
>>>>
>>>> http://voxel.jouy.inra.fr/darcs/contrib-itk/binaryAttributeMorphology/itkShapeUniqueLabelMapFilter.txx
>>>>
>>>> I didn't have a chance to test it with msvc6, but similar code is  
>>>> used
>>>> elsewhere in the toolkit, so I guess that it should work without  
>>>> (too
>>>> much)
>>>> problem.
>>>>
>>>> Gaëtan
>>>>
>>>> Le 4 août 09 à 20:36, Bill Lorensen a écrit :
>>>>
>>>>> Let me know if you find a solution that works both for Borland and
>>>>> VS6. I think mine does.
>>>>>
>>>>> Bill
>>>>>
>>>>> On Tue, Aug 4, 2009 at 2:31 PM, Sophie Chen<sophie.chen at kitware.com 
>>>>> >
>>>>> wrote:
>>>>>>
>>>>>> Hi Bill,
>>>>>> I was just able to meet up with Luis to talk about this  
>>>>>> problem. He
>>>>>> seems
>>>>>> to
>>>>>> have some ideas how to fix the issue on VS6, but we have not  
>>>>>> tested
>>>>>> this
>>>>>> yet. We are meeting up again in an hour or so to try this on a  
>>>>>> machine
>>>>>> with
>>>>>> the VS6 build with these problems.
>>>>>> Thanks.
>>>>>>
>>>>>> On Tue, Aug 4, 2009 at 9:39 AM, Bill Lorensen
>>>>>> <bill.lorensen at gmail.com>
>>>>>> wrote:
>>>>>>>
>>>>>>> Sophie,
>>>>>>>
>>>>>>> The new classes in Review,:
>>>>>>> itkShapeKeepNObjectsLabelMapFilter
>>>>>>> itkShapeOpeningLabelMapFilter
>>>>>>> and
>>>>>>> itkShapeRelabelLabelMapFilter
>>>>>>>
>>>>>>> all have trouble compiling with the Borland and VS6 compiler.
>>>>>>>
>>>>>>> I experimented with various solution on Borland and have a  
>>>>>>> solution,
>>>>>>> although not the prettiest. I create a macro that replaces the
>>>>>>> templated function:
>>>>>>> TemplatedGenerateData. I have only tired it on
>>>>>>> itkShapeKeepNObjectsLabelMapFilter, but I'm sure it will work  
>>>>>>> on the
>>>>>>> others.
>>>>>>>
>>>>>>> Unless someone else can find better workarounds, I try to fix  
>>>>>>> the
>>>>>>> others today and check in the results.
>>>>>>>
>>>>>>> Let me know what you and Lis think about this,
>>>>>>>
>>>>>>> Bill
>>>>>>
>>>>>>
>>>>>>
>>>>>> --
>>>>>> Sincerely,
>>>>>>      Sophie
>>>>>>
>>>>> _______________________________________________
>>>>> Powered by www.kitware.com
>>>>>
>>>>> Visit other Kitware open-source projects at
>>>>> http://www.kitware.com/opensource/opensource.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
>>>>
>>>> --
>>>> 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://voxel.jouy.inra.fr  http://www.itk.org
>>>> http://www.mandriva.org  http://www.bepo.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://voxel.jouy.inra.fr  http://www.itk.org
http://www.mandriva.org  http://www.bepo.fr

-------------- next part --------------
A non-text attachment was scrubbed...
Name: PGP.sig
Type: application/pgp-signature
Size: 203 bytes
Desc: Ceci est une signature ?lectronique PGP
URL: <http://www.itk.org/mailman/private/insight-developers/attachments/20090805/24a77cb6/attachment.pgp>


More information about the Insight-developers mailing list