diff --git a/stim/envi/bil.h b/stim/envi/bil.h index 3a4c81a..b45dd30 100644 --- a/stim/envi/bil.h +++ b/stim/envi/bil.h @@ -231,15 +231,18 @@ public: } //given a Y, return ZX slice (transposed such that the spectrum is the leading dimension) - int read_plane_zx(T* p, size_t y){ - T* temp = (T*) malloc(X() * Z() * sizeof(T)); //allocate space to store the temporary xz plane - binary::read_plane_2(temp, y); //load the plane from disk + bool read_plane_zx(T* p, size_t y){ + T* temp = (T*) malloc(X() * Z() * sizeof(T)); //allocate space to store the temporary xz plane + if(!binary::read_plane_2(temp, y)) //load the plane from disk + return false; + size_t z, x; for(z = 0; z < Z(); z++){ for(x = 0; x <= z; x++){ p[x * Z() + z] = temp[z * X() + x]; //copy to the destination frame } } + return true; } //load a frame y into a pre-allocated double-precision array -- libgit2 0.21.4