comparison Resources/ClearMetadataCache.py @ 44:9afd691bfb74

added tags: RescaleIntercept, RescaleSlope, and NumberOfFrames
author Sebastien Jodogne <s.jodogne@gmail.com>
date Fri, 03 May 2024 13:02:51 +0200
parents
children
comparison
equal deleted inserted replaced
43:f3dc8ecf4349 44:9afd691bfb74
1 #!/usr/bin/env python3
2
3 import argparse
4 import requests
5
6 parser = argparse.ArgumentParser(description = 'Clear the cache of the OHIF plugin (for "dicom-json" data source).')
7 parser.add_argument('--url',
8 default = 'http://localhost:8042',
9 help = 'URL to the REST API of the Orthanc server')
10 parser.add_argument('--username',
11 default = 'orthanc',
12 help = 'Username to the REST API')
13 parser.add_argument('--password',
14 default = 'orthanc',
15 help = 'Password to the REST API')
16
17 args = parser.parse_args()
18
19 auth = requests.auth.HTTPBasicAuth(args.username, args.password)
20
21 METADATA = '4202'
22
23 for instance in requests.get('%s/instances' % args.url, auth=auth).json():
24 if METADATA in requests.get('%s/instances/%s/metadata' % (args.url, instance), auth=auth).json():
25 requests.delete('%s/instances/%s/metadata/%s' % (args.url, instance, METADATA), auth=auth)