int main(int, char*[])
{
CreateImage(image);
CastRescaleAndWrite(image, "input.png");
SobelOperatorType sobelOperator;
sobelOperator.SetDirection(0);
sobelOperator.CreateToRadius(radius);
filter->SetOperator(sobelOperator);
filter->SetInput(image);
filter->Update();
CastRescaleAndWrite(filter->GetOutput(), "output.png");
return EXIT_SUCCESS;
}
{
FloatImageType::IndexType start;
start.Fill(0);
FloatImageType::SizeType size;
size.Fill(100);
FloatImageType::RegionType region(start,size);
image->SetRegions(region);
image->Allocate();
image->FillBuffer(0);
for(unsigned int r = 20; r < 80; r++)
{
for(unsigned int c = 20; c < 80; c++)
{
FloatImageType::IndexType pixelIndex;
pixelIndex[0] = r;
pixelIndex[1] = c;
image->SetPixel(pixelIndex, 15);
}
}
}
{
rescaleFilter->SetInput(image);
rescaleFilter->SetOutputMinimum(0);
rescaleFilter->SetOutputMaximum(255);
rescaleFilter->Update();
writer->SetFileName(filename);
writer->SetInput(rescaleFilter->GetOutput());
writer->Update();
}