-
Notifications
You must be signed in to change notification settings - Fork 14
Open
Description
Hi, This is a fantastic utility.
Maybe i've missed an option someplace, but I don't think you're accounting for the possibility of metadata being present. In this case, the times and frame numbers will be present after the data and so become convoluted with the pixel values in your implementation. Easy enough fix, you just need to do a check for the values and dtypes in your MetaBlock and then read them in during _read_data. Alternatively compare the difference between the frame size and stride size to find the number of additional bytes to be read for each frame.
For example, the following would work for 3 pieces of metadata.
def _read_data(self, file):
file.seek(4100)
data = [[0 for _ in range(self.nroi)] for _ in range(self.nframes)]
metadata = []
for frame in range(0, self.nframes):
for region in range(0, self.nroi):
if self.nroi > 1:
data_xdim = len(self.xcoord[region])
data_ydim = len(self.ycoord[region])
else:
data_xdim = np.asarray(self.xdim[region], np.uint32)
data_ydim = np.asarray(self.ydim[region], np.uint32)
data[frame][region] = np.fromfile(file, self.dtype, data_xdim * data_ydim).reshape(data_ydim, data_xdim)
metadata.append(np.fromfile(file, np.dtype('Int64'),3))
return data, metadata
Cheers,
Cam
Metadata
Metadata
Assignees
Labels
No labels