int main(int, char* [])
{
using PixelType = ImageMaskSpatialObject::PixelType;
using ImageType = ImageMaskSpatialObject::ImageType;
ImageType::Pointer image = ImageType::New();
region.SetIndex(index);
image->SetRegions( region );
image->Allocate(true);
insideRegion.SetSize( insideSize );
Iterator it( image, insideRegion );
it.GoToBegin();
while( !it.IsAtEnd() )
{
it.Set( itk::NumericTraits< PixelType >::max() );
++it;
}
ImageMaskSpatialObject::Pointer maskSO = ImageMaskSpatialObject::New();
maskSO->SetImage(image);
maskSO->Update();
std::cout << "Is my point " << inside << " inside my mask? "
<< maskSO->IsInsideInWorldSpace(inside) << std::endl;
std::cout << "Is my point " << outside << " outside my mask? "
<< !maskSO->IsInsideInWorldSpace(outside) << std::endl;
return EXIT_SUCCESS;
}