[Insight-users] Problem with BoundingBox

Parag Chandra pchandra@radonc.unc.edu
Wed, 22 Jan 2003 17:24:35 -0500


This is a multi-part message in MIME format.

------=_NextPart_000_002F_01C2C23B.22195620
Content-Type: text/plain;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

Thanks. The fix I am using currently is to copy itk::BoundingBox into my =
own namespace and then modify ComputeBoundingBox() as follows:

    if (m_PointsContainer->Size() < 1)
      return false;

    for (unsigned int i=3D0; i < PointDimension; i++)
      {
      m_Bounds[2*i] =3D m_PointsContainer->Begin()->Value()[i];
      m_Bounds[2*i+1] =3D m_PointsContainer->Begin()->Value()[i];
      }

Seems to work so far.
  ----- Original Message -----=20
  From: Stephen R. Aylward=20
  To: Parag Chandra=20
  Cc: ITK Mailing List=20
  Sent: Wednesday, January 22, 2003 5:14 PM
  Subject: Re: [Insight-users] Problem with BoundingBox



  Thanks.

  We can change the initial value to =
NumericTraits<valueType>::NonPositiveMin() and your problem should be =
fixed.

  I will check the fix into cvs...

  s

  Parag Chandra wrote:

    I have a 2-D set of points that I want to compute the bounding box =
of. Using itk::BoundingBox->ComputeBoundingBox() gives the correct =
values for the first three points (xMin, xMax, yMin), but the fourth =
point (yMax) is always 2.225e-308, the default value as returned by =
NumericTraits<double>::min(). All the y-values in my point set are =
negative, so of course, the following block:

            if ( point[i] > m_Bounds[2*i+1] )
              {
              m_Bounds[2*i+1] =3D point[i];
              }

    will never be executed. Is this a bug that needs to be/has already =
been addressed?

    Thanks,
    -Parag


--=20
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
Stephen R. Aylward, Ph.D.			www.cs.unc.edu/~aylward
Research Assistant Professor of Radiology		aylward@unc.edu
Adjunct Assistant Professor of Computer Science		  (919)966-9695


------=_NextPart_000_002F_01C2C23B.22195620
Content-Type: text/html;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD><TITLE></TITLE>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Diso-8859-1">
<META content=3D"MSHTML 6.00.2800.1126" name=3DGENERATOR></HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT face=3DArial size=3D2>Thanks. The fix I am using currently is =
to copy=20
itk::BoundingBox into my own namespace and then modify =
ComputeBoundingBox() as=20
follows:</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>&nbsp;&nbsp;&nbsp; if =
(m_PointsContainer-&gt;Size()=20
&lt; 1)<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return false;</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>&nbsp;&nbsp;&nbsp; for (unsigned int =
i=3D0; i &lt;=20
PointDimension; i++)<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
{<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; m_Bounds[2*i] =3D=20
m_PointsContainer-&gt;Begin()-&gt;Value()[i];<BR>&nbsp;&nbsp;&nbsp;&nbsp;=
&nbsp;=20
m_Bounds[2*i+1] =3D=20
m_PointsContainer-&gt;Begin()-&gt;Value()[i];<BR>&nbsp;&nbsp;&nbsp;&nbsp;=
&nbsp;=20
}<BR></FONT></DIV>
<DIV><FONT face=3DArial size=3D2>Seems to work so far.</DIV></FONT>
<BLOCKQUOTE=20
style=3D"PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; =
BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
  <DIV style=3D"FONT: 10pt arial">----- Original Message ----- </DIV>
  <DIV=20
  style=3D"BACKGROUND: #e4e4e4; FONT: 10pt arial; font-color: =
black"><B>From:</B>=20
  <A title=3Daylward@unc.edu href=3D"mailto:aylward@unc.edu">Stephen R. =
Aylward</A>=20
  </DIV>
  <DIV style=3D"FONT: 10pt arial"><B>To:</B> <A =
title=3Dpchandra@radonc.unc.edu=20
  href=3D"mailto:pchandra@radonc.unc.edu">Parag Chandra</A> </DIV>
  <DIV style=3D"FONT: 10pt arial"><B>Cc:</B> <A=20
  title=3Dinsight-users@public.kitware.com=20
  href=3D"mailto:insight-users@public.kitware.com">ITK Mailing List</A> =
</DIV>
  <DIV style=3D"FONT: 10pt arial"><B>Sent:</B> Wednesday, January 22, =
2003 5:14=20
  PM</DIV>
  <DIV style=3D"FONT: 10pt arial"><B>Subject:</B> Re: [Insight-users] =
Problem with=20
  BoundingBox</DIV>
  <DIV><BR></DIV><BR>Thanks.<BR><BR>We can change the initial value to=20
  NumericTraits&lt;valueType&gt;::NonPositiveMin() and your problem =
should be=20
  fixed.<BR><BR>I will check the fix into cvs...<BR><BR>s<BR><BR>Parag =
Chandra=20
  wrote:<BR>
  <BLOCKQUOTE =
cite=3Dmid001e01c2c260$e5260bc0$99221398@radonc.radonc.unc.edu=20
  type=3D"cite">
    <META content=3D"MSHTML 6.00.2800.1126" name=3DGENERATOR>
    <STYLE></STYLE>

    <DIV><FONT face=3DArial size=3D2>I have a 2-D set of points that I =
want to=20
    compute the bounding box of. Using =
itk::BoundingBox-&gt;ComputeBoundingBox()=20
    gives the correct values for the first three points (xMin, xMax, =
yMin), but=20
    the fourth point (yMax) is always 2.225e-308, the default value as =
returned=20
    by NumericTraits&lt;double&gt;::min(). All the y-values in my point =
set are=20
    negative, so of course, the following block:</FONT></DIV>
    <DIV>&nbsp;</DIV>
    <DIV><FONT face=3DArial =
size=3D2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (=20
    point[i] &gt; m_Bounds[2*i+1]=20
    )<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
    {<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
m_Bounds[2*i+1]=20
    =3D =
point[i];<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
    }<BR></FONT></DIV>
    <DIV><FONT face=3DArial size=3D2>will never be executed. Is this a =
bug that=20
    needs to be/has already been addressed?</FONT></DIV>
    <DIV>&nbsp;</DIV>
    <DIV><FONT face=3DArial size=3D2>Thanks,</FONT></DIV>
    <DIV><FONT face=3DArial =
size=3D2>-Parag</FONT></DIV></BLOCKQUOTE><BR><PRE class=3Dmoz-signature =
cols=3D"$mailwrapcol">--=20
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
Stephen R. Aylward, Ph.D.			<A class=3Dmoz-txt-link-abbreviated =
href=3D"http://www.cs.unc.edu/~aylward">www.cs.unc.edu/~aylward</A>
Research Assistant Professor of Radiology		<A =
class=3Dmoz-txt-link-abbreviated =
href=3D"mailto:aylward@unc.edu">aylward@unc.edu</A>
Adjunct Assistant Professor of Computer Science		  (919)966-9695
</PRE><BR></BLOCKQUOTE></BODY></HTML>

------=_NextPart_000_002F_01C2C23B.22195620--