Borrar filtros
Borrar filtros

How to find neighbor voxels of a given voxel?

6 visualizaciones (últimos 30 días)
Sandhiya Prakash
Sandhiya Prakash el 15 de Mzo. de 2017
Comentada: Makis el 25 de Nov. de 2020
Hi! I am working with 3D MRI image of size(164x187x145). For a given voxel i need to consider 26 neighbouring 3x3x3 patch.(now 27 scalar values)Then consider all 26 neighbouring conventional 3x3x3 patches and compute average intensity for all these neighbouring patches.(So totally i have 53 scalar intensity values).How to perform this? Anyone who knows Plz reply !! code that i referred is as follows
function[IndexNeighbours] = findNeighbours(Index,MatrixSize)
%%**************************************************************************
% Module name: findNeighbours.m
% Version number: 1
% Revision number: 00
% Revision date: 10-2013
2013 (C) Copyright by Patrick Granton Maastro Clinic
% Outputs:
% IndexNeighbours = The index positions of valid voxels
% Usage: [IndexNeighbours] = findNeighbours(33014,[400 400 400])
Description:
%*************************************************************************
% References:
%
%*************************************************************************
%%Revision History
% %%*************************************************************************
%1
Base = [+1 +1 0 ...
%2
+1 -1 0 ...
%3
+1 +1 +1; ...
%4
+1 0 +1; ...
%5
+1 -1 +1; ...
%6
+1 +1 -1; ...
%7
+1 0 -1; ...
%8
+1 -1 -1; ...
%9
+1 0 0 ...
%10
0 +1 0 ...
%11
0 -1 0 ...
%12
0 +1 +1; ...
%13
0 0 +1; ...
%14
0 -1 +1; ...
%15
0 +1 -1; ...
%16
0 0 -1; ...
%17
0 -1 -1; ...
%18
-1 +1 0 ...
%19
-1 -1 0 ...
%20
-1 +1 +1; ...
%21
-1 0 +1; ...
%22
-1 -1 +1; ...
%23
-1 +1 -1; ...
%24
-1 0 -1; ...
%25
-1 -1 -1; ...
%26
-1 0 0];
[I J K] = ind2sub([MatrixSize],Index);
neighbours = Base+repmat([I J K],[26 1]);
valid_neighbours = (1 - sum(neighbours(1:26,:)<=0,2));
valid_neighbours_Indices = find(valid_neighbours==1);
IndexNeighbours = sub2ind([MatrixSize],[neighbours(valid_neighbours_Indices,1)],[neighbours(valid_neighbours_Indices,2)],[neighbours(valid_neighbours_Indices,3)]);
end
My doubt is what i must give for matrixsize and index if I am using 164*197*145 3D matrix?
Thanks in advance!

Respuesta aceptada

KSSV
KSSV el 15 de Mzo. de 2017
You may use knnsearch to get the nearest neighbors. Read about knnsearch
  3 comentarios
Sandhiya Prakash
Sandhiya Prakash el 15 de Mzo. de 2017
Is knnsearch work for 3D image matrix?
Makis
Makis el 25 de Nov. de 2020
is knnsearch really accurate?

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre MRI en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by