<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.

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

#if defined(_MSC_VER)
#pragma warning ( disable : 4786 )
#endif

#include <iostream>
#include <iomanip>
#include <fstream>
#include "itkExceptionObject.h"
#include "otbImage.h"

#include "otbImageFileReader.h"
#include "itkGradientImageFilter.h"
#include "otbHistogramOfOrientedGradientCovariantImageFunction.h"

typedef unsigned short InputPixelType;
const unsigned int     Dimension = 2;

typedef otb::Image<InputPixelType,  Dimension>                                  InputImageType;
typedef otb::ImageFileReader<InputImageType>                                    ReaderType;
typedef itk::GradientImageFilter<InputImageType>                                GradientFilterType;
typedef GradientFilterType::OutputImageType                                     CovariantImageType;
typedef otb::HistogramOfOrientedGradientCovariantImageFunction<CovariantImageType> FunctionType;


int otbHistogramOfOrientedGradientCovariantImageFunctionNew(int argc, char * argv[])
{
  // Instantiating object
  FunctionType::Pointer function       = FunctionType::New();

  std::cout << function << std::endl;
 
  return EXIT_SUCCESS;
}


int otbHistogramOfOrientedGradientCovariantImageFunction(int argc, char * argv[])
{
  ReaderType::Pointer reader = ReaderType::New();
  reader->SetFileName("C:/ORFEO/OTB-Data/Input/ROI_IKO_PAN_LesHalles.tif");

  GradientFilterType::Pointer gradient = GradientFilterType::New();
  gradient->SetInput(reader->GetOutput());
  gradient->SetUseImageSpacing(false);
  gradient->Update();

  // Instantiating object
  FunctionType::Pointer function       = FunctionType::New();
  function->SetInputImage(gradient->GetOutput());
  
  InputImageType::IndexType index;
  
  unsigned int radius = 2; //atoi(argv[3]);
  index[0] = 273; //atoi(argv[4]);
  index[1] = 64; //atoi(argv[5]);

  function->SetNeighborhoodRadius(radius);

  FunctionType::OutputType value = function->EvaluateAtIndex(index);

  std::ofstream ofs("feTvHistogramOfOrientedGradientCovariantImageFunction.txt");

  for(unsigned i = 0; i < 5; ++i)
    {
    for(unsigned j = 0; j<function->GetNumberOfOrientationBins(); ++j)
      {
      ofs<<value[i][j]<<"\t";
      }
    ofs<<std::endl;
    }

  ofs.close();

  std::cout<<"OKKKKKKKKKKKKKKKKKKKKKKKKKKKKK"<<std::endl;

  return EXIT_SUCCESS;
}
<commit_msg>TEST: We should avoid messing up with tests like this<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.

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

#if defined(_MSC_VER)
#pragma warning ( disable : 4786 )
#endif

#include <iostream>
#include <iomanip>
#include <fstream>
#include "itkExceptionObject.h"
#include "otbImage.h"

#include "otbImageFileReader.h"
#include "itkGradientImageFilter.h"
#include "otbHistogramOfOrientedGradientCovariantImageFunction.h"

typedef unsigned short InputPixelType;
const unsigned int     Dimension = 2;

typedef otb::Image<InputPixelType,  Dimension>                                  InputImageType;
typedef otb::ImageFileReader<InputImageType>                                    ReaderType;
typedef itk::GradientImageFilter<InputImageType>                                GradientFilterType;
typedef GradientFilterType::OutputImageType                                     CovariantImageType;
typedef otb::HistogramOfOrientedGradientCovariantImageFunction<CovariantImageType> FunctionType;


int otbHistogramOfOrientedGradientCovariantImageFunctionNew(int argc, char * argv[])
{
  // Instantiating object
  FunctionType::Pointer function       = FunctionType::New();

  std::cout << function << std::endl;
 
  return EXIT_SUCCESS;
}


int otbHistogramOfOrientedGradientCovariantImageFunction(int argc, char * argv[])
{
  ReaderType::Pointer reader = ReaderType::New();
  reader->SetFileName(argv[1]);

  GradientFilterType::Pointer gradient = GradientFilterType::New();
  gradient->SetInput(reader->GetOutput());
  gradient->SetUseImageSpacing(false);
  gradient->Update();

  // Instantiating object
  FunctionType::Pointer function       = FunctionType::New();
  function->SetInputImage(gradient->GetOutput());
  
  InputImageType::IndexType index;
  
  unsigned int radius = atoi(argv[3]);
  index[0] = atoi(argv[4]);
  index[1] = atoi(argv[5]);

  function->SetNeighborhoodRadius(radius);

  FunctionType::OutputType value = function->EvaluateAtIndex(index);

  std::ofstream ofs(argv[2]);

  for(unsigned i = 0; i < 5; ++i)
    {
    for(unsigned j = 0; j<function->GetNumberOfOrientationBins(); ++j)
      {
      ofs<<value[i][j]<<"\t";
      }
    ofs<<std::endl;
    }

  ofs.close();

  return EXIT_SUCCESS;
}

{'fraction_non_alphanumeric': 0.15710455764075068, 'fraction_numerical': 0.0060768543342269886, 'mean_word_length': 4.239700374531835, 'pattern_counts': {'":': 0, '<': 45, '<?xml version=': 0, '>': 37, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 1, 'word_list_counts': {'cursed_substrings.json': 6, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3637873', 'n_tokens_mistral': 1738, 'n_tokens_neox': 1568, 'n_words': 347}