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

  Programme :   OTB (ORFEO ToolBox)
  Auteurs   :   CS - C.Ruffel
  Language  :   C++
  Date      :   10 avril 2006
  Version   :   
  Role      :   Test le filtre DrawLineSpatialOjectListImageFilter 
  	    :   qui permet de dessiner les lignes contenues dans une liste 
  $Id$

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

#define MAIN


#include "itkExceptionObject.h"
#include "itkImage.h"
#include "itkImageFileWriter.h"

#include <iostream>
#include <list>

#include "otbImageFileReader.h"
#include "otbImageFileWriter.h"
#include "otbDrawLineSpatialObjectListFilter.h"


int otbDrawLineSpatialObjectList( int argc, char* argv[] )
{
  try 
    {  
    	const char * inputFilename  = argv[1];
        const char * outputFilename = argv[2];
                       
        typedef double		                                InputPixelType;
        typedef unsigned char	   	                        OutputPixelType;
        const   unsigned int        	                        Dimension = 2;

        typedef itk::Image< InputPixelType,  Dimension >        InputImageType;
        typedef itk::Image< OutputPixelType, Dimension >        OutputImageType;

        typedef otb::DrawLineSpatialObjectListFilter< InputImageType,OutputImageType >   FilterType;
	
        FilterType::Pointer filter = FilterType::New();
        
        typedef otb::ImageFileReader< InputImageType  >         ReaderType;
        typedef otb::ImageFileWriter< OutputImageType >         WriterType;

        
        ReaderType::Pointer reader = ReaderType::New();
        WriterType::Pointer writer = WriterType::New();

        reader->SetFileName( inputFilename  );
        writer->SetFileName( outputFilename );
        
        typedef itk::LineSpatialObject<2>		LineType;
  	typedef std::list< LineType::Pointer >		LinesListType;
  	LinesListType list;
  	
  	LineType::PointListType pointList;
        LineType::LinePointType point;
        
        // Definition of the first line
        double Ux, Uy, Vx, Vy;
        Ux = 10.;
        Uy = 12.;
        Vx = 35.;
        Vy = 29.;
        
        point.SetPosition(Ux,Uy);
        pointList.push_back(point);
        point.SetPosition(Vx,Vy);
        pointList.push_back(point);
        
        LineType::Pointer line = LineType::New();
        line->SetId(0);
        line->SetPoints( pointList );
        line->ComputeBoundingBox();
       
        list.push_back(line);
        
        // Definition of a second line
        Ux = 8.;
        Uy = 7.;
        Vx = 8.;
        Vy = 46.;
        
        point.SetPosition(Ux,Uy);
        pointList.push_back(point);
        point.SetPosition(Vx,Vy);
        pointList.push_back(point);
        
 //       LineType::Pointer line = LineType::New();
        line->SetId(0);
        line->SetPoints( pointList );
        line->ComputeBoundingBox();
       
        list.push_back(line); 
        
        filter->SetInputLineSpatialObjectList(list);
        
        filter->SetInput( reader->GetOutput() );
        writer->SetInput( filter->GetOutput() );
        
        writer->Update();
        
    } 
  catch( itk::ExceptionObject & err ) 
    { 
    std::cout << "Exception itk::ExceptionObject levee !" << std::endl; 
    std::cout << err << std::endl; 
    return EXIT_FAILURE;
    } 
  catch( ... ) 
    { 
    std::cout << "Exception levee inconnue !" << std::endl; 
    return EXIT_FAILURE;
    } <commit_msg>nomsg<commit_after>/*=========================================================================

  Programme :   OTB (ORFEO ToolBox)
  Auteurs   :   CS - C.Ruffel
  Language  :   C++
  Date      :   10 avril 2006
  Version   :   
  Role      :   Test le filtre DrawLineSpatialOjectListImageFilter 
  	    :   qui permet de dessiner les lignes contenues dans une liste 
  $Id$

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

#define MAIN


#include "itkExceptionObject.h"
#include "itkImage.h"
#include "itkImageFileWriter.h"

#include <iostream>
#include <list>

#include "otbImageFileReader.h"
#include "otbImageFileWriter.h"
#include "otbDrawLineSpatialObjectListFilter.h"


int otbDrawLineSpatialObjectList( int argc, char* argv[] )
{
  try 
    {  
    	const char * inputFilename  = argv[1];
        const char * outputFilename = argv[2];
                       
        typedef double		                                InputPixelType;
        typedef unsigned char	   	                        OutputPixelType;
        const   unsigned int        	                        Dimension = 2;

        typedef itk::Image< InputPixelType,  Dimension >        InputImageType;
        typedef itk::Image< OutputPixelType, Dimension >        OutputImageType;

        typedef otb::DrawLineSpatialObjectListFilter< InputImageType,OutputImageType >   FilterType;
	
        FilterType::Pointer filter = FilterType::New();
        
        typedef otb::ImageFileReader< InputImageType  >         ReaderType;
        typedef otb::ImageFileWriter< OutputImageType >         WriterType;

        
        ReaderType::Pointer reader = ReaderType::New();
        WriterType::Pointer writer = WriterType::New();

        reader->SetFileName( inputFilename  );
        writer->SetFileName( outputFilename );
        
        typedef itk::LineSpatialObject<2>		LineType;
  	typedef std::list< LineType::Pointer >		LinesListType;
  	LinesListType list;
  	
  	LineType::PointListType pointList;
        LineType::LinePointType point;
        
        // Definition of the first line
        double Ux, Uy, Vx, Vy;
        Ux = 10.;
        Uy = 12.;
        Vx = 35.;
        Vy = 29.;
        
        point.SetPosition(Ux,Uy);
        pointList.push_back(point);
        point.SetPosition(Vx,Vy);
        pointList.push_back(point);
        
        LineType::Pointer line = LineType::New();
        line->SetId(0);
        line->SetPoints( pointList );
        line->ComputeBoundingBox();
       
        list.push_back(line);
        
        // Definition of a second line
        Ux = 8.;
        Uy = 7.;
        Vx = 8.;
        Vy = 46.;
        
        point.SetPosition(Ux,Uy);
        pointList.push_back(point);
        point.SetPosition(Vx,Vy);
        pointList.push_back(point);
        
        LineType::Pointer line2 = LineType::New();
        line2->SetId(0);
        line2->SetPoints( pointList );
        line2->ComputeBoundingBox();
       
        list.push_back(line2); 
        
        filter->SetInputLineSpatialObjectList(list);
        
        filter->SetInput( reader->GetOutput() );
        writer->SetInput( filter->GetOutput() );
        
        writer->Update();
        
    } 
  catch( itk::ExceptionObject & err ) 
    { 
    std::cout << "Exception itk::ExceptionObject levee !" << std::endl; 
    std::cout << err << std::endl; 
    return EXIT_FAILURE;
    } 
  catch( ... ) 
    { 
    std::cout << "Exception levee inconnue !" << std::endl; 
    return EXIT_FAILURE;
    } 
{'fraction_non_alphanumeric': 0.14267834793491865, 'fraction_numerical': 0.008760951188986232, 'mean_word_length': 2.1040138109624515, 'pattern_counts': {'":': 0, '<': 45, '<?xml version=': 0, '>': 49, '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': '2554515', 'n_tokens_mistral': 2195, 'n_tokens_neox': 2077, 'n_words': 426}