첫 번째 볼륨을 통과하는 슬라이스 인 하나의 3D 데이터 세트와 하나의 2D 데이터 세트가 있습니다. 그들은 다른 스케일, 해상도 및 다른 좌표계에 있지만, 둘 다 나는 세계 좌표에 대한 아핀 변환을 알고 있습니다. 그런 다음 적용 방법을 알고 있다고 생각합니다. 그러나 sinc 보간법을 사용하여 변환 된 좌표에서 이미지를 다시 얻으려면 어떻게해야합니까? 나는 이것을 수행하는 방법/이것이 어떻게 작동 하는지를 배우고 싶다. 아래의 첫 번째 주석은 이미 선형 보간법을 수행하는 MATLAB 내부의 기존 함수를 지적했지만, Sinc 보간법 (및 기타)을 사용할 수 있도록이 방법을 직접 알고 싶습니다.변환 된 3D 이미지, 바람직하게는 sinc 보간에 대한 보간 또는 리샘플링 알고리즘
좌표를 반올림하고 그 값을 가져올 수 있습니다. 이는 가장 가까운 이웃 보간입니다. 계산 시간에 관계없이 가능한 한 적은 정보를 잃고 싶습니다. 그런 다음 sinc 보간법을 사용해야합니다. 변환 된 좌표를 가질 때 어떻게 보간 알고리즘을 만들 수 있습니까 (예 : sinc)?
Nearest-neighbor interpolation algorithm in MATLAB
"Nearest neighbor"-like interpolation in MATLAB
를 : 상당히 더 도와 해달라고
%%get data
A = rand(200,250,250); % I want to get the slice from this that corresponds to B
B = rand(1200,1200); % I want to get the data from A that corresponds to the same pixels
%%get coordinates for A
siza = size(A); clear xx;clear yy;clear zz;
[xx,yy,zz] = meshgrid(1:siza(1), 1:siza(2), 1:siza(3));
coora = [xx(:)';yy(:)';zz(:)'; ones(size(zz(:)))'];
%%get coordinates for B
sizb = size(B); clear xx;clear yy;clear zz;
[xx,yy] = meshgrid(1:sizb(1),1:sizb(2)); zz = zeros(size(xx));
coorb = [xx(:)';yy(:)';zz(:)'; ones(size(zz(:)))'];
%%define affine transformation matrices
T3d = [-0.02 0.02 1 -88 ;
-0.98 0 -0.02 130;
0 0.98 -0.02 -110;
0 0 0 1 ];
T2d = [-0.2 0 0 126;
0 0.2 -0.2 -131;
0 0 2 43 ;
0 0 0 1 ];
%%transform A coordinates to world coordinates and world coordinates to B coordinates
cooraInBref = T3d*inv(T2d)*coora;
aslice = zeros(size(B));
%% then nearest neighbor would go something like this (dont exactly know how to do this either):
cooraInBround = round(cooraInBref);
for idx = 1:length(coorb);
if cooraInBround(3,idx) == 0
aslice(cooraInBround(1,idx),cooraInBround(2,idx)) = ...;% dont know how to do this
end
end
%% how would I implement sinc interpolation instead of rounding the transformed coordinates
관련 질문 : 예를 들어
9,158,833,210
Python/PIL affine transformation
How do I rotate a 3D matrix by 90 degrees counterclockwise?
Resizing a 3D image (and resampling)
,chappjc anonsubmitter85와 케이프 코드에 의해 코멘트 지적 MATLAB에서 기능을 사용할 준비 : 코멘트와 링크 된 질문에 제안 scatteredInterpolant를 사용
http://mathworks.com/help/matlab/math/interpolating-scattered-data.html
http://mathworks.com/help/matlab/ref/griddata.html?refresh=true
My other SE question I use to get the affine matrix
거의 10 분이 걸렸고 모든 NaN과 슬라이스가 생겨서 다른 방법을 시도하고 있습니다.
도움이 되셨습니까? http://www.mathworks.com/help/matlab/ref/griddata.html –
'scatteredInterpolant'도 시도해 볼 수 있습니다. 그것은 sinc 보간법을 지원하지 않지만 linear가 충분하다는 것을 알 수 있습니다. – AnonSubmitter85
'scatteredInterpolant' 사용 예제는 [this answer] (http://stackoverflow.com/a/21277035/2778484)를보십시오. – chappjc