52 lines
1.5 KiB
Python
Executable file
52 lines
1.5 KiB
Python
Executable file
from rt_utils import RTStructBuilder
|
|
import matplotlib.pyplot as plt
|
|
|
|
# Load existing RT Struct. Requires the series path and existing RT Struct path
|
|
|
|
|
|
dicom_series_path = "/nn/6768700/20230106/CT/9/"
|
|
rt_struct_list = [
|
|
"/nn/6768700/20230106/CT/9-rtss.dcm",
|
|
"/nn/6768700/20230106/CT/DCM_1.2.840.114358.189250942524258.20230106112102.643186932766_230109075302/rtss~3~a2381ecc-4b94-40cc-a7aa-41968c54e206.dcm",
|
|
]
|
|
|
|
rtstruct = RTStructBuilder.create_new(dicom_series_path=dicom_series_path)
|
|
|
|
for rt_struct_path in rt_struct_list:
|
|
r = RTStructBuilder.create_from(
|
|
dicom_series_path=dicom_series_path,
|
|
rt_struct_path=rt_struct_path,
|
|
)
|
|
for name in r.get_roi_names():
|
|
mask_3d = r.get_roi_mask_by_name(name)
|
|
rtstruct.add_roi(
|
|
mask=mask_3d,
|
|
name=name,
|
|
)
|
|
print(name)
|
|
|
|
rtstruct.save('/nn/6768700/20230106/CT/new-rt-struct.dcm')
|
|
exit()
|
|
|
|
#Large
|
|
rtstruct1 = RTStructBuilder.create_from(
|
|
dicom_series_path="/nn/6768700/20230106/CT/9/",
|
|
rt_struct_path="/nn/6768700/20230106/CT/9-rtss.dcm"
|
|
)
|
|
|
|
#Small
|
|
rtstruct2 = RTStructBuilder.create_from(
|
|
dicom_series_path="/nn/6768700/20230106/CT/9/",
|
|
rt_struct_path="/nn/6768700/20230106/CT/DCM_1.2.840.114358.189250942524258.20230106112102.643186932766_230109075302/rtss~3~a2381ecc-4b94-40cc-a7aa-41968c54e206.dcm"
|
|
)
|
|
|
|
# print(dir(rtstruct2))
|
|
|
|
for name in rtstruct2.get_roi_names():
|
|
mask_3d = rtstruct2.get_roi_mask_by_name(name)
|
|
rtstruct1.add_roi(
|
|
mask=mask_3d,
|
|
name=name,
|
|
)
|
|
print(name)
|
|
|