X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=bbtk_creaVtk_PKG%2Fsrc%2FbbcreaVtkReadMHDPlane.cxx;h=11276096f7fadf9b99ecd1cab3ac366e67c3c672;hb=b787bb241806a2f82b87725ddd4a57b6ddb874ff;hp=60b4aa1fdd4186783f6c52b46b9848df5383f59b;hpb=f2708632c6624a40a13f8678f4349e33e5a6d5a8;p=creaVtk.git diff --git a/bbtk_creaVtk_PKG/src/bbcreaVtkReadMHDPlane.cxx b/bbtk_creaVtk_PKG/src/bbcreaVtkReadMHDPlane.cxx index 60b4aa1..1127609 100644 --- a/bbtk_creaVtk_PKG/src/bbcreaVtkReadMHDPlane.cxx +++ b/bbtk_creaVtk_PKG/src/bbcreaVtkReadMHDPlane.cxx @@ -34,15 +34,48 @@ void ReadMHDPlane::Process() printf("EED ReadMHDPlane::Process Start\n"); + std::string inputfilename; + + if (bbGetInputDirectionPlane()=="XY") + { + inputfilename=bbGetInputFileName(); + } // if XY + + + if ((bbGetInputDirectionPlane()=="YZ") || (bbGetInputDirectionPlane()=="ZX")) + { + + //-- Split FileName + std::size_t found = bbGetInputFileName().find_last_of("/\\"); + std::string path = bbGetInputFileName().substr(0,found+1); + std::string filename = bbGetInputFileName().substr(found+1); +#ifdef _WIN32 + path=path+"YZ_ZX\\"; +#else + path=path+"YZ_ZX/"; +#endif + + + if (bbGetInputDirectionPlane()=="YZ") + { + inputfilename = path+filename+"_YZ.mhd"; + } // if YZ + + if (bbGetInputDirectionPlane()=="ZX") + { + inputfilename = path+filename+"_ZX.mhd"; + } // XZ + } // if YZ || XZ + vtkImageData *newImage; long int newHeaderSize; - std::string newFileName=bbGetInputFileName()+"-OneSlice"; + std::string newFileName=inputfilename+"-OneSlice"; int sx,sy,sz; char mystring[250]; char strTmp[20]; bool ok=true; - FILE *ffIn = fopen(bbGetInputFileName().c_str(),"r"); + FILE *ffIn = fopen(inputfilename.c_str(),"r"); if (ffIn!=NULL) { printf("EED ReadMHDPlane::Process 1\n"); @@ -91,7 +124,7 @@ printf("EED ReadMHDPlane::Process 4\n"); } // if ok } else { ok=false; - printf("EED ERROR: Problem openin:%s\n", bbGetInputFileName().c_str() ); + printf("EED ERROR: Problem openin:%s\n", inputfilename.c_str() ); } if (ok==false) @@ -133,6 +166,7 @@ void ReadMHDPlane::bbUserSetDefaultValues() // Here we initialize the input 'In' to 0 bbSetInputFileName(""); bbSetInputSlice(0); + bbSetInputDirectionPlane("XY"); } //=====