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

  Author: <NAME>

  This is a converter from STL file format into ITK spatial object file 
  format (.meta). 
  
  The converter requires the name of the input STL and output META files 
  as command line arguments.

  This file includes a chunk of code borrowed from Insight Applications, 
  to convert a VTK polydata object into an ITK mesh object.

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

#include "argio.hh"
#include <iostream>
#include <string>

#include <vtkSTLReader.h>
#include "vtkPolyDataWriter.h"
#include "vtkPolyData.h"

#ifndef vtkFloatingPointType
#define vtkFloatingPointType float
#endif

int main(int argc, const char **argv)
{
  if ( argc < 2 ) 
  {
    std::cout << "Usage: " << argv[0] << " Input Output" << endl ;
    return 0 ;
  }

  std::string inputFilename = argv[1] ;
  std::string outputFilename = argv[2] ;

  // load the stl file
  vtkSTLReader *reader ;
  reader = vtkSTLReader::New() ;
  reader->SetFileName (inputFilename.c_str()) ;
  std::cout << "Reading input" << endl ;
  reader->Update() ;
  
  std::cout << "Converting mesh" << endl ;
  vtkPolyData *polyData = reader->GetOutput() ;

  vtkPolyDataWriter *writer = vtkPolyDataWriter::New () ;
  writer->SetFileName ( outputFilename.c_str () ) ;
  writer->SetInput ( polyData ) ;
  writer->Update () ;
  
  std::cout << "Conversion Completed" << endl ;<commit_msg>ENH: STL2VTK compiles with VTK 6<commit_after>/*=========================================================================

  Author: <NAME>

  This is a converter from STL file format into ITK spatial object file 
  format (.meta). 
  
  The converter requires the name of the input STL and output META files 
  as command line arguments.

  This file includes a chunk of code borrowed from Insight Applications, 
  to convert a VTK polydata object into an ITK mesh object.

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

#include "argio.hh"
#include <iostream>
#include <string>

#include <vtkVersion.h>
#include <vtkSTLReader.h>
#include "vtkPolyDataWriter.h"
#include "vtkPolyData.h"

#ifndef vtkFloatingPointType
#define vtkFloatingPointType float
#endif

int main(int argc, const char **argv)
{
  if ( argc < 2 ) 
  {
    std::cout << "Usage: " << argv[0] << " Input Output" << endl ;
    return 0 ;
  }

  std::string inputFilename = argv[1] ;
  std::string outputFilename = argv[2] ;

  // load the stl file
  vtkSTLReader *reader ;
  reader = vtkSTLReader::New() ;
  reader->SetFileName (inputFilename.c_str()) ;
  std::cout << "Reading input" << endl ;
  reader->Update() ;
  
  std::cout << "Converting mesh" << endl ;
  vtkPolyData *polyData = reader->GetOutput() ;

  vtkPolyDataWriter *writer = vtkPolyDataWriter::New () ;
  writer->SetFileName ( outputFilename.c_str () ) ;
  #if VTK_MAJOR_VERSION > 5
  writer->SetInputData ( polyData ) ;
  #else
  writer->SetInput ( polyData ) ;
  #endif
  writer->Update () ;
  
  std::cout << "Conversion Completed" << endl ;
{'fraction_non_alphanumeric': 0.20660621761658032, 'fraction_numerical': 0.0042098445595854924, 'mean_word_length': 4.209106239460371, 'pattern_counts': {'":': 0, '<': 54, '<?xml version=': 0, '>': 26, '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': '2749459', 'n_tokens_mistral': 994, 'n_tokens_neox': 935, 'n_words': 278}