I have std::transform a try:

http://review.source.kitware.com/#/c/11273/

Here is a table of timings of using CastImageFilter to convert from short to 
float:

gcc 4.4.7       std::copy       std::transform  std:copy speedup
[64, 64, 64]    0.00095768      0.002372        2.47654749
[128, 128, 128] 0.00751585      0.018858        2.509030915
[256, 256, 256] 0.06628470      0.163698        2.469619686
[32, 32]        0.00000294      0.000009        2.936786434
[64, 64]        0.00000306      0.000026        8.558496072
[128, 128]      0.00000704      0.000099        14.10766618
[256, 256]      0.00003077      0.000392        12.74427524


So... That is a bit slower with transform. I don't like it.

I have included the performance test in the patch too.

I also get the following compilation error with the patch:

ITK/Examples/Segmentation/CannySegmentationLevelSetImageFilter.cxx:376:   
instantiated from here
ITK/Modules/Core/Common/include/itkImageAlgorithm.h:177: error: no matching 
function for call to ‘itk::CovariantVector<float, 2u>::CovariantVector(const 
itk::FixedArray<float, 2u>&)’



On May 14, 2013, at 12:03 PM, Bradley Lowekamp <[email protected]> wrote:

> 
> We might be able to use std::transform in some cases... I'll check some 
> timings...
> 
> Brad
> 
> On May 14, 2013, at 11:40 AM, Bill Lorensen <[email protected]> wrote:
> 
>> I don't think we should use cdash suppression for this one. Users will be 
>> annoyed, e.g. Slicer...
>> 
>> 
>> 
>> On Tue, May 14, 2013 at 11:38 AM, Bradley Lowekamp <[email protected]> 
>> wrote:
>> 
>> As a last resort to getting ride of this warning, we could write an adaptor 
>> class. Provide an adaptor to a pointer to an iterator interface but on the 
>> dereference do the static_cast for the conversion. I don't know if the same 
>> performance benefits will still occur. And I don't really want to do this 
>> either, it'll be a lot more code.
>> 
>> Alternatively we could just add this warning to the CDash warning 
>> suppression file.
>> 
>> We could also just compile a function, and for just that file provide the 
>> command line ignore warning option.
>> 
>> The current code is correct, it's doing the right thing. We just don't want 
>> the warning...
>> 
>> Brad
>> 
>> On May 13, 2013, at 2:31 PM, Bradley Lowekamp <[email protected]> wrote:
>> 
>> > Hello,
>> >
>> >
>> > On May 12, 2013, at 10:45 PM, Matt McCormick <[email protected]> 
>> > wrote:
>> >>
>> >> Visual Studio possible loss of data warnings
>> >> https://issues.itk.org/jira/browse/ITK-3084
>> >
>> >
>> > I have tried a couple of things to deal with this warning:
>> >
>> > http://review.source.kitware.com/#/c/11222/
>> >
>> > I don't have another idea beside disabling that warning for all if the in 
>> > itkWin32Header.h.
>> >
>> > Anyone have any suggestions?
>> >
>> > Brad
>> > _______________________________________________
>> > 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.php
>> >
>> > 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
>> 
>> 
>> 
>> 
>> -- 
>> Unpaid intern in BillsBasement at noware dot com
> 

_______________________________________________
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.php

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

Reply via email to