[Insight-users] a overflow maked by "itkBinaryMask3DMeshSource.txx"

Dan Mueller dan.muel at gmail.com
Fri Nov 28 01:54:02 EST 2008


Hi 胡宝平,

Can you please provide some more information:
    Your source code (minimal example to reproduce your issue)
    CMakeLists.txt
    Compiler information (eg. which one? version?)
    System information (eg. OS? machine?)

Regards, Dan

2008/11/27 hubaoping <hubaoping at 126.com>:
>  Hi,
>     When I use the "itkBinaryMask3DMeshSource" to creat a mesh,compliled
>  without error.But it cannot run.There is a  warning likes  "0x********
> cannot be read"and break at the point in the"itkBinaryMask3DMeshSource.txx "
>    So I look over the "itkBinaryMask3DMeshSource.txx ",the code below make
> me confused.
>   //////////////////////
>  InputImageIterator it1( m_InputImage, m_InputImage->GetBufferedRegion() );
>   InputImageIterator it2( m_InputImage, m_InputImage->GetBufferedRegion() );
>   InputImageIterator it3( m_InputImage, m_InputImage->GetBufferedRegion() );
>   InputImageIterator it4( m_InputImage, m_InputImage->GetBufferedRegion() );
>   it1.GoToBegin();
>   it2.GoToBegin();
>   it3.GoToBegin();
>   it4.GoToBegin();
>   InputImageSizeType inputImageSize =
> m_InputImage->GetBufferedRegion().GetSize();
>   m_ImageWidth  = inputImageSize[0];
>   m_ImageHeight = inputImageSize[1];
>   m_ImageDepth  = inputImageSize[2];
>   int frame = m_ImageWidth * m_ImageHeight;
>   int row = m_ImageWidth;
>
>   int i = 0;
>   int j;
>   while ( i < frame )
>     {
>     ++it3;
>     ++it1;
>     i++;
>     }
>   i = 0;
>   while ( i < row )
>     {
>     ++it2;
>     ++it4;
>     i++;
>     }
>
> while ( !it4.IsAtEnd() )
>     {
>     vertexindex = 0;
>     if ( it1.Value() == m_ObjectValue ) vertexindex += 1;
>     if ( it2.Value() == m_ObjectValue ) vertexindex += 8;
>     if ( it3.Value() == m_ObjectValue ) vertexindex += 16;
>     if ( it4.Value() == m_ObjectValue ) vertexindex += 128;
>     ++it1;
>     ++it2;
>     ++it3;
>     ++it4;
> ///////////////////////////////////////////////////
> If m_ImageWidth = m_ImageHeight = 512, m_ImageDepth  = 1,so   frame =
> 512*512 =262144,row = 512. Well,after
> while ( i < frame )
>     {
>     ++it3;
>     ++it4;
>     i++;
>     }
> the offset of it4 or it3 is 262144.then
> while ( i < row )
>     {
>     ++it2;
>     ++it4;
>     i++;
>     };
> the offset of it4 is 262144+512 =262656.but the it4.IsAtEnd() is 262144.so
> the lines while ( !it4.IsAtEnd() )
> will run and not stop. and the offsets of the iterators will  overflow.
> --
> 胡宝平
>
> ________________________________
> 网易免费邮,全球最大的中文免费邮箱
> _______________________________________________
> Insight-users mailing list
> Insight-users at itk.org
> http://www.itk.org/mailman/listinfo/insight-users
>
>


More information about the Insight-users mailing list