MantisBT - ITK | |||||
View Issue Details | |||||
ID | Project | Category | View Status | Date Submitted | Last Update |
0008311 | ITK | public | 2008-12-17 20:02 | 2011-05-18 17:33 | |
Reporter | Daniel Betz | ||||
Assigned To | kentwilliams | ||||
Priority | normal | Severity | major | Reproducibility | always |
Status | feedback | Resolution | reopened | ||
Platform | OS | OS Version | |||
Product Version | ITK-3-10 | ||||
Target Version | Fixed in Version | ||||
Resolution Date | |||||
Sprint | |||||
Sprint Status | backlog | ||||
Summary | 0008311: PolyLineParametricPath converges too slow | ||||
Description | The ParametricPath has a methode IncrementInput() which is used by the PathIterator to go along a path until the next pixel is reached. The implementation converges far too slow (possibly sometimes never) and the allowed maximum of 10000 iterations get reached so that an exception is thrown. Some example pathes that fail with this or the related implementation http://www.seas.upenn.edu/~jtduda/code/itkSlowPolyLineParametricPath.txx [^] is attached. This bug is related to: http://www.itk.org/Bug/bug_view_page.php?bug_id=5371&history=1 [^] and this posting from the itk user mailinglist: http://www.itk.org/pipermail/insight-users/2005-July/013922.html [^] | ||||
Steps To Reproduce | |||||
Additional Information | The solution is to use interval bisection, once an upper boundary was found through doubling the input step size. A new implemetation of IncrementInput could look like this (This never failed for me until now): template<unsigned int VDimension> typename FastPolyLineParametricPath<VDimension>::OffsetType FastPolyLineParametricPath<VDimension> ::IncrementInput(InputType & input) const { unsigned iterationCount; bool tooSmall; bool tooBig; InputType inputStepSize; InputType tooSmallInputStepSize; InputType tooBigInputStepSize; InputType finalInputValue; OffsetType offset; IndexType currentImageIndex; IndexType nextImageIndex; IndexType finalImageIndex; iterationCount = 0; inputStepSize = this->GetDefaultInputStepSize(); tooSmallInputStepSize = 0; tooBigInputStepSize = 0; // Are we already at (or past) the end of the input ? finalInputValue = this->EndOfInput(); currentImageIndex = this->EvaluateToIndex( input ); finalImageIndex = this->EvaluateToIndex( finalInputValue ); offset = finalImageIndex - currentImageIndex; if( ( offset == this->GetZeroOffset() && input != this->StartOfInput() ) || ( input >= finalInputValue ) ) return this->GetZeroOffset(); do { if( iterationCount++ > 10000 ) { itkExceptionMacro(<<"Too many iterations"); } nextImageIndex = this->EvaluateToIndex( input + inputStepSize ); offset = nextImageIndex - currentImageIndex; tooSmall = ( offset == this->GetZeroOffset() ); tooBig = false; if( tooSmall ) { // increase the input step size, but don't go past the end of the input if( (input + inputStepSize) >= finalInputValue ) { inputStepSize = finalInputValue - input; } else { tooSmallInputStepSize = inputStepSize; if( tooBigInputStepSize == 0 ) inputStepSize *= 2; else inputStepSize += ( tooBigInputStepSize - tooSmallInputStepSize ) / 2; } } else { // Search for an offset dimension that is too big for( unsigned i = 0; i < VDimension && ! tooBig; ++i ) { tooBig = ( offset[i] >= 2 || offset[i] <= -2 ); } if( tooBig ) { tooBigInputStepSize = inputStepSize; inputStepSize -= (tooBigInputStepSize - tooSmallInputStepSize) / 2; } } } while( tooSmall || tooBig ); input += inputStepSize; return offset; } | ||||
Tags | No tags attached. | ||||
Relationships | |||||
Attached Files | SomePolyLines.cxx (2,606) 2008-12-17 20:02 https://public.kitware.com/Bug/file/1930/SomePolyLines.cxx | ||||
Issue History | |||||
Date Modified | Username | Field | Change | ||
2008-12-17 20:02 | Daniel Betz | New Issue | |||
2008-12-17 20:02 | Daniel Betz | File Added: SomePolyLines.cxx | |||
2009-01-18 11:40 | Daniel Betz | Note Added: 0014601 | |||
2010-11-02 13:36 | Hans Johnson | Status | new => assigned | ||
2010-11-02 13:36 | Hans Johnson | Assigned To | => kentwilliams | ||
2010-11-22 17:43 | kentwilliams | Note Added: 0023500 | |||
2010-12-09 07:01 | Hans Johnson | Sprint Status | => backlog | ||
2010-12-09 07:01 | Hans Johnson | Note Added: 0023835 | |||
2010-12-09 07:01 | Hans Johnson | Status | assigned => closed | ||
2010-12-09 07:01 | Hans Johnson | Resolution | open => unable to reproduce | ||
2010-12-26 12:29 | Daniel Betz | Note Added: 0024328 | |||
2010-12-26 12:29 | Daniel Betz | Status | closed => feedback | ||
2010-12-26 12:29 | Daniel Betz | Resolution | unable to reproduce => reopened | ||
2011-05-18 17:33 | kentwilliams | Note Added: 0026545 |
Notes | |||||
|
|||||
|
|
||||
|
|||||
|
|
||||
|
|||||
|
|
||||
|
|||||
|
|
||||
|
|||||
|
|