access meta dictionary using simpleitk

how can I change the following code to read image in Simpleitk set meta data and save as simpleitk

dicom = dcmread(dcm_path) #load it from simplitk and read it in simplitk instead dcmread
for key,value in meta_dict.items():
dicom[key].value = value
dicom.save_as(dcm_path)

You could combine tag modification example in C++ with Python syntax from tag print example. This uses Python ITK, not SimpleITK.

i used:
dicom=sitk.ReadImage(dcm_path)
#dicom = dcmread(dcm_path) #load it from simplitk and read it in simplitk instead dcmread
for a in dicom.GetMetaDataKeys():
b = dicom.GetMetaData(a)
print(f"({a}) = = “{b}”")

it is just printinh “AAAAAA…” and

Hello @sehreen,

Your syntax is not that of SimpleITK. Possibly this example does what you need.

Highly recommend going through the read-the-docs examples and possibly the toolkit’s Jupyter notebooks to get up to speed on syntax and available functionality.