How to create a specific Visual?

1 Ansicht (letzte 30 Tage)
kianna brevig
kianna brevig am 8 Jul. 2015
Beantwortet: Ghada Saleh am 17 Jul. 2015
I am working with fMRI data to generate a brain connectivity map. My script produces a 128x128x128 cell array and in each individual cell there is a vector containing the indices of all the other cells that are connected to it.
What I want to generate is a visual of a 128x128x128 cube with lines drawn showing connections between the individual cells.
Any ideas on how I can do this??
Thanks!

Antworten (1)

Ghada Saleh
Ghada Saleh am 17 Jul. 2015
Hi Kianna,
I understand you want to visualize the connections between different data points stored in a cell array. I tried to visualize the connections on a smaller data set(2x2x2) than the one you are using. So I first created the cell array that contains the data as follows:
n = 2;
M{1,1,1} = [3 4];
M{1,1,2} = 1;
M{1,2,1} = [5 6 7];
M{1,2,2} = [7 1];
M{2,1,1} = [2 8 4];
M{2,1,2} = [2 5];
M{2,2,1} = 3 ;
M{2,2,2} = [3 5];
where each number (1:8) represent an index from the indices vector as follows:
indices = [1 1 1;1 1 2; 1 2 1; 1 2 2;2 1 1; 2 1 2; 2 2 1; 2 2 2];
Finally, you can create a matrix that contains all connection and separate each two 3D points by a 'nan' to make sure that MATLAB does not add unnecessary connections between points. Here is a sample code demonstrating this:
plotM = [];
for i = 1: n
for j = 1:n
for k = 1:n
newPoint = M{i,j,k};
numOfConnections = length(newPoint);
for l = 1: numOfConnections
p = indices(newPoint(l),:);
newM = [i j k; p ; nan nan nan];
plotM = [plotM ;newM];
end
end
end
end
plot3(plotM(:,1),plotM(:,2),plotM(:,3),'b');
You can simply generalize that code by using your data set instead of 'M' and put 'n = 128'.
I hope this helps,
Ghada

Kategorien

Mehr zu MRI finden Sie in Help Center und File Exchange

Tags

Produkte

Community Treasure Hunt

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

Start Hunting!

Translated by