Skip to content

Commit

Permalink
fix numpy compatibility issue
Browse files Browse the repository at this point in the history
  • Loading branch information
Vandermode committed Apr 27, 2021
1 parent 46e32e0 commit 335ea88
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions utility/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,15 @@ def Data2Volume(data, ksizes, strides):
TotalPatNum = 1
for i in range(len(ksizes)):
TotalPatNum = TotalPatNum * PatNum(dshape[i], ksizes[i], strides[i])

V = np.zeros([int(TotalPatNum)]+ksizes); # create D+1 dimension volume

args = [range(kz) for kz in ksizes]
for s in product(*args):
for s in product(*args):
s1 = (slice(None),) + s
s2 = tuple([slice(key, -ksizes[i]+key+1 or None, strides[i]) for i, key in enumerate(s)])
V[s1] = np.reshape(data[s2],-1,1)
s2 = tuple([slice(key, -ksizes[i]+key+1 or None, strides[i]) for i, key in enumerate(s)])
V[s1] = np.reshape(data[s2], (-1,))

return V

def crop_center(img,cropx,cropy):
Expand Down

0 comments on commit 335ea88

Please sign in to comment.