int main( int , char *[] )
{
Image::Pointer image = Image::New();
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);
imageSO->Update();
Point insidePoint;
if( imageSO->IsInsideInWorldSpace(insidePoint) )
{
std::cout << insidePoint << " is inside the image." << std::endl;
}
double returnedValue;
imageSO->ValueAtInWorldSpace(insidePoint,returnedValue);
std::cout << "ValueAt(" << insidePoint << ") = " << returnedValue
<< std::endl;
ImageSpatialObject::DerivativeVectorType returnedDerivative;
imageSO->DerivativeAtInWorldSpace(insidePoint,1,returnedDerivative);
std::cout << "First derivative at " << insidePoint;
std::cout << " = " << returnedDerivative << std::endl;
return EXIT_SUCCESS;
}