[Insight-users] Class to represent points of closed contour?

Parag Chandra pchandra@radonc.unc.edu
Mon, 2 Dec 2002 13:24:55 -0500


This is a multi-part message in MIME format.

------=_NextPart_000_00A6_01C29A06.3467BBD0
Content-Type: text/plain;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

I would appreciate this Polygon class if you could send it to me. I like =
the idea of rendering the polygon and using the pixel values to test. I =
suppose that since itk::Image provides methods for going back and forth =
between image space and physical space, as well as a filter/function to =
interpolate an image, it should be possible to test any arbitrary =
physical point. Thanks for the suggestion, Ofri.

  ----- Original Message -----=20
  From: Ofri Sadowsky=20
  To: Parag Chandra=20
  Cc: insight-users@public.kitware.com=20
  Sent: Saturday, November 30, 2002 3:19 PM
  Subject: Re: [Insight-users] Class to represent points of closed =
contour?


  Depending on permission of my supervisors, I could send you my Polygon =
class that uses itk::Mesh. It's not completely tested yet, and it's =
using the STLContainerAdapter class that I was working on together with =
Luis. But it's there if you want it.=20
  As for testing whether a point is in a mesh or in a polygon. For 2D, =
where the number of faces is the number of edges is the number of =
verstices =3D n , I cannot think of a better performance time than O(n) =
for a single point test. Then if you have k points, it should take =
O(kn). But if you want to test many points, you may consider rendering =
the polygon into a pixelized image, and then test the pixels. That works =
great if the points you're testing are pixels, and not so bad in most =
cases where they're not.=20
  For dimensions greater than 2, the probelm gets complicated. I think =
the most efficient algorithm should do O(f) where f is the number of =
faces (or maybe boundary faces) of the mesh.=20
  Parag Chandra wrote:=20

     Thanks Ofri. I am looking into itk::Mesh, and it seems it provides =
methods to SetPoint() and GetPoint(), but a PointIdentifier is required =
in both cases. All I want to do is tack points onto the end of a list, =
so rather than maintain my own counter that I have to increment after =
adding each point, is there a convenient way to just AddPoint(), so the =
PointIdentifier for a given mesh always starts at zero and just keeps =
incrementing every time a point is added?=20
      ----- Original Message -----
      From: Ofri Sadowsky
      To: Parag Chandra
      Cc: insight-users@public.kitware.com
      Sent: Wednesday, November 27, 2002 9:42 AM
      Subject: Re: [Insight-users] Class to represent points of closed =
contour?
       Joining the question.=20
      I have been searching for a similar thing for a while, and have =
not found it yet. I thought that itk::MeshRegion was supposed to handle =
that, but from a recent question of mine, it is not yet fully developed. =

      In any case, you can try to use itk::Mesh to represent the polygon =
(contour). I've been working on that too for a while, and I'm about to =
get some results. But that still does not answer for the "IsInside" =
question.=20
      Ofri.=20

      Parag Chandra wrote:=20

        Hi all, I apologize if this has been asked before, but it's =
currently a little difficult to search the archives. Basically what I =
want to know is, what is the best way to represent the points of a =
closed contour that I've traced out on a 2-D, binary image? I am =
currently just using std::vector<itk::Point> for this purpose, but I =
would like to be able to perform operations like "Is a given point =
inside the contour or outside?", and I suspect that there is already =
something in ITK that will let me do this. Thanks in advance. Best =
regards,Parag Chandra
------=_NextPart_000_00A6_01C29A06.3467BBD0
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>
<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>I would appreciate this Polygon class =
if you could=20
send it to me. I like the idea of rendering the polygon and using the =
pixel=20
values to test. I suppose that since itk::Image provides methods for =
going back=20
and forth between image space and physical space, as well as a =
filter/function=20
to interpolate an image, it should be possible to test any arbitrary =
physical=20
point. Thanks for the suggestion, Ofri.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<BLOCKQUOTE dir=3Dltr=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=3Dofri@cs.jhu.edu href=3D"mailto:ofri@cs.jhu.edu">Ofri =
Sadowsky</A>=20
</DIV>
  <DIV style=3D"FONT: 10pt arial"><B>To:</B> <A =
title=3DParag@Chandra.com=20
  href=3D"mailto:Parag@Chandra.com">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">insight-users@public.kit=
