[Insight-users] using spatialObjects in ManagedITK

Shady Shidfar shady_shidfar at yahoo.com
Tue Jul 15 09:21:24 EDT 2008


Hi Dan, 
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.
I've added ManagedITK.SpatialObjects and ManagedITK.Common as reference. Are they enough? 
Thanks for your help
Shaady
#ifdefined(_MSC_VER)#pragmawarning( disable: 4786 )#endif#include"itkBlobSpatialObject.h"#include"itkSpatialObjectPoint.h"// Software Guide : EndCodeSnippetint
{main( int, char*[] )
typedefitk::BlobSpatialObject<3> BlobType;typedefBlobType::Pointer BlobPointer;typedefitk::SpatialObjectPoint<3> BlobPointType;
BlobType::PointListType list;for( unsignedinti=0; i<4; i++)BlobPointer blob = BlobType::New();
blob->GetProperty()->SetName(
blob->SetId(1);
blob->SetPoints(list);"My Blob");BlobType::PointListType pointList = blob->GetPoints();
std::cout << 
std::cout << "The blob contains "<< pointList.size();" points"<< std::endl;BlobType::PointListType::const_iterator it = blob->GetPoints().begin(); 
{
std::cout << 
std::cout << 
it++;
}while(it != blob->GetPoints().end())"Position = "<< (*it).GetPosition() << std::endl;"Color = "<< (*it).GetColor() << std::endl;}return0;
{
BlobPointType p;
p.SetPosition(i,i+1,i+2);
p.SetRed(1);
p.SetGreen(0);
p.SetBlue(0); 
p.SetAlpha(1.0);
list.push_back(p);
}


      __________________________________________________________
Not happy with your email address?.
Get the one you really want - millions of new email addresses available now at Yahoo! http://uk.docs.yahoo.com/ymail/new.html
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20080715/486ef7fd/attachment.htm>


More information about the Insight-users mailing list