]> Creatis software - creaVtk.git/commitdiff
#2919 crea Vtk Bug New Normal - Read MHDPlane not compiling in windows for big...
authorEduardo DAVILA <eduardo.davila@creatis.insa-lyon.fr>
Wed, 27 Apr 2016 08:11:24 +0000 (10:11 +0200)
committerEduardo DAVILA <eduardo.davila@creatis.insa-lyon.fr>
Wed, 27 Apr 2016 08:11:24 +0000 (10:11 +0200)
bbtk_creaVtk_PKG/src/bbcreaVtkReadMHDPlane.cxx

index 3209a952b3d42d8978f49d7bdbd0b7ee80a6e14e..b842e8dca42f643bc2cdfdd9d4deae1fc212e86d 100644 (file)
@@ -257,15 +257,11 @@ void ReadMHDPlane::Read64lseek()
                        newImage->AllocateScalars();
                        newImage->Update();
                        pos = dimX*dimY*(long long)bbGetInputSlice()*dataSize;
-
-
-
 #if defined(_WIN32)
                        if (_lseeki64( fd, pos, SEEK_SET ) < 0)
 #else
                        if (lseek64(fd, pos, SEEK_SET) < 0) 
 #endif // defined(_WIN32)
-
                        {
                                printf("EED ReadMHDPlane::Read64lseek \n");
                                fprintf(stderr, "Failed seeking to %lld, %s\n", pos, strerror(errno));
@@ -279,7 +275,6 @@ void ReadMHDPlane::Read64lseek()
                        }
                }  // if PLANE XY
 
-               /*
                if (bbGetInputDirectionPlane()=="XZ") 
                { 
                        long long int j;
@@ -292,11 +287,14 @@ void ReadMHDPlane::Read64lseek()
                        newImage->Update();
                        long long sizeBytesPlane = dimX*dimY*dataSize;
                        pos = dimX*(long long int)bbGetInputSlice()*dataSize;
-                       void *pImage = newImage->GetScalarPointer();
+                       char *pImage = (char*)(newImage->GetScalarPointer());
                        for (j=0;j<dimZ;j++)
                        {
-printf("EED EED ReadMHDPlane::Read64lseek XZ j=%d \n", j);
+#if defined(_WIN32)
+                               if (_lseeki64( fd, pos + j*sizeBytesPlane , SEEK_SET ) < 0)
+#else
                                if (lseek64(fd, pos + j*sizeBytesPlane , SEEK_SET) < 0) 
+#endif // defined(_WIN32)
                                {
                                        printf("EED ReadMHDPlane::Read64lseek \n");
                                        fprintf(stderr, "Failed seeking to %lld, %s\n", pos, strerror(errno));
@@ -308,7 +306,7 @@ printf("EED EED ReadMHDPlane::Read64lseek XZ j=%d \n", j);
                                        fprintf(stderr, "Failed reading: %s\n", strerror(errno));
                                        exit(1);
                                }
-                               pImage=pImage+dimX*dataSize;
+                               pImage = pImage+dimX*dataSize;
                        } // for j
                }  // if PLANE XZ
 
@@ -325,22 +323,24 @@ printf("EED EED ReadMHDPlane::Read64lseek XZ j=%d \n", j);
                        newImage->AllocateScalars();
                        newImage->Update();
                        long long sizeBytesPlane = dimX*dimY*dataSize;
-//                     pos = dimX*(long long int)bbGetInputSlice()*dataSize;
-                       void *pImage;
+                       char *pImage;
                        for (j=0;j<dimZ;j++)
                        {
-printf("EED EED ReadMHDPlane::Read64lseek YZ i=%d j=%d \n", i,j);
                                for (i=0;i<dimY;i++)
                                {
                                        pos = ((long long int)bbGetInputSlice() + i*dimX + j*dimX*dimY)*dataSize ;
-                                       if (lseek64(fd, pos  , SEEK_SET) < 0) 
+#if defined(_WIN32)
+                                       if (_lseeki64( fd, pos , SEEK_SET ) < 0)
+#else
+                                       if (lseek64(fd, pos , SEEK_SET) < 0) 
+#endif // defined(_WIN32)
                                        {
                                                printf("EED ReadMHDPlane::Read64lseek \n");
                                                fprintf(stderr, "Failed seeking to %lld, %s\n", pos, strerror(errno));
                                                exit(1);
                                        }
 
-                                       pImage=newImage->GetScalarPointer(i, j,0 );
+                                       pImage=(char*)(newImage->GetScalarPointer(i, j,0 ));
                                        if ((ret = read(fd, pImage , dataSize)) < 0) 
                                        {
                                                fprintf(stderr, "Failed reading: %s\n", strerror(errno));
@@ -349,7 +349,7 @@ printf("EED EED ReadMHDPlane::Read64lseek YZ i=%d j=%d \n", i,j);
                                }
                        } // for j
                }  // if PLANE YZ
-               */
+
        
 #if defined(_WIN32)
                _close (fd);