Feature/add part indices to write pyapi #2165
Open
+158
−22
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR adds the part_indices api to the write function of the OpenEXR Python wrapper, similar to #2149
However, different from the read API, we cannot create a new file every time a new part needs to be written on disk, which would result in the previously written data being overwritten. Thus, I added a persistent pointer to a MultiPartOutputFile, just like what we would do if using the C++ API. Another problem arises where the already written part would be cached in a map in the MultiPartOutputFile, leading to growing memory usage even though that part has already been written to the disk and that memory is not needed anymore, so I added another API for deleting this cache file in the MultiPartOutputFile object's map.
The current structure and API design might not be optimal, and I've only tested the regular case where a non-deep scanline multi-part image sequence is written to disk streamingly, where the generation of new part data and the operation of writing them to the disk is happening at the same time.