generatect commited on
Commit
01cf631
·
1 Parent(s): 9fd9561

Delete example_data/json_anonmyze.py

Browse files
Files changed (1) hide show
  1. example_data/json_anonmyze.py +0 -26
example_data/json_anonmyze.py DELETED
@@ -1,26 +0,0 @@
1
- import os
2
- import json
3
-
4
- def process_json_file(file_path):
5
- # Read the JSON file
6
- with open(file_path, 'r') as file:
7
- data = json.load(file)
8
-
9
- # Extract the desired keys
10
- desired_keys = ["PatientAge", "PatientSex", "Manufacturer", "RescaleIntercept", "RescaleSlope"]
11
- cleaned_data = {key: data[key] for key in desired_keys if key in data}
12
-
13
- # Write the cleaned JSON back to the file
14
- with open(file_path, 'w') as file:
15
- json.dump(cleaned_data, file, indent=4)
16
-
17
- def scan_folder(folder_path):
18
- for root, dirs, files in os.walk(folder_path):
19
- for file in files:
20
- if file.endswith('.json'):
21
- file_path = os.path.join(root, file)
22
- process_json_file(file_path)
23
-
24
- # Provide the folder path to start the scanning
25
- folder_path = 'ctvit-transformer'
26
- scan_folder(folder_path)