ware.com</A>=20
  </DIV>
  <DIV style=3D"FONT: 10pt arial"><B>Sent:</B> Saturday, November 30, =
2002 3:19=20
  PM</DIV>
  <DIV style=3D"FONT: 10pt arial"><B>Subject:</B> Re: [Insight-users] =
Class to=20
  represent points of closed contour?</DIV>
  <DIV><BR></DIV>Depending on permission of my supervisors, I&nbsp;could =
send=20
  you my Polygon class that uses itk::Mesh. It's not completely tested =
yet, and=20
  it's using the STLContainerAdapter class that I was working on =
together with=20
  Luis. But it's there if you want it. <BR>As for testing whether a =
point is in=20
  a mesh or in a polygon. For 2D, where the number of faces is the =
number of=20
  edges is the number of verstices =3D n , I&nbsp;cannot think of a =
better=20
  performance time than O(n)&nbsp;for a single point test. Then if you =
have k=20
  points, it should take O(kn). But if you want to test many points, you =
may=20
  consider rendering the polygon into a pixelized image, and then test =
the=20
  pixels. That works great if the points you're testing are pixels, and =
not so=20
  bad in most cases where they're not. <BR>For dimensions greater than =
2, the=20
  probelm gets complicated. I think the most efficient algorithm should =
do O(f)=20
  where f is the number of faces (or maybe boundary faces)&nbsp;of the =
mesh.=20
  <P>Parag Chandra wrote:=20
  <BLOCKQUOTE TYPE=3D"CITE">&nbsp;<FONT face=3DArial><FONT =
size=3D-1>Thanks Ofri. I=20
    am looking into itk::Mesh, and it seems it provides methods to =
SetPoint()=20
    and GetPoint(), but a PointIdentifier is required in both cases. All =
I want=20
    to do is tack points onto the end of a list, so rather than maintain =
my own=20
    counter that I have to increment after adding each point, is there a =

    convenient way to just AddPoint(), so the PointIdentifier for a =
given mesh=20
    always starts at zero and just keeps incrementing every time a point =
is=20
    added?</FONT></FONT>=20
    <BLOCKQUOTE dir=3Dltr=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=3Dofri@cs.jhu.edu href=3D"mailto:ofri@cs.jhu.edu">Ofri=20
      Sadowsky</A></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">insight-users@public.kit=
ware.com</A></DIV>
      <DIV style=3D"FONT: 10pt arial"><B>Sent:</B> Wednesday, November =
27, 2002=20
      9:42 AM</DIV>
      <DIV style=3D"FONT: 10pt arial"><B>Subject:</B> Re: =
[Insight-users] Class to=20
      represent points of closed contour?</DIV>&nbsp;Joining the =
question. <BR>I=20
      have been searching for a similar thing for a while, and have not =
found it=20
      yet. I thought that itk::MeshRegion was supposed to handle that, =
but from=20
      a recent question of mine, it is not yet fully developed. <BR>In =
any case,=20
      you can try to use itk::Mesh to represent the polygon (contour). =
I've been=20
      working on that too for a while, and I'm about to get some =
results. But=20
      that still does not answer for the "IsInside" question.=20
      <P>Ofri.=20
      <P>Parag Chandra wrote:=20
      <BLOCKQUOTE TYPE=3D"CITE">
        <STYLE></STYLE>
        <FONT face=3DArial><FONT size=3D-1>Hi all,</FONT></FONT> <FONT=20
        face=3DArial><FONT size=3D-1>I apologize if this has been asked =
before, but=20
        it's currently a little difficult to search the archives. =
Basically what=20
        I want to know is, what is the best way to represent the points =
of a=20
        closed contour that I've traced out on a 2-D, binary image? I am =

        currently just using std::vector&lt;itk::Point&gt; for this =
purpose, but=20
        I would like to be able to perform operations like "Is a given =
point=20
        inside the contour or outside?", and I suspect that there is =
already=20
        something in ITK that will let me do this. Thanks in=20
        advance.</FONT></FONT> <FONT face=3DArial><FONT size=3D-1>Best =
regards,Parag=20
        =
Chandra</FONT></FONT></BLOCKQUOTE></BLOCKQUOTE></BLOCKQUOTE></BLOCKQUOTE>=
</BODY></HTML>

------=_NextPart_000_00A6_01C29A06.3467BBD0--