Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add option to skip Element Value processing of PixelData, while preserving roundtrip read/write #256

Merged
merged 4 commits into from
Feb 20, 2023

Conversation

suyashkumar
Copy link
Owner

@suyashkumar suyashkumar commented Feb 20, 2023

This addresses some of the discussion in #224. The SkipProcessingPixelDataValue option causes the PixelData bytes to be read into the element, but not processed any further. This option provides an option to save the CPU cycles processing NativePixel data but still gives a roundtrip-able Dataset.

If you want to save both CPU and Memory, you can instead use the SkipPixelData option, which doesn't load the PixelData bytes into memory at all.

In the future, we should consider an option to lazy load/process all Element values if possible.

@suyashkumar
Copy link
Owner Author

Right now, this introduces the option API in a way that it can be easily expanded to other tags in the future

func TrySkipProcessingElementValue(tags ...*tag.Tag) ParseOption

However, since it's only implemented for PixelData for now, I may make it specific to PixelData. The long term way to expand this to other tags is to probably implement a lazy loading option for all tags where possible. E.g. until you Get() the value we hold onto the bytes.

Anyway, I'd still like to get this in for those who will find it useful, so will introduce an option specific to PixelData for now.

@suyashkumar suyashkumar marked this pull request as ready for review February 20, 2023 21:37
@suyashkumar suyashkumar changed the title Add option to skip Value processing of PixelData, while preserving roundtrip read/write Add option to skip Element Value processing of PixelData, while preserving roundtrip read/write Feb 20, 2023
@suyashkumar suyashkumar merged commit 8bad20f into main Feb 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant