]> Creatis software - creaVtk.git/commitdiff
#3015 creaVtk Bug New Normal - In box ReadMHDPlane, Error:end application, when...
authorEduardo DAVILA <eduardo.davila@creatis.insa-lyon.fr>
Tue, 13 Sep 2016 14:12:22 +0000 (16:12 +0200)
committerEduardo DAVILA <eduardo.davila@creatis.insa-lyon.fr>
Tue, 13 Sep 2016 14:12:22 +0000 (16:12 +0200)
bbtk_creaVtk_PKG/src/bbcreaVtkReadMHDPlane.cxx

index 1eb4c845f1603b55e21c5b1761d5301c8d507be5..58486f2bbfa4cbcb6a0712d47dcb02209348bbc9 100644 (file)
@@ -225,6 +225,7 @@ void ReadMHDPlane::Read64lseek()
        char strTmp[30];
        char strTmp2[30];
        FILE *ffIn      = fopen(bbGetInputFileName().c_str(),"r");
+printf("EED ReadMHDPlane::Read64lseek filename %s %p\n", bbGetInputFileName().c_str(), ffIn );
        long long dataSize;
 
        if (ffIn!=NULL)
@@ -252,8 +253,14 @@ void ReadMHDPlane::Read64lseek()
                if (strncmp("ElementType = VTK_UNSIGNED_SHORT",mystring,32)==0) { newImage->SetScalarTypeToUnsignedShort();     dataSize=sizeof(unsigned short);}
                if (strncmp("ElementType = MET_SHORT",mystring,23)==0)                  { newImage->SetScalarTypeToShort();                     dataSize=sizeof(short);                 }
                if (strncmp("ElementType = VTK_SHORT",mystring,23)==0)                  { newImage->SetScalarTypeToShort();                     dataSize=sizeof(short);                 }
+               if (strncmp("ElementType = MET_UINT",mystring,24)==0)                   { newImage->SetScalarTypeToUnsignedInt();       dataSize=sizeof(unsigned int);  }
+               if (strncmp("ElementType = VTK_UNSIGNED_INT",mystring,32)==0)   { newImage->SetScalarTypeToUnsignedInt();       dataSize=sizeof(unsigned int);  }
+               if (strncmp("ElementType = MET_INT",mystring,24)==0)                    { newImage->SetScalarTypeToInt();                       dataSize=sizeof(int);                   }
+               if (strncmp("ElementType = VTK_INT",mystring,32)==0)                    { newImage->SetScalarTypeToInt();                       dataSize=sizeof(int);                   }
                if (strncmp("ElementType = MET_FLOAT",mystring,23)==0)                  { newImage->SetScalarTypeToFloat();                     dataSize=sizeof(float);                 }
                if (strncmp("ElementType = VTK_FLOAT",mystring,23)==0)                  { newImage->SetScalarTypeToFloat();                     dataSize=sizeof(float);                 }
+               if (strncmp("ElementType = MET_LONG",mystring,23)==0)                   { newImage->SetScalarTypeToLong();                      dataSize=sizeof(long);                  }
+               if (strncmp("ElementType = VTK_LONG",mystring,23)==0)                   { newImage->SetScalarTypeToLong();                      dataSize=sizeof(long);                  }
                if (strncmp("ElementType = MET_DOUBLE",mystring,24)==0)                 { newImage->SetScalarTypeToDouble();            dataSize=sizeof(double);                }
                if (strncmp("ElementType = VTK_DOUBLE",mystring,24)==0)                 { newImage->SetScalarTypeToDouble();            dataSize=sizeof(double);                }
 
@@ -281,15 +288,16 @@ void ReadMHDPlane::Read64lseek()
 #endif // defined(_WIN32)
 
 
-
                if (fd < 0)
                {
-                       printf("EED ReadMHDPlane::Read64lseek \n");
+                       printf("EED ReadMHDPlane::Read64lseek   WARNNING! raw file not exist\n");
                        fprintf(stderr, "%s\n", strerror(errno));
-                       exit(1);
-               }
+                       newImage=CreateDefaultImage();
+//                     exit(1);
+               }       
+               
 
-               if (bbGetInputDirectionPlane()=="XY"
+               if ((bbGetInputDirectionPlane()=="XY") && (fd>=0)
                { 
                        newImage->SetSpacing( spcX,spcY,spcZ );
                        newImage->SetDimensions(  dimX,dimY,width );
@@ -317,7 +325,7 @@ void ReadMHDPlane::Read64lseek()
                        }
                }  // if PLANE XY
 
-               if (bbGetInputDirectionPlane()=="XZ") 
+               if ((bbGetInputDirectionPlane()=="XZ") && (fd>=0))
                { 
                        newImage->SetSpacing( spcX,spcZ,spcY );
                        newImage->SetDimensions(  dimX,dimZ,width );
@@ -333,8 +341,7 @@ void ReadMHDPlane::Read64lseek()
                        }
                }  // if PLANE XZ
 
-
-               if (bbGetInputDirectionPlane()=="YZ") 
+               if ((bbGetInputDirectionPlane()=="YZ") && (fd>=0))
                { 
                        newImage->SetSpacing( spcY,spcZ,spcX );
                        newImage->SetDimensions(  dimY,dimZ,width );