]> Creatis software - creaVtk.git/blobdiff - bbtk_creaVtk_PKG/src/bbcreaVtkReadMHDPlane.cxx
#2811 creaVtk Feature New Normal - Concat Transform ImageAccumulate TransformVector
[creaVtk.git] / bbtk_creaVtk_PKG / src / bbcreaVtkReadMHDPlane.cxx
index 60b4aa1fdd4186783f6c52b46b9848df5383f59b..11276096f7fadf9b99ecd1cab3ac366e67c3c672 100644 (file)
@@ -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");
   
 }
 //=====