MATLAB Answers

Unsure how to separate 4-D matrix data to perform correlations

7 views (last 30 days)
Sawyer
Sawyer on 11 Dec 2018
Commented: Sawyer on 13 Dec 2018
I have a file containing two different variables 1.REF and 2.TIME.
The dimension of the REF variable is 30*30*14*60, where there are 30 voxels in X direction, 30 voxels in Y direction and 14 voxels in Z direction and there are 60 timepoints (Volumes acquired). Variable TIME has a reference time series.
I need to write a program to perform the following:
1.Correlate Reference time series with each and every voxel time series and create a new 3 dimensional data
2.Find out the voxels with maximum correlation value
I've never worked with a 4-D matrix before so am unsure how to break up the REF variable so I can perform the correlations. Can someone please help me?

  0 Comments

Sign in to comment.

Accepted Answer

Mark Sherstan
Mark Sherstan on 12 Dec 2018
This is common in image processing and you can use a similar process to extract your features. Using the image attachted if you run the following commands:
I = imread('Voxels.png');
size(I)
>> 916 800 3
You can see the matrix is 916x800x3. Here the image is 916x800 pixels. The image is made out of red, green, and blue pixels of different ratios to make a specified color (hence the 3). So if I only wanted to extract the red components I would run:
red = I(:,:,1);
Similarly I could put 2 and 3 to get blue and green components respectively.
If the image was a gif it would be 916x800x3xN where N would be a frame like in a video. If I wanted the last red frame I could run:
red = I(:,:,1,end);
So in your case simply to extract all the features you could run a loop like this:
for ii = 1:60
for jj = 1:14
REF(:,:,jj,ii)
end
end
You might be better off to store the results in a cell array but it all depends on how you plan on analyzing your results (so ill leave that up to you). Hope this helped.

  1 Comment

Sign in to comment.

More Answers (0)

Products


Release

R2018a

Community Treasure Hunt

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

Start Hunting!