ANTsX / ANTsPy

A fast medical imaging analysis library in Python with algorithms for registration, segmentation, and more.
https://antspyx.readthedocs.io
Apache License 2.0
629 stars 161 forks source link

Test viz png #551

Closed cookpa closed 7 months ago

cookpa commented 7 months ago

See if installing libpng beforehand helps

cookpa commented 7 months ago

Foiled again. Somehow it is building with some older libpng

libpng warning: Application built with libpng-1.4.12 but running with 1.6.42
E.
======================================================================
ERROR: test_example (__main__.TestModule_create_tiled_mosaic)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/runner/work/ANTsPy/ANTsPy/tests/test_viz.py", line 51, in test_example
    p = ants.create_tiled_mosaic(img, output=outfile)
  File "/Users/runner/hostedtoolcache/Python/3.9.18/x64/lib/python3.9/site-packages/ants/viz/create_tiled_mosaic.py", line 133, in create_tiled_mosaic
    libfn(processed_args)
RuntimeError: /Users/runner/work/ANTsPy/ANTsPy/itksource/Modules/IO/PNG/src/itkPNGImageIO.cxx:550:
ITK ERROR: PNGImageIO(0x7fc4ef40bdf0): Unable to write PNG file! png_create_write_struct failed.
ncullen93 commented 7 months ago

I think it's only the create_tiled_mosaic function which is failing, right, and that's using ITK. We should really only focus on matplotlib to allow full user flexibility, so I think best is to remove that failing test but keep the plot test. The plot.py code is 3000 lines so that's what I care most about re: coverage.

cookpa commented 7 months ago

Sounds good. It actually works on my Mac, though I get a warning:

unclosed file <_io.BufferedReader name='/var/folders/zd/9qflmdq95ks8q89wwk9461l80000gn/T/tmpfhsq59qd.png'>

/opt/miniconda3/envs/antspydevel/lib/python3.9/unittest/case.py:550: ResourceWarning:

unclosed file <_io.BufferedReader name='/var/folders/zd/9qflmdq95ks8q89wwk9461l80000gn/T/tmpfhsq59qd.png'>

Something odd going on as the file looks correct.