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

Luis Ibanez luis.ibanez at kitware.com
Tue Dec 2 17:42:45 EST 2008


Hi hubaoping

The internal implementation of "itkBinaryMask3DMeshSource" certainly
deserves to be rewritten.

However, we have usually been able to use this filter.

Could you please provide the source code of the file from which you
are using the filter, and provide a description of the input image
that you are passing to it ?


     Thanks


         Luis




-------------------
hubaoping wrote:
>  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.
> --
> ºú±¦Æ½
> 
> 
> ------------------------------------------------------------------------
> ÍøÒ×Ãâ·ÑÓÊ£¬È«Çò×î´óµÄÖÐÎÄÃâ·ÑÓÊÏä <http://www.yeah.net>
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> 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