Hi @ral_san,
This is relatively straightforward (famous last words). First, be aware that it cannot be as easy as save_data because you have created a new series in this “study”, so you don’t want the new images to have exactly the same meta-data information as the original image.
You can modify the example as follows:
Copy all the meta-data dictionary tags that are shared by the series from the series_reader (likely all the tags are shared so just iterate over the keys and get the values) into a local dictionary series_tag_values.
In your local dictionary set the value for the tags you need to modify, e.g. series_tag_values["0008|0031"]=modification_time
Iterate over the slices and set the tag-value as done in the example.
There are many DICOM tags that are related to spatial information, e.g. spacing. After resampling, for example, they will be invalid if they are copied as-is.
I understand that meta-data needs to be updated in this case, where resampling if performed.
However, what I want to avoid is iterating over all of the keys. Basically, I was wondering if there is only one line of code that copies all the meta-data tags in one go. So then I only have to modify the tags related to resampling such as spacing, etc.
Generally copying a meta-data dictionary as is, is dangerous as you will have two images with the same study-series-image ids. This is never a good idea. If all files sit in the same directory no DICOM reader will be able to separate the two.