int main( int , char *[] )
{
Image::Pointer image = Image::New();
Image::SizeType size = {{ 10, 10 }};
Image::RegionType region;
region.SetSize(size);
image->SetRegions(region);
image->Allocate();
Iterator it(image,region);
short pixelValue =0;
for(it.GoToBegin(); !it.IsAtEnd(); ++it, ++pixelValue)
{
it.Set(pixelValue);
}
ImageSpatialObject::Pointer imageSO = ImageSpatialObject::New();
imageSO->SetImage(image);
Point insidePoint;
if( imageSO->IsInside(insidePoint) )
{
std::cout << insidePoint << " is inside the image." << std::endl;
}
double returnedValue;
imageSO->ValueAt(insidePoint,returnedValue);
std::cout << "ValueAt(" << insidePoint << ") = " << returnedValue
<< std::endl;
ImageSpatialObject::OutputVectorType returnedDerivative;
imageSO->DerivativeAt(insidePoint,1,returnedDerivative);
std::cout << "First derivative at " << insidePoint;
std::cout << " = " << returnedDerivative << std::endl;
return EXIT_SUCCESS;
}