Skip to content

Commit d7fe2fb

Browse files
committed
minor
1 parent 0a4438e commit d7fe2fb

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

src/RawFile.jl

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,22 @@ function getindex(f::Rawfile,x::UnitRange,y)
101101
matrix
102102
end
103103

104+
function getindex(f::Rawfile,x::UnitRange, y, z)
105+
fd = open(f.filename*f.extRaw,"r")
106+
107+
data = zeros(f.dtype, (length(x),length(y),length(z)))
108+
for r=1:length(z)
109+
for l=1:length(y)
110+
seek(fd, (((z[r]-1)*f.size[2] + (y[l]-1))*f.size[1] + x[1] - 1 )*sizeof(f.dtype))
111+
data[:,l,r] = read(fd, f.dtype, length(x))
112+
end
113+
end
114+
115+
close(fd)
116+
data
117+
end
118+
119+
104120

105121
function setindex!(f::Rawfile, A,::Colon,::Colon)
106122
f[] = A

0 commit comments

Comments
 (0)