Skip to content

Commit 103e1c3

Browse files
committed
PrepareData updated to support ViewRay DICOM-RT DOSE export
1 parent aeacfc1 commit 103e1c3

File tree

1 file changed

+38
-1
lines changed

1 file changed

+38
-1
lines changed

PrepareData.m

Lines changed: 38 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,44 @@
114114
idm = idm(not_rep_pts); %remove repeats in the sample positions
115115
md = md(not_rep_pts); %remove repeats in measured data
116116

117-
% Step 3: Resample for gamma analysis
117+
% Step 3: Check for non-uniform dose grid axes
118+
% Some TPS (e.g. ViewRay) exports DICOM-RT dose files that have
119+
% rounding errors in the (X,Y,Z) positions, resulting in a non-uniform dose
120+
% grid. The following code checks for this condition, determines how large
121+
% it is and resamples to a uniform spacing.
122+
123+
% X
124+
x_max_space = max(cx(2:end)-cx(1:(end-1)));
125+
x_min_space = min(cx(2:end)-cx(1:(end-1)));
126+
if (x_max_space-x_min_space > 0.001) % is it larger than 1/100 mm?
127+
h = msgbox(sprintf('%WARNING: The calculated x-axis values are not uniformly spaced. The maximum discrepancy is %f cm.',x_max_space-x_min_space));
128+
cx = linspace(cx(1),cx(end),length(cx));
129+
elseif (x_max_space-x_min_space > 0.0) % is it larger than 0 mm?
130+
cx = linspace(cx(1),cx(end),length(cx));
131+
end
132+
133+
% Y
134+
y_max_space = max(cy(2:end)-cy(1:(end-1)));
135+
y_min_space = min(cy(2:end)-cy(1:(end-1)));
136+
if (y_max_space-y_min_space > 0.001) % is it larger than 1/100 mm?
137+
h = msgbox(sprintf('%WARNING: The calculated y-axis values are not uniformly spaced. The maximum discrepancy is %f cm.',y_max_space-y_min_space));
138+
cy = linspace(cy(1),cy(end),length(cy));
139+
elseif (y_max_space-y_min_space > 0.0) % is it larger than 0 mm?
140+
cy = linspace(cy(1),cy(end),length(cy));
141+
end
142+
143+
% Z
144+
z_max_space = max(cz(2:end)-cz(1:(end-1)));
145+
z_min_space = min(cz(2:end)-cz(1:(end-1)));
146+
if (z_max_space-z_min_space > 0.001) % is it larger than 1/100 mm?
147+
h = msgbox(sprintf('%WARNING: The calculated z-axis values are not uniformly spaced. The maximum discrepancy is %f cm.',z_max_space-z_min_space));
148+
cz = linspace(cz(1),cz(end),length(cz));
149+
elseif (z_max_space-z_min_space > 0.0) % is it larger than 0 mm?
150+
cz = linspace(cz(1),cz(end),length(cz));
151+
end
152+
153+
154+
% Step 4: Resample for gamma analysis
118155

119156
% Resample indep with the same range but a finer spacing
120157
SAMP_PER_CM = 200; % samples per cm

0 commit comments

Comments
 (0)