Browse Source

really got images now, code so shitty tho

feature/load_slices
jim 10 years ago
parent
commit
14d916bc96
2 changed files with 13 additions and 10 deletions
  1. +3
    -0
      nd2reader/__init__.py
  2. +10
    -10
      run.py

+ 3
- 0
nd2reader/__init__.py View File

@ -52,7 +52,10 @@ class Nd2(object):
res = [acqtime] res = [acqtime]
for i in range(self.metadata['ImageAttributes']["SLxImageAttributes"]["uiComp"]): for i in range(self.metadata['ImageAttributes']["SLxImageAttributes"]["uiComp"]):
a = array.array("H", d) a = array.array("H", d)
res.append(a[4+i::self.metadata['ImageAttributes']["SLxImageAttributes"]["uiComp"]]) res.append(a[4+i::self.metadata['ImageAttributes']["SLxImageAttributes"]["uiComp"]])
arr = np.reshape(res[1], (self.height, self.width))
# TODO: Are you missing a zoom level? Is there extra data here? Can you get timestamps now?
return res return res


+ 10
- 10
run.py View File

@ -3,14 +3,14 @@ from pprint import pprint
n = Nd2("/home/jim/Desktop/nd2hacking/BFonly.nd2") n = Nd2("/home/jim/Desktop/nd2hacking/BFonly.nd2")
print("Height: ", n.height)
print("Width: ", n.width)
for fov in n.fields_of_view:
print(fov.number, fov.x, fov.y, fov.z, fov.pfs_offset)
# print("Height: ", n.height)
# print("Width: ", n.width)
# for fov in n.fields_of_view:
# print(fov.number, fov.x, fov.y, fov.z, fov.pfs_offset)
#
# for channel in n.channels:
# print(channel.name)
# print(channel.camera)
# print(channel.exposure_time)
for channel in n.channels:
print(channel.name)
print(channel.camera)
print(channel.exposure_time)
print(n.get_image(3))
n.get_image(3)

Loading…
Cancel
Save