ITK  4.8.0
Insight Segmentation and Registration Toolkit
WikiExamples/SimpleOperations/RequestedRegion.cxx
#include "itkImage.h"
int main(int, char *[])
{
typedef itk::Image<float, 2> ImageType;
itk::Size<2> smallSize;
smallSize.Fill(10);
index.Fill(0);
itk::ImageRegion<2> region(index, smallSize);
itk::Size<2> bigSize;
bigSize.Fill(10000);
randomImageSource->SetNumberOfThreads(1); // to produce non-random results
randomImageSource->SetSize(bigSize);
randomImageSource->GetOutput()->SetRequestedRegion(smallSize);
randomImageSource->Update();
std::cout << "Created random image." << std::endl;
typedef itk::DerivativeImageFilter<ImageType, ImageType > DerivativeImageFilterType;
DerivativeImageFilterType::Pointer derivativeFilter = DerivativeImageFilterType::New();
derivativeFilter->SetInput( randomImageSource->GetOutput() );
derivativeFilter->SetDirection(0); // "x" axis
derivativeFilter->GetOutput()->SetRequestedRegion(smallSize);
derivativeFilter->Update();
std::cout << "Computed derivative." << std::endl;
return EXIT_SUCCESS;
}