Issue ion loading inputs in helper.py ¶
By: shauryamadukuri on March 26, 2024, 5:57 p.m.
def stack_inference(stack, callback): de_stacked_images = []
# Unpack the stack
with tempfile.TemporaryDirectory() as temp_dir:
with Image.open(stack) as tiff_image:
# Iterate through all pages
for page_num in range(tiff_image.n_frames):
# Select the current page
tiff_image.seek(page_num)
# Define the output file path
output_path = Path(temp_dir) / f"image_{page_num + 1}.jpg"
tiff_image.save(output_path, "JPEG")
de_stacked_images.append(output_path)
print(f"De-Stacked {output_path}")
# Loop over the images, and generate the actual tasks
for index, image in enumerate(de_stacked_images):
# Call back that saves the result
yield image, callback
there is a error at with Image.open(stack) as tiff_image: saying image is very large,
Tried modifying this function but could able to load properly.
please someone guide me.
Thank you very much