ITK  5.2.0
Insight Toolkit
SphinxExamples/src/Developer/OilPaintingImageFilter.cxx
#include "itkImage.h"
#include "itkOilPaintingImageFilter.h"
#ifdef ENABLE_QUICKVIEW
# include "QuickView.h"
#endif
int
main(int argc, char * argv[])
{
if (argc < 2)
{
std::cerr << "Usage: " << argv[0] << " inputFile [bins [radius]]" << std::endl;
return EXIT_FAILURE;
}
unsigned int numberOfBins = 50;
if (argc > 3)
{
numberOfBins = std::stoi(argv[2]);
}
unsigned int radius = 2;
if (argc > 4)
{
radius = std::stoi(argv[3]);
}
using ImageType = itk::Image<unsigned char, 2>;
using FilterType = itk::OilPaintingImageFilter<ImageType>;
using ReaderType = itk::ImageFileReader<ImageType>;
ReaderType::Pointer reader = ReaderType::New();
reader->SetFileName(argv[1]);
reader->Update();
FilterType::Pointer filter = FilterType::New();
filter->SetInput(reader->GetOutput());
filter->SetNumberOfBins(numberOfBins);
filter->SetRadius(radius);
filter->Update();
#ifdef ENABLE_QUICKVIEW
QuickView viewer;
viewer.AddImage(reader->GetOutput(), true, itksys::SystemTools::GetFilenameName(reader->GetFileName()));
std::stringstream desc;
desc << "OilPaintingImageFilter, bins = " << numberOfBins << " radius = " << radius;
viewer.AddImage(filter->GetOutput(), true, desc.str());
viewer.Visualize();
#endif
return EXIT_SUCCESS;
}
itkImageFileReader.h
itkImage.h
itk::ImageFileReader
Data source that reads image data from a single file.
Definition: itkImageFileReader.h:75
QuickView.h
QuickView::AddImage
void AddImage(TImage *, bool FlipVertical=true, std::string Description="")
QuickView
A convenient class to render itk images with vtk.
Definition: QuickView.h:111
itk::Image
Templated n-dimensional image class.
Definition: itkImage.h:86
QuickView::Visualize
void Visualize(bool interact=true)