static void CreateImage(ImageType::Pointer image);
int main(int argc, char *argv[])
{
ImageType::Pointer image = ImageType::New();
CreateImage(image);
TranslationTransformType::Pointer transform =
TranslationTransformType::New();
TranslationTransformType::OutputVectorType translation;
translation[0] = 10;
translation[1] = 20;
transform->Translate(translation);
ResampleImageFilterType::Pointer resampleFilter = ResampleImageFilterType::New();
resampleFilter->SetTransform(transform.GetPointer());
resampleFilter->SetInput(image);
resampleFilter->SetSize( size );
resampleFilter->Update();
viewer.
AddImage(resampleFilter->GetOutput());
return EXIT_SUCCESS;
}
void CreateImage(ImageType::Pointer image)
{
image->SetRegions(region);
image->Allocate();
image->FillBuffer(0);
for(unsigned int r = 40; r < 60; r++)
{
for(unsigned int c = 40; c < 60; c++)
{
pixelIndex[0] = r;
pixelIndex[1] = c;
image->SetPixel(pixelIndex, 255);
}
}
}