MCPcopy Create free account
hub / github.com/ImprintLab/Medical-SAM2 / view

Function view

func_2d/utils.py:290–300  ·  view source on GitHub ↗
(tensor)

Source from the content-addressed store, hash-verified

288
289
290def view(tensor):
291 image = tensor_to_img_array(tensor)
292 assert len(image.shape) in [
293 3,
294 4,
295 ], "Image should have 3 or 4 dimensions, invalid image shape {}".format(image.shape)
296 # Change dtype for PIL.Image
297 image = (image * 255).astype(np.uint8)
298 if len(image.shape) == 4:
299 image = np.concatenate(image, axis=1)
300 Image.fromarray(image).show()
301
302
303

Callers

nothing calls this directly

Calls 1

tensor_to_img_arrayFunction · 0.85

Tested by

no test coverage detected