Exemplo n.º 1
0
  int antsImageWrite( SEXP r_image , // image to write
                      std::string filename )
  {
    typedef typename ImageType::Pointer ImagePointerType;
    ImagePointerType image = Rcpp::as<ImagePointerType>( r_image );

    typedef itk::ImageFileWriter< ImageType > ImageWriterType ;
    typename ImageWriterType::Pointer image_writer = ImageWriterType::New() ;
    image_writer->SetFileName( filename.c_str() ) ;
    image_writer->SetInput( image );
    image_writer->Update();
    return 0;
  }
Exemplo n.º 2
0
  int antsImageWrite( typename ImageType::Pointer image , // image to write 
		      std::string filename // target file
		      )
  {
    typedef itk::ImageFileWriter< ImageType > ImageWriterType ;
    typename ImageWriterType::Pointer image_writer = ImageWriterType::New() ;
    image_writer->SetFileName( filename.c_str() ) ;
    image_writer->SetInput( image );
    try
      {
      image_writer->Update();
      }    
    catch( itk::ExceptionObject & e )
      {
      Rcpp::Rcout << "Exception caught during reference file writing " << std::endl;
      Rcpp::Rcout << e << std::endl;
      return 1;
      }
    return 0 ;
  }