<commit_before>/**
 *  
 *  This program illustrates the use of Adaptors and
 *  Accessors
 *
 *  The example shows how an Adaptor can be used to 
 *  get acces only to thered component of an RGB image
 *  giving the appearance of being just a 'float' image
 *
 *  That will allow to pass the red component of this
 *  image as input or output to any filter that expects
 *  a float image
 *
 */


#include <itkImageAdaptor.h>
#include <itkScalar.h>
#include <itkImageRegionSimpleIterator.h>
#include <itkRGB.h>
#include <itkDataAccessorRGBtoRed.h>




//-------------------------------------
//     Typedefs for convinience
//-------------------------------------
typedef itk::Image< itk::RGB<float>,   2 > myImageType;


typedef itk::DataAccessorRGBtoRed<float> myRedAccessorType;

typedef itk::ImageAdaptor< myImageType, myRedAccessorType > myRedAdaptorType;

typedef itk::ImageRegionSimpleIterator< myImageType >       myIteratorType;

typedef itk::ImageRegionSimpleIterator< myRedAdaptorType >  myRedIteratorType;



//-------------------------
//
//   Main code
//
//-------------------------
int main() {


  myImageType::SizeType size;
  size[0] = 2;
  size[1] = 2;

  myImageType::IndexType index;
  index[0] = 0;
  index[1] = 0;

  myImageType::RegionType region;
  region.SetIndex( index );
  region.SetSize(  size  );
<commit_msg>ENH: testes after adding RGB to itkPixelTraits.h<commit_after>/**
 *  
 *  This program illustrates the use of Adaptors and
 *  Accessors
 *
 *  The example shows how an Adaptor can be used to 
 *  get acces only to thered component of an RGB image
 *  giving the appearance of being just a 'float' image
 *
 *  That will allow to pass the red component of this
 *  image as input or output to any filter that expects
 *  a float image
 *
 */


#include <itkImageAdaptor.h>
#include <itkScalar.h>
#include <itkImageRegionSimpleIterator.h>
#include <itkRGB.h>
#include <itkDataAccessorRGBtoRed.h>




//-------------------------------------
//     Typedefs for convenience
//-------------------------------------
typedef itk::Image< itk::RGB<float>,   2 > myImageType;
 

typedef itk::DataAccessorRGBtoRed<float> myRedAccessorType;

typedef itk::ImageAdaptor< myImageType, myRedAccessorType > myRedAdaptorType;

typedef itk::ImageRegionSimpleIterator< myImageType >       myIteratorType;

typedef itk::ImageRegionSimpleIterator< myRedAdaptorType >  myRedIteratorType;



//-------------------------
//
//   Main code
//
//-------------------------
int main() {


  myImageType::SizeType size;
  size[0] = 2;
  size[1] = 2;

  myImageType::IndexType index;
  index[0] = 0;
  index[1] = 0;

  myImageType::RegionType region;
  region.SetIndex( index );
  region.SetSize(  size  );

{'fraction_non_alphanumeric': 0.18382352941176472, 'fraction_numerical': 0.006617647058823529, 'mean_word_length': 2.5755584756898817, 'pattern_counts': {'":': 0, '<': 25, '<?xml version=': 0, '>': 25, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1876056', 'n_tokens_mistral': 895, 'n_tokens_neox': 830, 'n_words': 242}