In my code, I want to make code like "Manully Interpolate" in "Volume segmenter app".
The problem occurred when I proceeded in the following order.
1. Draw a star-shaped ROI on the 250th image and a 260th square-shaped ROI.
2. Use the "griddata" command to interpolate between ROIs.
3. In the 250th image, the star-shaped ROI in the before is transformed the pentagonal shape.
I want the star-shaped ROI in the 250th image become a square-shaped ROI as it goes to the 260th image.
My test code:
[S.x,S.y,S.z] = ind2sub(size(VOI(:,:,i)),find(VOI(:,:,i) == 1));
S.z(:,1) = i;
[E.x,E.y,E.z] = ind2sub(size(VOI(:,:,i)),find(VOI(:,:,i) == 1));
E.z(:,1) = i;
R.x = [S.x;E.x];
R.y = [S.y;E.y];
R.z = [S.z;E.z];
[M.Xq,M.Yq,M.Zq] = meshgrid(1:1:size(VOI,1),1:1:size(VOI,2),250:1:260);
Vq = griddata(R.x,R.y,R.z,ones(size(R.z)),M.Xq,M.Yq,M.Zq);
VOI(:,:,250:1:260) = Vq;
Thanks for all cooperation in advance.