forked from ymirsky/CT-GAN
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path3B_remove_evidence.py
More file actions
42 lines (35 loc) · 2.14 KB
/
3B_remove_evidence.py
File metadata and controls
42 lines (35 loc) · 2.14 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
import os
import sys
os.environ["CLI_ARGS"] = " ".join(arg.lower() for arg in sys.argv[1:]) if len(sys.argv) > 1 else "b"
cli_args = os.environ.get("CLI_ARGS", "").split()
from procedures.attack_pipeline import *
if cli_args[0] == 'b':
flag ='b'
else:
flag ='l'
# Init pipeline
remover = scan_manipulator()
if flag=='l':
print("Lung")
# Load target scan (provide path to dcm or mhd file)
remover.load_target_scan(r'D:\CapstoneProject\DataSet\LungsCT-BigData\manifest-1600709154662\LIDC-SMALL\LIDC-IDRI-0002\01-01-2000-NA-NA-98329\3000522.000000-NA-04919')
# remover.load_target_scan(r'D:\CapstoneProject\DataSet\BraTS2021\TestData\BraTS2021_00000\BraTS2021_00000_t1ce_DICOM')
# Inject at two locations (this version does not implement auto candidate location selection)
vox_coord1 = np.array([53,213,400]) #z, y , x (x-y should be flipped if the coordinates were obtained from an image viewer such as RadiAnt)
vox_coord2 = np.array([33,313,200])
remover.tamper(vox_coord1, action='remove', isVox=True) #can supply realworld coord too
remover.tamper(vox_coord2, action='remove', isVox=True)
# Save scan
remover.save_tampered_scan('remove_evidence_lung',output_type='dicom') #output can be dicom or numpy
else:
print("Brain")
# Load target scan (provide path to dcm or mhd file)
# remover.load_target_scan(r'D:\CapstoneProject\DataSet\LungsCT-BigData\manifest-1600709154662\LIDC-SMALL\LIDC-IDRI-0002\01-01-2000-NA-NA-98329\3000522.000000-NA-04919')
remover.load_target_scan(r'D:\CapstoneProject\DataSet\BraTS2021\TestData\BraTS2021_00048\BraTS2021_00048_t1ce_DICOM')
# Inject at two locations (this version does not implement auto candidate location selection)
vox_coord1 = np.array([76,157,177]) #z, y , x (x-y should be flipped if the coordinates were obtained from an image viewer such as RadiAnt)
vox_coord2 = np.array([76,148,195])
remover.tamper(vox_coord1, action='remove', isVox=True) #can supply realworld coord too
remover.tamper(vox_coord2, action='remove', isVox=True)
# Save scan
remover.save_tampered_scan('remove_evidence_brain',output_type='dicom') #output can be dicom or numpy