-
-
Save asim-shrestha/21364af5c110f5469a8123956fe250e4 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from rt_utils import RTStructBuilder | |
import matplotlib.pyplot as plt | |
# Load existing RT Struct. Requires the series path and existing RT Struct path | |
rtstruct = RTStructBuilder.create_from( | |
dicom_series_path="./testlocation", | |
rt_struct_path="./testlocation/rt-struct.dcm" | |
) | |
# View all of the ROI names from within the image | |
print(rtstruct.get_roi_names()) | |
# Loading the 3D Mask from within the RT Struct | |
mask_3d = rtstruct.get_roi_mask_by_name("ROI NAME") | |
# Display one slice of the region | |
first_mask_slice = mask_3d[:, :, 0] | |
plt.imshow(first_mask_slice) | |
plt.show() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment