suyashkumar/dicom

Consider a Read - Modify some Elements - Write Pipeline API

suyashkumar opened this issue · 0 comments

It seems a couple folks are using this library in a Read - Modify Some Elements - Write back out type of pipeline. In this case, if not all elements are inspected or modified, we may be able to optimize writes of those elements that are not modified (without loading them into memory).

If this is a common enough use case where people will benefit from this kind of optimization, we can consider introducing a Mutation API where the user passes in some struct meeting the Mutator (we can reconsider the naming) interface that has a TagsToMutate and Mutate functions to dictate how to modify the tags that need to be modified.

type Mutator interface {
    TagsToMutate tag.Tags
    Mutate(elem *Element) (*Element, error)
}

We may wish to offer the option to also have a TagsToSkip version where elements are sent to Mutate except for those in TagsToSkip.