X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;ds=sidebyside;f=appli%2Fexamples%2Fexample_LightCompensation.cxx;fp=appli%2Fexamples%2Fexample_LightCompensation.cxx;h=44062edddf794065568fae1af72215d89356ee67;hb=aa6a578004bddb5b0bb07b780483fda0ecc6cb5e;hp=0000000000000000000000000000000000000000;hpb=d72223cf80b1703d6f6b31e749af5ffe2e96cbfb;p=cpPlugins.git diff --git a/appli/examples/example_LightCompensation.cxx b/appli/examples/example_LightCompensation.cxx new file mode 100644 index 0000000..44062ed --- /dev/null +++ b/appli/examples/example_LightCompensation.cxx @@ -0,0 +1,57 @@ +#include +#include +#include + +#include +#include +#include + +#include + +// ------------------------------------------------------------------------- +const unsigned int Dim = 2; +typedef itk::RGBPixel< unsigned char > TPixel; +typedef itk::Image< TPixel, Dim > TImage; + +// ------------------------------------------------------------------------- +int main( int argc, char* argv[] ) +{ + if( argc < 3 ) + { + std::cerr + << "Usage: " << argv[ 0 ] + << " input_image output_image" + << std::endl; + return( 1 ); + + } // fi + std::string input_image_fn = argv[ 1 ]; + std::string output_image_fn = argv[ 2 ]; + + // Read image + itk::ImageFileReader< TImage >::Pointer input_image_reader = + itk::ImageFileReader< TImage >::New( ); + input_image_reader->SetFileName( input_image_fn ); + try + { + input_image_reader->Update( ); + } + catch( itk::ExceptionObject& err ) + { + std::cerr << "Error caught: " << err << std::endl; + return( 1 ); + + } // yrt + TImage::Pointer input_image = input_image_reader->GetOutput( ); + + cpPlugins::Extensions::Algorithms:: + LightCompensationFilter< TImage >::Pointer filter = + cpPlugins::Extensions::Algorithms:: + LightCompensationFilter< TImage >::New( ); + filter->SetInput( input_image ); + filter->Update( ); + + return( 0 ); +} + +// eof - $RCSfile$