Open hvgazula opened 8 months ago
uint16
will do for the label vols
edit: please see the table at the bottom of this page
couldn't this be written as {*d.keys() for d in pixel_counts}
?
update: iterable unpacking cannot be used in comprehension
Not sure if I agree with this. What if the middle value is the largest? You will end up with a square and that's unnecessary. Am I missing something?
does this have to be done within the context manager?
Also, pixel_counts
is a dict
. Could you not simply write sum(pixel_counts)
, although i am not sure yet why the keys are added and not the values?
Using list(map(...))
slows down the computation, but removing list
results in error thrown in line 411: 'map' object is not subscriptable.
Not sure if I agree with this. What if the middle value is the largest? You will end up with a square and that's unnecessary. Am I missing something?
slice[i,:,:] → shape is dim[1] x dim[2] slice[:,i,:] → shape is dim[0] x dim[2] slice[:,:,i] → shape is dim[0] x dim[1] Therefore, in order for all slices to be the same shape, slice shape should be (max(dim[0], dim[1]), max(dim[1], dim[2]))
cool..please create a separate function with this docstring so people like me will know why 😄
https://github.com/sabeenlohawala/tissue_labeling/blob/8611ada4596771e1ab25cb02faf7be557509593b/scripts/mit_kwyk_data.py#L150
dict(zip(unique,count))
https://github.com/sabeenlohawala/tissue_labeling/blob/8611ada4596771e1ab25cb02faf7be557509593b/scripts/mit_kwyk_data.py#L180C1-L181C85
shapes, pixel_counts = zip(*shapes_and_pixel_counts)
https://github.com/sabeenlohawala/tissue_labeling/blob/8611ada4596771e1ab25cb02faf7be557509593b/scripts/mit_kwyk_data.py#L249-L292
Run this example and tell me if the above cannot be improved in the same way