How to draw the image using co-ordinates?
3 次查看(过去 30 天)
显示 更早的评论
Hello
i want to draw the image using the cordinates. I got the extracted ROI's from freesurfer now is it possible to draw the ROI's using these cordinates?
0 个评论
回答(1 个)
Akshat
2024-12-26
I am assuming you have the vertices of the ROI. Here is some boilerplate code to assist you:
function plotROIs(coords, labels)
figure;
hold on;
uniqueLabels = unique(labels);
colors = lines(length(uniqueLabels));
for i = 1:length(uniqueLabels)
roiIdx = labels == uniqueLabels(i);
roiCoords = coords(roiIdx, :);
scatter3(roiCoords(:,1), roiCoords(:,2), roiCoords(:,3), ...
'filled', 'MarkerFaceColor', colors(i,:));
if size(roiCoords, 1) > 3
k = boundary(roiCoords); % Create convex hull
trisurf(k, roiCoords(:,1), roiCoords(:,2), roiCoords(:,3), ...
'FaceColor', colors(i,:), 'FaceAlpha', 0.3);
end
end
% Make it look nice
grid on;
axis equal;
xlabel('X'); ylabel('Y'); zlabel('Z');
view(3); % 3D view
rotate3d on;
end
% Example usage:
% coords = [x, y, z] coordinates from FreeSurfer
% labels = ROI labels/numbers
% plotROIs(coords, labels);
Hope this helps
0 个评论
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!