Skip to content

[Bug]: Grain image "image with overlaid mask" ignores zscale due to image being of binary type #1206

@SylviaWhittle

Description

@SylviaWhittle

Checklist

  • Find the offending file in the output. If processing halts, re-run analysis with topostats --core 1 process.
  • Describe the bug.
  • Include the configuration file.
  • Copy of the log-file from running with topostats --log-level debug <command>.
  • The exact command that failed. This is what you typed at the command line, including any options.
  • TopoStats version, this is reported by topostats --version
  • Operating System and Python Version

Describe the bug

The output image, "image with overlaid mask" does not use the z-scale provided in the config file.

Eg:

I set the config file to have a z-scale of [-4, 3] and processed an image:

Image Image

The flattened image shows fine, but the mask overlay clearly is using a different scale, the standard minimum maximum scale that matplotlib uses when not provided a vmin or vmax

The fix

I thought that the issue might be found in how the "mask overlay" image is defined in plotting_dictionary.yaml. I tried setting the image type from binary to non-binary and this worked.

I propose that we change "mask-overlay" image to non-binary

Image Image

Copy of the log-file from running with topostats --log-level debug <command>

NA

Include the configuration file

Any config file where the z-scale is set, eg [-4, 3]

To Reproduce

Run topostats on a sample using a config file with the z-scale set, notice that the mask overlay is of the wrong height scale.

TopoStats Version

Git main branch

Python Version

3.11

Operating System

MacOS M1/M2 (post-2021)

Python Packages

absl-py==2.3.1
AFMReader @ git+https://github.com/AFM-SPM/AFMReader@2f7d3cbcbe6092885dd2641d8024fc0084a083ba
art==6.5
asttokens==3.0.0
astunparse==1.6.3
biopython==1.85
certifi==2025.8.3
charset-normalizer==3.4.3
cheap_repr==0.5.2
contourpy==1.3.3
cycler==0.12.1
decorator==5.2.1
docstring_parser==0.17.0
et_xmlfile==2.0.0
executing==2.2.1
flatbuffers==25.2.10
fonttools==4.59.2
gast==0.6.0
google-pasta==0.2.0
grpcio==1.74.0
h5py==3.14.0
idna==3.10
igor2==0.5.12
imageio==2.37.0
ipython==8.37.0
jedi==0.19.2
joblib==1.5.2
keras==3.11.3
kiwisolver==1.4.9
lazy_loader==0.4
libclang==18.1.1
llvmlite==0.44.0
loguru==0.7.3
magicgui==0.10.1
Markdown==3.8.2
markdown-it-py==4.0.0
MarkupSafe==3.0.2
matplotlib==3.10.6
matplotlib-inline==0.1.7
mdurl==0.1.2
ml_dtypes==0.5.3
namex==0.1.0
networkx==3.5
numba==0.61.2
numpy==2.0.2
numpyencoder==0.3.2
openpyxl==3.1.5
opt_einsum==3.4.0
optree==0.17.0
packaging==25.0
pandas==2.3.2
parso==0.8.5
pexpect==4.9.0
pillow==11.1.0
prompt_toolkit==3.0.52
protobuf==6.32.0
psutil==5.9.8
psygnal==0.14.1
ptyprocess==0.7.0
pure_eval==0.2.3
pyconify==0.2.1
Pygments==2.19.2
pyparsing==3.2.3
pyspm==0.6.3
python-dateutil==2.9.0.post0
pytz==2025.2
PyYAML==6.0.2
QtPy==2.4.3
requests==2.32.5
rich==14.1.0
ruamel.yaml==0.18.15
ruamel.yaml.clib==0.2.12
schema==0.7.7
scikit-image==0.25.2
scikit-learn==1.7.1
scipy==1.16.1
seaborn==0.13.2
six==1.17.0
skan==0.13.0
snoop==0.6.0
stack-data==0.6.3
superqt==0.7.6
tensorboard==2.20.0
tensorboard-data-server==0.7.2
tensorflow==2.20.0
termcolor==3.1.0
threadpoolctl==3.6.0
tifffile==2025.8.28
toolz==1.0.0
topoly==1.1.0
-e git+ssh://[email protected]/AFM-SPM/TopoStats.git@8cf10700ab78832072ddd78b4078f4acb76f24ea#egg=topostats
tqdm==4.67.1
traitlets==5.14.3
typing_extensions==4.15.0
tzdata==2025.2
urllib3==2.5.0
wcwidth==0.2.13
Werkzeug==3.1.3
wrapt==1.17.3

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions