<html><head><style type="text/css"><!-- DIV {margin:0px;} --></style></head><body><div style="font-family:times new roman, new york, times, serif;font-size:12pt"><DIV><FONT color=#0000ff size=2><FONT color=#0000ff size=2>
<P>Hi Dan, </P>
<P> </P>
<P>I'm having a problem with spatial objects.I need to draw objects on my image so decided to work with itkSpacialObjects. I am trying to get the following C++ code to work with managedITK, but I can't find itkBlobSpatialObject and itkSpatialObjectPoint.</P>
<P> </P>
<P>I've added ManagedITK.SpatialObjects and ManagedITK.Common as reference. Are they enough? </P>
<P> </P>
<P>Thanks for your help</P>
<P>Shaady</P>
<P> </P>
<P>#if</FONT></FONT><FONT size=2> </FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>defined</FONT></FONT><FONT size=2>(_MSC_VER)</P></FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>
<P>#pragma</FONT></FONT><FONT size=2> </FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>warning</FONT></FONT><FONT size=2> ( </FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>disable</FONT></FONT><FONT size=2> : 4786 )</P></FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>
<P>#endif</P></FONT></FONT><FONT color=#008000 size=2><FONT color=#008000 size=2>
<P> </P></FONT></FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>
<P>#include</FONT></FONT><FONT size=2> </FONT><FONT color=#a31515 size=2><FONT color=#a31515 size=2>"itkBlobSpatialObject.h"</P></FONT></FONT><FONT color=#008000 size=2><FONT color=#008000 size=2>
<P> </P></FONT></FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>
<P>#include</FONT></FONT><FONT size=2> </FONT><FONT color=#a31515 size=2><FONT color=#a31515 size=2>"itkSpatialObjectPoint.h"</P></FONT></FONT><FONT color=#008000 size=2><FONT color=#008000 size=2>
<P>// Software Guide : EndCodeSnippet</P></FONT></FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>
<P>int</FONT></FONT><FONT size=2> main( </FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>int</FONT></FONT><FONT size=2>, </FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>char</FONT></FONT><FONT size=2> *[] )</P>
<P>{</P></FONT>
<P><FONT color=#0000ff size=2><FONT color=#0000ff size=2>typedef</FONT></FONT><FONT size=2> itk::BlobSpatialObject<3> BlobType;</P>
<P></FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>typedef</FONT></FONT><FONT size=2> BlobType::Pointer BlobPointer;</P>
<P></FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>typedef</FONT></FONT><FONT size=2> itk::SpatialObjectPoint<3> BlobPointType;</P></FONT>
<P><FONT size=2></FONT> </P>
<P><FONT size=2>BlobType::PointListType list;</P>
<P></FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>for</FONT></FONT><FONT size=2>( </FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>unsigned</FONT></FONT><FONT size=2> </FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>int</FONT></FONT><FONT size=2> i=0; i<4; i++)</P>
<P>{</P>
<P>BlobPointType p;</P>
<P>p.SetPosition(i,i+1,i+2);</P>
<P>p.SetRed(1);</P>
<P>p.SetGreen(0);</P>
<P>p.SetBlue(0); </P>
<P>p.SetAlpha(1.0);</P>
<P>list.push_back(p);</P>
<P>}</P></FONT><FONT color=#008000 size=2><FONT color=#008000 size=2>
<P> </P></FONT></FONT><FONT size=2>
<P>BlobPointer blob = BlobType::New();</P>
<P>blob->GetProperty()->SetName(</FONT><FONT color=#a31515 size=2><FONT color=#a31515 size=2>"My Blob"</FONT></FONT><FONT size=2>);</P>
<P>blob->SetId(1);</P>
<P>blob->SetPoints(list);</P></FONT><FONT color=#008000 size=2><FONT color=#008000 size=2>
<P> </P></FONT></FONT><FONT size=2>
<P>BlobType::PointListType pointList = blob->GetPoints();</P>
<P>std::cout << </FONT><FONT color=#a31515 size=2><FONT color=#a31515 size=2>"The blob contains "</FONT></FONT><FONT size=2> << pointList.size();</P>
<P>std::cout << </FONT><FONT color=#a31515 size=2><FONT color=#a31515 size=2>" points"</FONT></FONT><FONT size=2> << std::endl;</P></FONT><FONT color=#008000 size=2><FONT color=#008000 size=2>
<P> </P></FONT></FONT><FONT size=2>
<P>BlobType::PointListType::const_iterator it = blob->GetPoints().begin(); </P>
<P></FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>while</FONT></FONT><FONT size=2>(it != blob->GetPoints().end())</P>
<P>{</P>
<P>std::cout << </FONT><FONT color=#a31515 size=2><FONT color=#a31515 size=2>"Position = "</FONT></FONT><FONT size=2> << (*it).GetPosition() << std::endl;</P>
<P>std::cout << </FONT><FONT color=#a31515 size=2><FONT color=#a31515 size=2>"Color = "</FONT></FONT><FONT size=2> << (*it).GetColor() << std::endl;</P>
<P>it++;</P>
<P>}</P></FONT><FONT color=#008000 size=2><FONT color=#008000 size=2>
<P> </P></FONT></FONT><FONT size=2>
<P></FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>return</FONT></FONT><FONT size=2> 0;</P>
<P>}</P></FONT></DIV></div><br>
<hr size=1>
Not happy with your email address?
<br> <a href="http://uk.docs.yahoo.com/ymail/new.html"> Get the one you
really want</a> - millions of new email addresses available now at <a
href="http://uk.docs.yahoo.com/ymail/new.html"> Yahoo!</a></body></html>