필터 지우기
필터 지우기

Increase speed of imwarp

조회 수: 17 (최근 30일)
Jaime
Jaime 2014년 3월 7일
답변: Kees de Kapper 2018년 3월 21일
Dear Matlab community
I have been using imwarp to spatially transform CT-images along with an upscaling step. I would like to optimize my code and I've found that imwarp is taking a lot of time for my needs. Since I need to upscale one of the images by about 2x2x3 in the x,y, and z direction, respectively, the function ends up taking around 10 minutes per image. After doing a profile check it is actually interp3 the one function inside imwarp that consumes most of the time. I wonder if there are ways to speed imwarp like using parallel computing or other alternatives.
Best regards, Jaime
  댓글 수: 1
Igor Reidler
Igor Reidler 2015년 8월 23일
Hi Jaime, I'm facing a similar situation. Was wondering if you had any progress using parallel computing toolbox, GPU computing, or other?
Thanks, Igor.

댓글을 달려면 로그인하십시오.

답변 (2개)

Matt J
Matt J 2015년 8월 23일
IMWARP seems like the wrong tool for upsampling images. griddedInterpolant is probably smarter, in the sense that it knows that the upsampling can be done separably, and hence more efficiently:
[m,n,p]=size(CTVolume);
gridVectors={linspace(1,m,2*m),...
linspace(1,n,2*n),...
linspace(1,p,3*p)};
F=griddedInterpolant(CTVolume);
newImage=F(gridVectors);

Kees de Kapper
Kees de Kapper 2018년 3월 21일
Dear all,
I know this thread is a bit "old" but I've got a similar question. I'm using imwarp for extracting a 2D image from a 3D dataset but with the use of a 3D transformation.
What I experienced is that the speed of imwarp does not depend on the size of the resample output but on the size of the input image. This surprised me a lot and implies a very inefficient implementation.
I found by searching the web, the function tformarray that I might use as well. Using this function the calculation time is reduced with a factor more than ten. I find this very surprising as I expect the imwarp function is build on top of the tformarray-function (correct me if I'm wrong). Do I make a mistake?
The disadvantage is that when using tformarray, I have to construct a tmap_B that reflects the pixel index corresponding to the axis coordinates for both input and resample axis. Although this might be trivial, is there a in-build Matlab function that can do the job?
I'm looking forward to your comments.
Many thanks in advance,
Kees

태그

Community Treasure Hunt

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

Start Hunting!

Translated by