<commit_before>/*=========================================================================

  Program:   ORFEO Toolbox
  Language:  C++
  Date:      $Date$
  Version:   $Revision$


  Copyright (c) Centre National d'Etudes Spatiales. All rights reserved.
  See OTBCopyright.txt for details.


     This software is distributed WITHOUT ANY WARRANTY; without even
     the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
     PURPOSE.  See the above copyright notices for more information.

=========================================================================*/

#include <iostream>

#include "otbVectorImage.h"
#include "otbImageFileReader.h"
#include "otbCommandLineArgumentParser.h"
#include "otbMultiToMonoChannelExtractROI.h"
#include "otbStreamingCompareImageFilter.h"

int main(int argc, char* argv[])
{
  // Parse command line parameters
  typedef otb::CommandLineArgumentParser ParserType;
  ParserType::Pointer parser = ParserType::New();

  parser->SetProgramDescription("Estimator between 2 images");
  parser->AddOption("--InputReference","The reference image","-inR", 1, true);
  parser->AddOption("--InputMeasured","The measured image","-inM", 1, true);
  parser->AddOption("--NumBandRefImage","The channel number to compare in the reference image (between 1 and number of channels)","-chR", 1, true);
  parser->AddOption("--NumBandMeasuredImage","The channel number to compare in the measured image (between 1 and number of channels)","-chM", 1, true);
  parser->AddOption("--StartX", "first point in x-axis ", "-x0", 1, false);
  parser->AddOption("--StartY", "first point in y-axis ", "-y0", 1, false);
  parser->AddOption("--SizeX", "size in x-axis ", "-Nx", 1, false);
  parser->AddOption("--SizeY", "size in y-axis ", "-Ny", 1, false);
  
  typedef otb::CommandLineArgumentParseResult ParserResultType;
  ParserResultType::Pointer  parseResult = ParserResultType::New();

  try
  {
    parser->ParseCommandLine(argc,argv,parseResult);
  }
  catch ( itk::ExceptionObject & err )
  {
    std::string descriptionException = err.GetDescription();
    if (descriptionException.find("ParseCommandLine(): Help Parser") != std::string::npos)
      {
      return EXIT_SUCCESS;
      }
    if (descriptionException.find("ParseCommandLine(): Version Parser") != std::string::npos)
      {
      return EXIT_SUCCESS;
      }
    return EXIT_FAILURE;
  }

  typedef double PixelType;

  typedef otb::VectorImage<PixelType, 2>                                              ImageType;
  typedef otb::ImageFileReader<ImageType>                                             ReaderType;
  typedef otb::MultiToMonoChannelExtractROI<PixelType, PixelType>                     ExtractROIMonoFilterType;
  typedef otb::StreamingCompareImageFilter<ExtractROIMonoFilterType::OutputImageType> StreamingCompareImageFilterType;
  //typedef otb::StreamingStatisticsImageFilter<ExtractROIMonoFilterType::OutputImageType> StreamingCompareImageFilterType;
  // Read input images information
  ReaderType::Pointer reader1= ReaderType::New();
  reader1->SetFileName(parseResult->GetParameterString("--InputReference"));
  reader1->GenerateOutputInformation();

  ReaderType::Pointer reader2= ReaderType::New();
  reader2->SetFileName(parseResult->GetParameterString("--InputMeasured"));
  reader2->GenerateOutputInformation();

  unsigned int layer1 = parseResult->GetParameterUInt("--NumBandRefImage");
  unsigned int layer2 = parseResult->GetParameterUInt("--NumBandMeasuredImage");

  
  
 
  ExtractROIMonoFilterType::Pointer extractROIMonoFilter1= ExtractROIMonoFilterType::New();
  extractROIMonoFilter1->SetInput(reader1->GetOutput());
  extractROIMonoFilter1->SetChannel( layer1 );

  ExtractROIMonoFilterType::Pointer extractROIMonoFilter2= ExtractROIMonoFilterType::New();
  extractROIMonoFilter2->SetInput(reader2->GetOutput());
  extractROIMonoFilter2->SetChannel( layer2 );

  if (parseResult->IsOptionPresent("--StartX")) 
    {
    extractROIMonoFilter1->SetStartX(parseResult->GetParameterULong("--StartX"));
    extractROIMonoFilter2->SetStartX(parseResult->GetParameterULong("--StartX"));
    }
  if (parseResult->IsOptionPresent("--StartY")) 
    {
    extractROIMonoFilter1->SetStartY(parseResult->GetParameterULong("--StartY"));
    extractROIMonoFilter2->SetStartY(parseResult->GetParameterULong("--StartY"));
    }

  if (parseResult->IsOptionPresent("--SizeX"))<commit_msg>ENH:channel number is now optionnal in the otbComapreImages utilities (channel 1 uses by default<commit_after>/*=========================================================================

  Program:   ORFEO Toolbox
  Language:  C++
  Date:      $Date$
  Version:   $Revision$


  Copyright (c) Centre National d'Etudes Spatiales. All rights reserved.
  See OTBCopyright.txt for details.


     This software is distributed WITHOUT ANY WARRANTY; without even
     the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
     PURPOSE.  See the above copyright notices for more information.

=========================================================================*/

#include <iostream>

#include "otbVectorImage.h"
#include "otbImageFileReader.h"
#include "otbCommandLineArgumentParser.h"
#include "otbMultiToMonoChannelExtractROI.h"
#include "otbStreamingCompareImageFilter.h"

int main(int argc, char* argv[])
{
  // Parse command line parameters
  typedef otb::CommandLineArgumentParser ParserType;
  ParserType::Pointer parser = ParserType::New();

  parser->SetProgramDescription("Estimator between 2 images");
  parser->AddOption("--InputReference","The reference image","-inR", 1, true);
  parser->AddOption("--InputMeasured","The measured image","-inM", 1, true);
  parser->AddOption("--NumBandRefImage","The channel number to compare in the reference image (between 1 and number of channels)","-chR", 1, false);
  parser->AddOption("--NumBandMeasuredImage","The channel number to compare in the measured image (between 1 and number of channels)","-chM", 1, false);
  parser->AddOption("--StartX", "first point in x-axis ", "-x0", 1, false);
  parser->AddOption("--StartY", "first point in y-axis ", "-y0", 1, false);
  parser->AddOption("--SizeX", "size in x-axis ", "-Nx", 1, false);
  parser->AddOption("--SizeY", "size in y-axis ", "-Ny", 1, false);
  
  typedef otb::CommandLineArgumentParseResult ParserResultType;
  ParserResultType::Pointer  parseResult = ParserResultType::New();

  try
  {
    parser->ParseCommandLine(argc,argv,parseResult);
  }
  catch ( itk::ExceptionObject & err )
  {
    std::string descriptionException = err.GetDescription();
    if (descriptionException.find("ParseCommandLine(): Help Parser") != std::string::npos)
      {
      return EXIT_SUCCESS;
      }
    if (descriptionException.find("ParseCommandLine(): Version Parser") != std::string::npos)
      {
      return EXIT_SUCCESS;
      }
    return EXIT_FAILURE;
  }

  typedef double PixelType;

  typedef otb::VectorImage<PixelType, 2>                                              ImageType;
  typedef otb::ImageFileReader<ImageType>                                             ReaderType;
  typedef otb::MultiToMonoChannelExtractROI<PixelType, PixelType>                     ExtractROIMonoFilterType;
  typedef otb::StreamingCompareImageFilter<ExtractROIMonoFilterType::OutputImageType> StreamingCompareImageFilterType;
  //typedef otb::StreamingStatisticsImageFilter<ExtractROIMonoFilterType::OutputImageType> StreamingCompareImageFilterType;
  // Read input images information
  ReaderType::Pointer reader1= ReaderType::New();
  reader1->SetFileName(parseResult->GetParameterString("--InputReference"));
  reader1->GenerateOutputInformation();

  ReaderType::Pointer reader2= ReaderType::New();
  reader2->SetFileName(parseResult->GetParameterString("--InputMeasured"));
  reader2->GenerateOutputInformation();

  unsigned int layer1 = 1;
  unsigned int layer2 = 1;

  if (parseResult->IsOptionPresent("--NumBandRefImage")) 
    {
    layer1 = parseResult->GetParameterUInt("--NumBandRefImage");
    }
  
  if (parseResult->IsOptionPresent("--NumBandMeasuredImage")) 
    {
    layer2 = parseResult->GetParameterUInt("--NumBandMeasuredImage");
    }
 
  ExtractROIMonoFilterType::Pointer extractROIMonoFilter1= ExtractROIMonoFilterType::New();
  extractROIMonoFilter1->SetInput(reader1->GetOutput());
  extractROIMonoFilter1->SetChannel( layer1 );

  ExtractROIMonoFilterType::Pointer extractROIMonoFilter2= ExtractROIMonoFilterType::New();
  extractROIMonoFilter2->SetInput(reader2->GetOutput());
  extractROIMonoFilter2->SetChannel( layer2 );

  if (parseResult->IsOptionPresent("--StartX")) 
    {
    extractROIMonoFilter1->SetStartX(parseResult->GetParameterULong("--StartX"));
    extractROIMonoFilter2->SetStartX(parseResult->GetParameterULong("--StartX"));
    }
  if (parseResult->IsOptionPresent("--StartY")) 
    {
    extractROIMonoFilter1->SetStartY(parseResult->GetParameterULong("--StartY"));
    extractROIMonoFilter2->SetStartY(parseResult->GetParameterULong("--StartY"));
    }

  if (parseResult->IsOptionPresent("--SizeX"))
{'fraction_non_alphanumeric': 0.15469491338408917, 'fraction_numerical': 0.008496082974732429, 'mean_word_length': 4.851517107811492, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 87, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 8, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3364439', 'n_tokens_mistral': 2636, 'n_tokens_neox': 2520, 'n_words': 520}