[Insight-users] Bug in itkFloodFilledFunctionConditionalIterator

Yann Rouillard Y.Rouillard@exeter.ac.uk
Sat, 28 Sep 2002 20:00:20 +0100


This is a multi-part message in MIME format.

------=_NextPart_000_003A_01C26729.ACC70780
Content-Type: text/plain;
	charset="iso-8859-1"
Content-Transfer-Encoding: 7bit

Hi,

I think I found a little bug in the
itkFloodFilledFunctionConditionalIterator.txx file.

This bug prevent the floodfill iterator to work correctly when used on
boundaries,
if you use the iterator on the first slice it will only stay on this slice
because as soon as an index in one dimension is considered invalid the other
is also considered invalid.
Well it's a long explication for a very small bug I think this tiny patch is
self explanatory.

I also found some memory leaks in MetaIO:

In MetaObject.cxx
    - m_ReadStream and m_WriteStream are nerver deleted
    - the MET_FieldRecordType objects which pointers are stored in m_Fields
are never deleted

In MetaImage.cxx
    - in function Read, readStreamTemp are created but never deleted

I didn't try to understand the code so I may be mistaken but it was signaled
as memory leak under visual c++.

------=_NextPart_000_003A_01C26729.ACC70780
Content-Type: application/octet-stream;
	name="floodfill.patch"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: attachment;
	filename="floodfill.patch"

diff -ru2 -xCVS -x'.#*' -x'*.orig' -x'*.rej' -x'*~' =
../viet/Insight/Code/Common/itkFloodFilledFunctionConditionalIterator.txx=
 Insight/Code/Common/itkFloodFilledFunctionConditionalIterator.txx=0A=
--- =
../viet/Insight/Code/Common/itkFloodFilledFunctionConditionalIterator.txx=
	2002-08-06 22:27:46.000000000 +0100=0A=
+++ Insight/Code/Common/itkFloodFilledFunctionConditionalIterator.txx	=
2002-09-28 17:32:47.000000000 +0100=0A=
@@ -99,9 +99,10 @@=0A=
       {
       IndexType tempIndex;
-      m_IsValidIndex =3D true;
-
+     =20
       // The j loop establishes either left or right neighbor (+-1)
       for(int j=3D-1; j<=3D1; j+=3D2)
         {
+
+		m_IsValidIndex =3D true;
         // build the index of a neighbor
         for(int k=3D0; k<NDimensions; k++)

------=_NextPart_000_003A_01C26729.ACC70780--