[Insight-developers] The Debug Macro Features

Sayan Pathak spathak@insightful.com
Tue, 18 Dec 2001 15:52:06 -0800


Printing all the info in one DebugMacro would have been possible if I
were just looking at the location, label, area, mean etc. simple
variables.
In addition, these simple variables in the algorithm, I look into the
border list too and that is variable. It requires me to loop through a
list, printing out various information of importance.

Something like:
  RegionBorderVectorIterator tempVectorIt =3D
m_RegionBorderVector.begin();
  for( unsigned int k =3D 0; k < m_RegionBorderVector.size(); k++ )
    {     =20
    region1label =3D (*tempVectorIt)->GetRegion1()->GetRegionLabel();
    region2label =3D (*tempVectorIt)->GetRegion2()->GetRegionLabel();=20

    itkDebugMacro(<< "Border Ptr :" << (*tempVectorIt) << "( " <<=20
      region1label << " - " << region2label << " )" );
    tempVectorIt++;
    }// end while

Unless we create buffers for all these variables dynamically, store them
somewhere and then print it. That will be bit more involved and may be
an overkill for the problem at hand.

Sayan

-----Original Message-----
From: Bill Lorensen [mailto:wlorens1@nycap.rr.com]
Sent: Tuesday, December 18, 2001 3:20 PM
To: Sayan Pathak; insight-developers@public.kitware.com
Subject: Re: [Insight-developers] The Debug Macro Features


Why not print all the info in one DebugMacro.

At 02:12 PM 12/18/01 -0800, Sayan Pathak wrote:
>Hi,
>I have been entertained by the itkDebugMacro today.
>I have a story to tell
>=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
>I was working with the Region Growing code trying to chase a bug. When
I
>discovered that the several small regions I have, are defined by the
>label they have, their area, their mean intensity and the borders
>defining these regions. There are several of these in an image set. I
>have a simple data set with only 18 regions.
>
>In the old days, when itk did not have the powerful tools like the
>itkDebugMacro; I used the std::cout & endl to give me feedback on the
>regions. One of the regions looked something like:
>------------------------------
>Location   : 00FF4C28
>Label      : 1
>Area       : 4
>Mean       : 3
>
>Num Borders: 3
>++++++++++++++++++++++++++++++
>Border Ptr :00FF71D8( 1 - 2 ) (neighbor region 1 - neighbor region 2)
>Border Ptr :00FF6C88( 1 - 4 )
>Border Ptr :00FF77B0( 1 - 10 )
>------------------------------
>------------------------------
>This looked intuitive and when several of them got printed out I had
>little problems sifting through the data.=20
>But now we have a fuel injection microprocessor driven car as opposed
to
>the ones with old carburetor. In other words, I use itkDebugMacro
>instead of the std::cout/endl.=20
>
>When using the Debug Macro, I get extensive reporting even for a simple
>data set. As an example I have attached below the description of the
>same region. The reporting is very detailed indeed. But mostly
>redundant. I had a headache after using it a few times and have gone
>back to my old means of cout/endl.
>
>I would prefer using the itkDebugMacro as it would be a much slicker
way
>of doing things. But not the way it is right now. Please let me know if
>I could do something to make it easier.
>Thanks,
>Sayan
>
>-------------------
>Debug: In
>E:\Insight-clean\Insight\Code\Common\itkKLMSegmentationRegion.cxx, lin
>e 412
>KLMSegmentationRegion (00FF4C28): ------------------------------
>
>
>Debug: In
>E:\Insight-clean\Insight\Code\Common\itkKLMSegmentationRegion.cxx, lin
>e 413
>KLMSegmentationRegion (00FF4C28): Location   : 00FF4C28
>
>
>Debug: In E:\Insight-clean\Insight\Code\Common\itkSegmentationRegion.h,
>line 100
>
>KLMSegmentationRegion (00FF4C28): returning RegionLabel of 1
>
>
>Debug: In
>E:\Insight-clean\Insight\Code\Common\itkKLMSegmentationRegion.cxx, lin
>e 414
>KLMSegmentationRegion (00FF4C28): Label      : 1
>
>
>Debug: In E:\Insight-clean\Insight\Code\Common\itkSegmentationRegion.h,
>line 104
>
>KLMSegmentationRegion (00FF4C28): returning RegionArea of 4
>
>
>Debug: In
>E:\Insight-clean\Insight\Code\Common\itkKLMSegmentationRegion.cxx, lin
>e 415
>KLMSegmentationRegion (00FF4C28): Area       : 4
>
>
>Debug: In E:\Insight-clean\Insight\Code\Common\itkSegmentationRegion.h,
>line 112
>
>KLMSegmentationRegion (00FF4C28): returning MeanRegionIntensity of 3
>
>
>
>Debug: In
>E:\Insight-clean\Insight\Code\Common\itkKLMSegmentationRegion.cxx, lin
>e 416
>KLMSegmentationRegion (00FF4C28): Mean       : 3
>
>
>
>Debug: In
>E:\Insight-clean\Insight\Code\Common\itkKLMSegmentationRegion.cxx, lin
>e 417
>KLMSegmentationRegion (00FF4C28): Num Borders: 3
>
>
>Debug: In
>E:\Insight-clean\Insight\Code\Common\itkKLMSegmentationRegion.cxx, lin
>e 418
>KLMSegmentationRegion (00FF4C28): ++++++++++++++++++++++++++++++
>
>
>Debug: In E:\Insight-clean\Insight\Code\Common\itkSegmentationRegion.h,
>line 100
>
>KLMSegmentationRegion (00FF4C28): returning RegionLabel of 1
>
>
>Debug: In
>E:\Insight-clean\Insight\Code\Common\itkKLMSegmentationRegion.cxx, lin
>e 428
>KLMSegmentationRegion (00FF4C28): Border Ptr :00FF71D8( 1 - 2 )
>
>
>Debug: In E:\Insight-clean\Insight\Code\Common\itkSegmentationRegion.h,
>line 100
>
>KLMSegmentationRegion (00FF4C28): returning RegionLabel of 1
>
>
>Debug: In
>E:\Insight-clean\Insight\Code\Common\itkKLMSegmentationRegion.cxx, lin
>e 428
>KLMSegmentationRegion (00FF4C28): Border Ptr :00FF6C88( 1 - 4 )
>
>
>Debug: In E:\Insight-clean\Insight\Code\Common\itkSegmentationRegion.h,
>line 100
>
>KLMSegmentationRegion (00FF4C28): returning RegionLabel of 1
>
>
>Debug: In
>E:\Insight-clean\Insight\Code\Common\itkKLMSegmentationRegion.cxx, lin
>e 428
>KLMSegmentationRegion (00FF4C28): Border Ptr :00FF77B0( 1 - 10 )
>_______________________________________________
>Insight-developers mailing list
>Insight-developers@public.kitware.com
>http://public.kitware.com/mailman/listinfo/insight-developers=20