Functions

mitkTeemDiffusionTensor3DReconstructionImageFilter.cpp File Reference

#include <cstdlib>
#include <ctime>
#include <iostream>
#include <fstream>
#include <itksys/SystemTools.hxx>
#include "mitkPixelType.h"
#include "itkImageRegionIterator.h"
#include "itkImageFileReader.h"
#include "mitkNrrdDiffusionImageWriter.h"

Go to the source code of this file.

Functions

void file_replace (std::string filename, std::string what, std::string with)

Function Documentation

void file_replace ( std::string  filename,
std::string  what,
std::string  with 
)

Definition at line 47 of file mitkTeemDiffusionTensor3DReconstructionImageFilter.cpp.

Referenced by mitk::TeemDiffusionTensor3DReconstructionImageFilter< DiffusionImagePixelType, TTensorPixelType >::Update().

{
  ofstream myfile2;
  char filename2[512];
  sprintf(filename2, "%s2",filename.c_str());
  myfile2.open (filename2);

  std::string line;
  ifstream myfile (filename.c_str());
  if (myfile.is_open())
  {
    while (! myfile.eof() )
    {
      getline (myfile,line);
      itksys::SystemTools::ReplaceString(line,what.c_str(),with.c_str());
      myfile2 << line << std::endl;
    }
    myfile.close();
  }
  myfile2.close();
  itksys::SystemTools::RemoveFile(filename.c_str());
  rename(filename2,filename.c_str());

}
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines