+}
+bool isLineToIgnore(const std::string line){
+ if(std::string::npos == line.find_first_of("ITK_InputFilterName")){
+ return true;
+ }
+ return false;
+}
+bool mhdCmp(const std::string &file, const std::string &refFile){
+ bool sameFiles = true;
+ std::ifstream in(file.c_str());
+ std::ifstream ref(file.c_str());
+ std::string line;
+ std::string refLine;
+ while ( in.good() && ref.good()){
+ getline (in,line);
+ //does the line begins by an attribute to ignore
+ if(isLineToIgnore(line)){
+ continue;
+ }
+
+ getline(ref,refLine);
+ while(isLineToIgnore(refLine)){
+ getline(ref,refLine);
+ }
+ if(line!=refLine){
+ sameFiles = false;
+ break;
+ }
+ }
+ in.close();
+ ref.close();
+ //check files same length
+ return sameFiles;
+}
+
+#ifdef _WIN32
+void dosToUnixFile(std::string dosFile, std::string unixedFile){
+
+ std::ifstream ifile(dosFile.c_str(),std::ios::binary);
+ ifile.seekg(0,std::ios_base::end);
+ long s=ifile.tellg();
+ char *buffer=new char[s];
+ ifile.seekg(0);
+ ifile.read(buffer,s);
+ ifile.close();
+ std::string txt(buffer,s);
+ delete[] buffer;
+ size_t off=0;
+ while ((off=txt.find("\r\n",off))!=std::string::npos)
+ txt.replace(off,sizeof("\r\n")-1,"\n");
+ std::ofstream ofile(unixedFile.c_str());
+ ofile.write(txt.c_str(),txt.size());
+
+}
+#endif
+
+std::string mhdToRawName(const std::string &mhdName){
+ int found = mhdName.find_last_of(".");
+ return mhdName.substr(0, found)+".raw";