Skip to content

How do I make a tissue mask (with photoshop?) #73

@NicolaasVanRenne

Description

@NicolaasVanRenne

I want to run a new analysis, this time with a mask. I can create a mask .png file with photoshop (a black and white image, in grayscale).

When I run the code:
mydir/XFuse/bin/xfuse convert image --image /mydir/XFuse/sections/23O2788/23O2788cirroseHE.jpg --scale 1.0 --mask --mask-file /mydir/XFuse/sections/23O2788/23O2788_mask_grayscale.png --save-path /mydir/XFuse/sections/23O2788_scale1

I get the following error:

[2023-08-07 16:06:31,485] ℹ : Running xfuse version 0.2.1
[2023-08-07 16:06:34,931] ℹ : Computing tissue mask:
[2023-08-07 16:06:34,932] ⚠ WARNING : UserWarning (/mydir/XFuse/xfuse/utility/mask.py:74): Failed to mask tissue
OpenCV(4.8.0) /io/opencv/modules/imgproc/src/grabcut.cpp:343: error: (-5:Bad argument) mask element value must be equal GC_BGD or GC_FGD or GC_PR_BGD or GC_PR_FGD in function 'checkMask'
[2023-08-07 16:06:35,006] ⚠ WARNING : UserWarning (/mydir/XFuse/xfuse/convert/utility.py:207): The image resolution is very large! 😱 XFuse typically works best on medium resolution images (approximately 1000x1000 px). If you experience performance issues, please consider reducing the resolution.
[2023-08-07 16:06:38,991] ℹ : Writing data to data.h5

So the .h5 file is made; but the assignments GC_BGD or GC_FGD or GC_PR_BGD or GC_PR_FGD need to be made - I understand I need to tell him GC_BGD is background (black) and GC_FGD is foreground (white). But how do I do this?

This is my mask made in photoshop:
23O2788_mask_grayscale

If I run python visualize_tissue_masks.py /mydir/XFuse/sections/23O2788_scale1/data.h5 to visualize the mask, I don't get a mask, but I do get the big border (which I did not ask for).

image

So, (i) How can I make a mask
and (ii) How can I get rid of the border?

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