Remove points in a 3D matrix that lie inside a 2D polygon on each layer
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Cameron
el 31 de En. de 2024
Comentada: Cameron
el 2 de Feb. de 2024
I'm visualizing an MRI but am trying to remove a lot of artifacts that usually come in these images. I've implemented two solutions:
- use knnsearch to remove points too far away from their neighbors (i.e. floating out in the middle of nowhere) - works very well
- Have a user draw a polygon around remaining points from a topdown view (view 2) to remove the clusters of bad points from each layer.
The issue I'm running into is this: I can have a user create a polygon and get the points of the polygon with something like roi.Position, however I'm having trouble figuring out how to efficiently come through each Z layer of the matrix to remove the points within the polygon. Any ideas?
plot3(target_cluster(:,1,:),target_cluster(:,2,:))
roi = drawpolygon('Color','r');
My instinct is to run a for loop through each layer, but this seems inefficient. TIA
2 comentarios
Respuesta aceptada
Matt J
el 1 de Feb. de 2024
and effectively eliminate a column from the mri by adjusting the values of all points within that same polygon to 0 on every slice.
If so, then once you've drawn the ROI, it would just be,
mriVolume=mriVolume.*(~roi.createMask);
3 comentarios
Matt J
el 2 de Feb. de 2024
Editada: Matt J
el 2 de Feb. de 2024
Is this not what you want? You have an MRI image volume and you want to zero all pixels inside a polygon and repeat that for the same set of pixels in each slice. As you can see below, the result my answer gives is not 2D.
mriVolume=rand(3,3,3) %Fake mri volume
imshow(mriVolume(:,:,1))
roi=drawpolygon('Position', [0,0; 2,0; 0,3]*1.7);
mriVolume=mriVolume.*(~roi.createMask) %Delete pixels inside polygon in each slice
Más respuestas (0)
Ver también
Categorías
Más información sobre 3-D Volumetric Image Processing en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!