How to visualize every frame of an fmri image

조회 수: 9 (최근 30일)
Carlotta Fabris
Carlotta Fabris 2016년 12월 23일
답변: Carlotta Fabris 2017년 1월 10일
I have an fmri image and I'm opening it udìsing load_nii and the implay. Now I would make a for cycle to select rois for every frame, but I don't know how to do it, some of you know it?
I did this code but I don't know how I could go on:
nii = load_nii(filename);
data = im2double(nii.img);
implay(data);
Thanks, Carlotta.

채택된 답변

Prashant Arora
Prashant Arora 2016년 12월 29일
I am assuming that "nii.img" returns a 4-D matrix of true color images and you would like to select ROIs for each frame using a loop. You can use the following code to create a interactive "ROI" polygon selector. The final "ROIs" will be stored in the mask variable as logical 3-D array.
nii = load_nii(filename);
I = im2double(nii.img);
mask = zeros(size(I,1),size(I,2),size(I,4));
mask = logical(mask);
for i = 1:size(I,4)
figure(1)
imshow(I(:,:,:,i))
BW = roipoly;
mask(:,:,i) = BW;
figure(2)
imshow(mask(:,:,i));
end

추가 답변 (1개)

Carlotta Fabris
Carlotta Fabris 2017년 1월 10일
Thank you for the answer, but I don't have to draw new ROI. I have to consider the information of the clusters and masks I already created. For example if I'may considering the auditory network, I load the file .nii.gz that I did with FSL and I have to see which value has the cluster in a specific area. When I have that number, I have to take all the vowels that belong to that cluster and for each voxel I have to extract the time course. Then I should do the mean of all the time courses of an area.
This is the pseudocode I did:
nii = load_nii('Auditory.nii.gz');
data = im2double(nii.img);
implay(data);
for i = 1:size[data]
voxel_value = data[cluster];
for voxel_value = 1:size[voxel_value]
M = voxel_value;
for M = 1:size[M]
N = extract_timecourse(M);
Time = matrix[MxN];
end
mean(Time);
end
end
Maybe now it's clear. Thank you again, Carlotta.

카테고리

Help CenterFile Exchange에서 Neuroimaging에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by