フィルターのクリア

How to find neighbor voxels of a given voxel?

6 ビュー (過去 30 日間)
Sandhiya Prakash
Sandhiya Prakash 2017 年 3 月 15 日
コメント済み: Makis 2020 年 11 月 25 日
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!

採用された回答

KSSV
KSSV 2017 年 3 月 15 日
You may use knnsearch to get the nearest neighbors. Read about knnsearch
  3 件のコメント
Sandhiya Prakash
Sandhiya Prakash 2017 年 3 月 15 日
Is knnsearch work for 3D image matrix?
Makis
Makis 2020 年 11 月 25 日
is knnsearch really accurate?

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeMRI についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by