int main(int, char* [])
{
typedef ImageMaskSpatialObject::PixelType PixelType;
typedef ImageMaskSpatialObject::ImageType ImageType;
ImageType::Pointer image = ImageType::New();
ImageType::SizeType size = {{ 50, 50, 50 }};
ImageType::IndexType index = {{ 0, 0, 0 }};
ImageType::RegionType region;
region.SetSize(size);
region.SetIndex(index);
image->SetRegions( region );
image->Allocate(true);
ImageType::RegionType insideRegion;
ImageType::SizeType insideSize = {{ 30, 30, 30 }};
ImageType::IndexType insideIndex = {{ 10, 10, 10 }};
insideRegion.SetSize( insideSize );
insideRegion.SetIndex( insideIndex );
Iterator it( image, insideRegion );
it.GoToBegin();
while( !it.IsAtEnd() )
{
++it;
}
ImageMaskSpatialObject::Pointer maskSO = ImageMaskSpatialObject::New();
maskSO->SetImage(image);
ImageMaskSpatialObject::PointType inside;
inside.Fill(20);
std::cout << "Is my point " << inside << " inside my mask? "
<< maskSO->IsInside(inside) << std::endl;
ImageMaskSpatialObject::PointType outside;
outside.Fill(45);
std::cout << "Is my point " << outside << " outside my mask? "
<< !maskSO->IsInside(outside) << std::endl;
return EXIT_SUCCESS;
}