int main(int argc, char *argv[])
{
if( argc == 2)
{
std::string fileName = argv[1];
reader->SetFileName(fileName);
reader->Update();
image = reader->GetOutput();
}
else
{
CreateImage(image);
WriteImage(image, "input.png");
}
binaryThinningImageFilter->SetInput(image);
binaryThinningImageFilter->Update();
rescaler->SetInput( binaryThinningImageFilter->GetOutput() );
rescaler->SetOutputMinimum(0);
rescaler->SetOutputMaximum(255);
rescaler->Update();
WriteImage(rescaler->GetOutput(), "output.png");
return EXIT_SUCCESS;
}
{
ImageType::IndexType start;
start.Fill(0);
ImageType::SizeType size;
size.Fill(100);
ImageType::RegionType region(start,size);
image->SetRegions(region);
image->Allocate();
image->FillBuffer(0);
for(unsigned int i = 20; i < 80; ++i)
{
for(unsigned int j = 50; j < 55; ++j)
{
index[0] = i;
index[1] = j;
image->SetPixel(index, 255);
}
}
}
{
writer->SetFileName(fileName);
writer->SetInput(image);
writer->Update();
}