How to replace 0s between 1s with 1s "filling in" meshgrid-derived XYZ matrices?
조회 수: 2(최근 30일)
DICOM ContourData gives points representing organ structures. (Originally a vector for each slice, [x1 y1 z1 x2 y2 z2 ...], I have created three vectors grouping x y z values.)
>> title('PTV1 DICOM Coordinates')
I have another matrix with RTDOSE values. I have created a meshgrid (X,Y,Z) giving the dose's DICOM coordinates and, I think, derived another matrix from it that changes these PTV1 coordinates into 1s with the empty space between them into 0s:
xcontourpointslocation = ismember(X,xcontour);
ycontourpointslocation = ismember(Y,ycontour);
zcontourpointslocation = ismember(Z,zcontour);
So I think now this figure can be thought to represent in "DICOM space" where those 1s are. If I multiply it by the dose matrix, I expect to thereby " extract" the dose at these locations. Yet I obviously want the dose "inside" the structure as well -- i.e., I must convert all those 0s in xcontourpointslocation etc "between the 1s" into 1s to "fill in" the structure.
What MATLAB commands do this elegantly? I have an idea to use the find command with conditioned loops or for loops, but I expect there to be a simpler way, e.g. a command like makesolid(matrix), because this seems straightforward or commonplace.
While hoping you will tell me such a method, I have found some related discussion:
- how to fill a column with 1's between two specific values and with 0 otherwise?
- [replace with interpolated values] zeros in a [vector]
I will continue working on this problem and post my answer if I solve it before hearing from you.