[Insight-developers] MRCImageIO & Visual Studio 6.0

Gabe Hart gabe.hart at kitware.com
Thu Jun 17 08:42:58 EDT 2010


Hmm... I wanted to get them checked in with time to check the continuous 
builds yesterday, so the changes are already up.  Sorry for not waiting 
longer.  Again, I don't think the changes I've made should conflict with 
yours at all.  The two commits I made were to remove the Local namespace 
(might require adjustments to any tests you've written) and a fix for 
about 5 lines of code in itkMRCImageIO.cxx that check dimensionality 
before accessing local variables.  Let me know if any of these do cause 
any trouble and I'll see what I can do about making our changes play 
nicely together.

-Gabe

On 06/17/2010 12:12 AM, Bill Lorensen wrote:
> Gabe,
>
> Can you hold off checking in your changes. I think I have it working
> for VS 6. I'll check these in tomorrow morning.
>
> Bill
>
> On Wed, Jun 16, 2010 at 1:56 PM, Gabe Hart<gabe.hart at kitware.com>  wrote:
>    
>> Hi Bill,
>>
>> I've been working on integrating the test for itkMRCImageIO into the ITK
>> testing framework.  In the process I made a couple of changes to the
>> corresponding code in Insight/Code/Review/.  I don't think any of these
>> changes should effect your work on the templating issue, but I wanted to
>> have you check over them before I committed the changes.  I've attached a
>> diff that shows all of the changes to files in Insight/Code/Review/.  The
>> two main changes were to remove the Local namespace from all of the files
>> and to handle the 1D and 2D cases properly without segfaulting in
>> itkMRCImageIO.cxx.
>>
>> -Gabe
>>
>> On 06/15/2010 10:21 AM, Bill Lorensen wrote:
>>      
>>> Have not had a chance to try with my VS6.
>>>
>>> Bill
>>>
>>> On Tue, Jun 15, 2010 at 10:03 AM, Karthik Krishnan
>>> <karthik.krishnan at kitware.com>    wrote:
>>>
>>>        
>>>> I think what we've done before to help VS6 is also declare one of the
>>>> methods with a slightly different signature by adding const.. something
>>>> like
>>>>
>>>> template<    typename T>    foo( const T * );
>>>>
>>>>     and
>>>>
>>>> void foo( const void * ) const;
>>>>
>>>> By making the second a const method, the m_MRCHeader iVar would need to
>>>> be
>>>> mutable. Not sure if this will work, but it may be worth a try if all
>>>> else
>>>> fails.
>>>>
>>>>
>>>>
>>>>
>>>>
>>>> On Tue, Jun 15, 2010 at 7:27 PM, Bradley Lowekamp<blowekamp at mail.nih.gov>
>>>> wrote:
>>>>
>>>>          
>>>>> Bill did volunteer to look into this issue by using his version of the
>>>>> compiler.
>>>>> It would not surprise me if VS6 was unable to compile any of the three
>>>>> suggested issues.
>>>>> If the methods needs to be renamed I would suggest something along the
>>>>> lines:
>>>>>   UpdateHeaderWIthMinMaxCaller
>>>>>   UpdateHeaderWIthMinMaxDispatcher
>>>>> But I am not able to think of how this convention is done else where,
>>>>> where a void argument is casted to it's specific type and another
>>>>> methods is
>>>>> called. So I don't know what we should really follow here.
>>>>> Brad
>>>>>
>>>>> On Jun 15, 2010, at 9:38 AM, Karthik Krishnan wrote:
>>>>>
>>>>> My understanding is that function templates must be inlined. Shouldn't
>>>>> the
>>>>> body of the method be moved from the CXX to the .H file ?
>>>>>
>>>>>
>>>>> On Tue, Jun 15, 2010 at 6:59 PM, Luis Ibanez<luis.ibanez at kitware.com>
>>>>> wrote:
>>>>>
>>>>>            
>>>>>> mm, I'll take that back...
>>>>>>
>>>>>> The method already is a templated member of the class.
>>>>>>
>>>>>> Maybe the problem is the presence of the other non-templated
>>>>>> function with the same name and with a (void *) as an argument.
>>>>>>
>>>>>>    template<typename TPixelType>
>>>>>>      void UpdateHeaderWithMinMaxMean( const TPixelType * bufferBegin );
>>>>>>
>>>>>>    void UpdateHeaderWithMinMaxMean( const void *buffer );
>>>>>>
>>>>>> Would it make sense to rename the second one as something like:
>>>>>>
>>>>>>    void UpdateHeaderWithMinMaxMeanGeneric( const void *buffer );
>>>>>>
>>>>>>
>>>>>> for example?
>>>>>>
>>>>>>
>>>>>>      Luis
>>>>>>
>>>>>>
>>>>>>
>>>>>> --------------------------------------------------------
>>>>>> On Tue, Jun 15, 2010 at 9:26 AM, Luis Ibanez<luis.ibanez at kitware.com>
>>>>>> wrote:
>>>>>>
>>>>>>              
>>>>>>> Hi Brad,
>>>>>>>
>>>>>>> VS 6.0 seems to be unhappy with the attempt of
>>>>>>> using the template argument to the function:
>>>>>>>
>>>>>>> C:\Dashboards\My
>>>>>>> Tests\InsightContinuous\Code\Review\itkMRCImageIO.cxx(516) : error
>>>>>>> C2062:
>>>>>>> type 'unsigned char' unexpected
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> http://public.kitware.com/cgi-bin/viewcvs.cgi/Code/Review/itkMRCImageIO.cxx?root=Insight&r1=1.1&r2=1.2
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> It looks like the next best option is to make that function
>>>>>>> become a templated member method of a class.
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>       Luis
>>>>>>>
>>>>>>>
>>>>>>> -------------------------------------------
>>>>>>> On Mon, Jun 14, 2010 at 2:34 PM, Bill
>>>>>>> Lorensen<bill.lorensen at gmail.com>
>>>>>>> wrote:
>>>>>>>
>>>>>>>                
>>>>>>>> I have VS6. I'll give it a go later today,
>>>>>>>>
>>>>>>>> Bill
>>>>>>>>
>>>>>>>> On Mon, Jun 14, 2010 at 2:15 PM, Bradley Lowekamp
>>>>>>>> <blowekamp at mail.nih.gov>    wrote:
>>>>>>>>
>>>>>>>>                  
>>>>>>>>> Bill,
>>>>>>>>> I have already committed a:
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> http://public.kitware.com/cgi-bin/viewcvs.cgi/Code/Review/itkMRCImageIO.cxx?root=Insight&r1=1.1&r2=1.2
>>>>>>>>> but unfortunately we are still getting related errors ( different
>>>>>>>>> but
>>>>>>>>> related ):
>>>>>>>>> http://www.cdash.org/CDash/viewBuildError.php?buildid=635501
>>>>>>>>> It is likely the overloading of the method which is confusing the
>>>>>>>>> poor VS6
>>>>>>>>> compiler:
>>>>>>>>>
>>>>>>>>>    // internal methods to update the min and max in the header based
>>>>>>>>> on
>>>>>>>>>    // the data, in the image buffer to be written
>>>>>>>>>    template<typename TPixelType>
>>>>>>>>>      void UpdateHeaderWithMinMaxMean( const TPixelType * bufferBegin
>>>>>>>>> );
>>>>>>>>>    void UpdateHeaderWithMinMaxMean( const void *buffer );
>>>>>>>>> My suggestion would be to rename the second non-templated method.
>>>>>>>>> Perhaps I
>>>>>>>>> should let some one with the VS6 compiler check to see if this is a
>>>>>>>>> working
>>>>>>>>> solution instead of my prior shooting in the dark, which didn't
>>>>>>>>> solve
>>>>>>>>> the
>>>>>>>>> issue.
>>>>>>>>> Brad
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> On Jun 14, 2010, at 2:08 PM, Bill Lorensen wrote:
>>>>>>>>>
>>>>>>>>> I think we have done a) in the past.
>>>>>>>>>
>>>>>>>>> On Mon, Jun 14, 2010 at 1:11 PM, Luis Ibanez
>>>>>>>>> <luis.ibanez at kitware.com>
>>>>>>>>> wrote:
>>>>>>>>>
>>>>>>>>> Hi Brad,
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> Visual Studio 6.0 seems to be having trouble with
>>>>>>>>>
>>>>>>>>> the template instantiations from itkMRCImageIO:
>>>>>>>>>
>>>>>>>>> http://www.cdash.org/CDash/viewBuildError.php?buildid=635480
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> :\Dashboards\My
>>>>>>>>> Tests\InsightContinuous\Code\Review\itkMRCImageIO.cxx(516) :
>>>>>>>>>
>>>>>>>>> error C2893: Failed to specialize function template 'void __thiscall
>>>>>>>>>
>>>>>>>>> itk::Local::MRCImageIO::UpdateHeaderWithMinMaxMean(const TPixelType
>>>>>>>>> *)'
>>>>>>>>>
>>>>>>>>>         With the following template arguments:
>>>>>>>>>
>>>>>>>>>         'unsigned char'
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> I believe that VS6 can't resolve templated functions
>>>>>>>>>
>>>>>>>>> just based on the type of the function argument.
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> Options to consider are:
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> A)  instantiating it as:
>>>>>>>>>
>>>>>>>>>         f<T>( T arg )
>>>>>>>>>
>>>>>>>>> or
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> B)  Making that function to be a
>>>>>>>>>
>>>>>>>>>     templated method member of a class.
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> Do you have any preferences between these two options ?
>>>>>>>>>
>>>>>>>>> (or maybe other options...?)
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>     Thanks
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>        Luis
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> _______________________________________________
>>>>>>>>>
>>>>>>>>> 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
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>                    
>>>>>>>
>>>>>>>                
>>>>>> _______________________________________________
>>>>>> 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
>>>>>
>>>>>
>>>>>            
>>>> _______________________________________________
>>>> 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
>>>>
>>>>
>>>>
>>>>          
>>> _______________________________________________
>>> 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
>>>
>>>        
>>
>>      



More information about the Insight-developers mailing list