View Issue Details Jump to Notes ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0005646ITKpublic2007-09-03 09:292007-09-16 17:00
ReporterDieter Hahn 
Assigned ToLuis Ibanez 
PrioritynormalSeverityminorReproducibilityalways
StatusclosedResolutionfixed 
PlatformOSOS Version
Product Version 
Target VersionFixed in Version 
Summary0005646: ImageRegionConstIteratorWithIndex redundant arithmetic operation
DescriptionHi,

within the -- operator, there is a redundant arithmetic call that should be deleted, as the iterator operations have to be as efficient as possible.

See the else part of the decrement code:

>> this->m_PositionIndex[ in ]--; << // this is redundant! as it is set below

      this->m_Position += this->m_OffsetTable[ in ]
        * ( static_cast<long>(this->m_Region.GetSize()[in])-1 );
      this->m_PositionIndex[ in ] = this->m_EndIndex[ in ] - 1;

Thanks,
Dieter
TagsNo tags attached.
Resolution Date
Sprint
Sprint Status
Attached Files

 Relationships

  Notes
(0009005)
Luis Ibanez (manager)
2007-09-16 12:49

The bug report makes sense

The following changes seem to be needed.

Index: itkImageRegionConstIteratorWithIndex.txx
===================================================================
RCS file: /cvsroot/Insight/Insight/Code/Common/itkImageRegionConstIteratorWithIndex.txx,v
retrieving revision 1.6
diff -r1.6 itkImageRegionConstIteratorWithIndex.txx
37d36
< this->m_PositionIndex[ in ]++;
39a39
> this->m_PositionIndex[ in ]++;
83d82
< this->m_PositionIndex[ in ]--;
(0009007)
Luis Ibanez (manager)
2007-09-16 16:59

Actually only the line that Dieter indicated needed to be modifed,
the structure of the operator++ is a bit different, and the frequency
of the double operation is negligible.

The code was committed as:
http://www.itk.org/cgi-bin/viewcvs.cgi/Code/Common/itkImageRegionConstIteratorWithIndex.txx?root=Insight&sortby=date&r2=1.7&r1=1.6 [^]
(0009008)
Luis Ibanez (manager)
2007-09-16 17:00

an experimental build was submitted from Zion.
All tests passed.

 Issue History
Date Modified Username Field Change
2007-09-03 09:29 Dieter Hahn New Issue
2007-09-16 12:46 Luis Ibanez Status new => assigned
2007-09-16 12:46 Luis Ibanez Assigned To => Luis Ibanez
2007-09-16 12:49 Luis Ibanez Note Added: 0009005
2007-09-16 12:49 Luis Ibanez Status assigned => acknowledged
2007-09-16 16:59 Luis Ibanez Note Added: 0009007
2007-09-16 17:00 Luis Ibanez Status acknowledged => closed
2007-09-16 17:00 Luis Ibanez Note Added: 0009008
2007-09-16 17:00 Luis Ibanez Resolution open => fixed


Copyright © 2000 - 2018 MantisBT Team