Skip to content

Scikit-Image imsave outputs black images #2

Description

@daancs

Hi!

I am using the same setup as in Issue #1.

In the SegmentationPart1 class, in the run_single() function the following lines output completely black images regardless of values in w1_mask and w2_mask.

w1_mask = np.uint16(w1_mask)
w2_mask = np.uint16(w2_mask)
sio.imsave(self.save_path / set_mask_save_name(well_id, fov, 0), w1_mask, check_contrast=False)
sio.imsave(self.save_path / set_mask_save_name(well_id, fov, 1), w2_mask, check_contrast=False)

This could be due to scikit-images imsave function cannot save unsigned 16-bit integer arrays into files (probably deprecated?), see stackoverflow here.

I changed the w1_mask and w2_mask to be 8-bit unsigned integers instead and that solved the problem albeit the images are lower resolution.

Python version: Python 3.13.1

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions