ROIException Error
lionmsk11 opened this issue · 0 comments
Hi,
I am trying to create a new RT-Structs file with 3D mask for structure.
I am getting error: "ROIException: Mask must have the save number of layers (In the 3rd dimension) as input series. Expected 389, got 560"
My ndarray size is (389, 426, 560).
I am not sure how to go about this problem. This may be due to an error in creating a 3D mask. Do you have any instructions for creating 3D mask from xyz coordinates for rt-utils?
The full error output is:
ROIException Traceback (most recent call last)
Cell In[33], line 11
4 rtstruct = RTStructBuilder.create_new(dicom_series_path="p1_1_001/p1_1_relu_CTscans")
6 # Add the 3D mask as an ROI.
7 # The colour, description, and name will be auto generated
8 #rtstruct.add_roi(mask=roi_mask)
9
10 # Add another ROI, this time setting the color, description, and name
---> 11 rtstruct.add_roi(
12 mask=roi_mask,
13 color=[255, 0, 255],
14 name="Maxillary"
15 )
17 rtstruct.save('p1_1_001/maxillary_rtstruct')
File c:\Python310\lib\site-packages\rt_utils\rtstruct.py:47, in RTStruct.add_roi(self, mask, color, name, description, use_pin_hole, approximate_contours, roi_generation_algorithm)
39 """
40 Add a ROI to the rtstruct given a 3D binary mask for the ROI's at each slice
41 Optionally input a color or name for the ROI
42 If use_pin_hole is set to true, will cut a pinhole through ROI's with holes in them so that they are represented with one contour
43 If approximate_contours is set to False, no approximation will be done when generating contour data, leading to much larger amount of contour data
44 """
46 # TODO test if name already exists
---> 47 self.validate_mask(mask)
...
84 )
86 if np.sum(mask) == 0:
87 print("[INFO]: ROI mask is empty")
ROIException: Mask must have the save number of layers (In the 3rd dimension) as input series. Expected 389, got 560