Obtaining logical volume array from cartesian coordinates of volumetric mesh

4 ビュー (過去 30 日間)
OzzWal
OzzWal 2019 年 8 月 3 日
回答済み: Divya Yerraguntla 2019 年 8 月 27 日
Hi,
I'm looking for the best way to convert some point cloud data into a 3D logical volume which I can use to compare with another (and see how similar they are).
I have imported some cartesian points into my workspace from Paraview, which are based on nodes from a 3d volumetric mesh. I wish to convert these values into a logical array so that I may compare them against some ground truth data (a Nifti file).
For context, the data I have imported represents points in an FEModel of someone's lung, where fibrosis has been predicted to occur. Therefore '1' will represent fibrosis and '0' will represent that it is not present at that location in the image. The points I have imported are only where fibrosis is (what I will convert into 1's) , on what I assume to be a non-uniform, 3D grid of interior nodes.
The code I have so far is something like this:
Ilog = (zeros(size(V))); %pre-allocate an array which is the same size as the 3D ground truth data, V (512x512x197 logical array)
for n = 1:length(inxyz(:,1))%inxyz contains cartesian coords
fs = inxyz(n,:);%extract nth row
Ilog(fs(1),fs(2),fs(3)) = 1;%find position and build logical volume
end
I suspect that I may need to interpolate this data so that it is gridded regularly? What would be the best method to go about this? The ground truth data is based on a different image file to that which the mesh was generated from.
My original data (over 6000 points) is like:
517.147000000000 485.898000000000 -49.4057000000000
521.093000000000 479.477000000000 -49.4214000000000
521.109000000000 485.826000000000 -43.4537000000000
517.871000000000 479.697000000000 -44.1086000000000
474.643000000000 506.728000000000 -152.803000000000
481.293000000000 503.511000000000 -151.508000000000
474.973000000000 498.821000000000 -149.782000000000
476.078000000000 499.376000000000 -155.437000000000
513.859000000000 464.033000000000 -91.7537000000000
508.692000000000 463.357000000000 -84.7492000000000
507.955000000000 462.950000000000 -92.2188000000000
513.668000000000 458.050000000000 -89.3088000000000
518.775000000000 468.933000000000 -105.997000000000
518.595000000000 472.601000000000 -111.756000000000
523.501000000000 474.951000000000 -105.284000000000
526.364000000000 470.581000000000 -108.494000000000
...which makes my above code snippet not run without errors, since the array indexing needs positive integers (see z coords).

回答 (1 件)

Divya Yerraguntla
Divya Yerraguntla 2019 年 8 月 27 日
Hi OzzWal,
You could change data at specified cartesian coordinates by creating point cloud object from the original data and changing its properties. The following code helps in doing this:
load('xyzPoints'); %%loading cartesian coordinates to MATLAB Workspace as ‘xyzpoints’
ptCloud = pointCloud(xyzPoints) %%Creating a point cloud object for ‘xyzpoints’
cmatrix = ones(ptCloud.Count,1); %%Creating a column vector of length = number of data points(over 6000 in your case)
ptCloud = pointCloud(xyzPoints,'Intensity',cmatrix) %%Changing the value/intensity of the cartesian coordinates to 1
You could also have a look at this link for more information regarding point cloud objects:https://www.mathworks.com/help/vision/ref/pointcloud.html
Hope it helps!

カテゴリ

Help Center および File Exchange3-D Scene Control についてさらに検索

製品


リリース

R2019a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by