ITK/Examples/SpatialObjects/BlobSpatialObject

From KitwarePublic
< ITK‎ | Examples
Revision as of 15:02, 2 February 2011 by Daviddoria (talk | contribs) (Created page with "==BlobSpatialObject.cxx== <source lang="cpp"> #include "itkBlobSpatialObject.h" int main( int argc, char *argv[] ) { typedef itk::BlobSpatialObject<2> BlobType; // Create a...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search

BlobSpatialObject.cxx

<source lang="cpp">

  1. include "itkBlobSpatialObject.h"

int main( int argc, char *argv[] ) {

 typedef itk::BlobSpatialObject<2> BlobType;
 // Create a list of points
 BlobType::PointListType points;
 for(unsigned int i = 0; i < 20; i++)
   {
   BlobType::BlobPointType point;
   point.SetPosition(i,i);
   points.push_back(point);
   }
 BlobType::Pointer blob = BlobType::New();
 blob->SetPoints(points);
 
 BlobType::BoundingBoxType::BoundsArrayType bounds = blob->GetBoundingBox()->GetBounds();
 std::cout << "Bounds: " << bounds << std::endl;
 
 return EXIT_SUCCESS;

}

</source>

CMakeLists.txt

<source lang="cmake"> cmake_minimum_required(VERSION 2.6)

PROJECT(BlobSpatialObject)

FIND_PACKAGE(ITK REQUIRED) INCLUDE(${ITK_USE_FILE})

ADD_EXECUTABLE(BlobSpatialObject BlobSpatialObject.cxx) TARGET_LINK_LIBRARIES(BlobSpatialObject ITKIO)

</source>