Hi; i need help please. I want to multiply the 5 slices i chose from image vol (1) * slices from image vol (3) and (img2 * img4) this program displays as (img2 * img4) , I wan
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
clear all;
close all;
a='C:\Users\HP_2\Desktop\Nouveau dossier (2)'
% % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % %
for p=2:2:4
jpgfiles=dir(fullfile(a,'\*.nii*'));
n=numel(jpgfiles(p));
im=jpgfiles(p).name
img=niftiinfo(fullfile(a,im));
Va = niftiread(img);
Va_prime = mat2gray(Va);%Convertir la matrice en image en niveaux de gris
[sliceX sliceY sliceZ]=size(Va);
frontal = Va_prime; % Frontal view
for i=1:sliceZ
outslice=frontal(:,:,i);
outslice=imrotate(outslice,90);
x(i)=bwarea(outslice);
y=max(x);
c=find(x==y);
end
end
% % % % % % % % % % % % % % % % % % % % % % % % % % % % % %
for p=1:2:3
jpgfiles=dir(fullfile(a,'\*.nii*'));
n=numel(jpgfiles(p));
im=jpgfiles(p).name
img=niftiinfo(fullfile(a,im));
Va = niftiread(img);
Va_prime = mat2gray(Va);%Convertir la matrice en image en niveaux de gris
[sliceX sliceY sliceZ]=size(Va);
frontal1 = Va_prime; % Frontal view
for i=1:sliceZ
outslice=frontal1(:,:,i);
outslice=imrotate(outslice,90);
end
end
for m=-2:2
x=(imrotate(frontal1(:,:,c+m),90)).*(imrotate(frontal(:,:,c+m),90));
figure,imshow(x);
end
4 comentarios
Walter Roberson
el 18 de Jun. de 2021
Do you want to use element-by-element multiplication with the .* operator, or do you want to use algebraic matrix multiplication with the * operator?
What difficulty are you facing in reaching your goal?
Respuestas (1)
Walter Roberson
el 18 de Jun. de 2021
You have
for p=1:2:3
jpgfiles=dir(fullfile(a,'\*.nii*'));
n=numel(jpgfiles(p));
im=jpgfiles(p).name
img=niftiinfo(fullfile(a,im));
Va = niftiread(img);
Va_prime = mat2gray(Va);%Convertir la matrice en image en niveaux de gris
[sliceX sliceY sliceZ]=size(Va);
frontal1 = Va_prime; % Frontal view
for i=1:sliceZ
outslice=frontal1(:,:,i);
outslice=imrotate(outslice,90);
end
end
for m=-2:2
x=(imrotate(frontal1(:,:,c+m),90)).*(imrotate(frontal(:,:,c+m),90));
figure,imshow(x);
end
Notice that the for p loop ends before the for m loop, and that you have not displayed anything in the for j loop. Your only display is inside the for m loop, which is why you only get 5 outputs and not 5 for each different p value.
0 comentarios
Ver también
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!