PNG Metadata
Would it be possible to add something to the scene API that allows metadata to be written to PNGs? Additionally, would it be possible for a flag that causes a map from value to colourmap colour to be written to the metadata?
The idea of this is twofold, it would allow for PNG files to be more accurately post-processed, with the colour map being handy for training ML/dataset curation. The second thing would be to improve reproducibility, for example in PyFR we would like to write parts of the config/inifile and stats to the png.
A similar feature is now supported in Paraview: https://www.kitware.com/paraview-state-embedded-in-png-screenshots/
This is a great idea! I had previously looked into adding more info to PNGs, but it was not as straightforward as I had hoped, so I tabled it.
I will look into this again!
Looking into this, in the meantime, one thing Ascent does have in an info() call in the API that populates a conduit node with metadata rather than the PNG, and can be used in a similar way: https://ascent.readthedocs.io/en/latest/AscentAPI.html?highlight=info#info
I added the ability to add meta data to PNGs with the following PR.
https://github.com/Alpine-DAV/ascent/pull/746
If you add specific conduit nodes under the state, it will add those strings to the PNG meta data. Specifically:
state/software state/source state/title state/info state/comment
Thanks @brugger1
edit: Definitely needs to be documented.
Yes, the PR didn't have any documentation associated with it. :(
This is great, thanks @brugger1. I'll give it a go!
@WillTrojak if you are creating images for ML datasets, you might be interested in scalar rendering -- which you can use to save an image out to a HDF5 file and preserve the floating point data.
https://ascent.readthedocs.io/en/latest/Actions/Examples.html?highlight=scalar#an-example-of-scalar-rendering
I have been looking into this for a partitioned mesh, and it seems that the current metadata implementation in #746 doesn't work on meshes with multiple domains. ie it works on
state:
stuff: ...
coordinates:
x: ...
but it doesn't work on:
domain_0:
state:
domain_id: 0
stuff: ...
coordinates:
x: ...
domain_1:
state:
domain_id: 1
stuff: ...
coordinates:
x: ...
I'd be happy to implement this, but I need a bit of direction from the ascent team. The most straightforward choice to me is to only output the metadata from the first domain child which is sort of the root rank (ie. m_source.child(0)) and this could be done in the PopulateMetadata function. What are your thoughts?