@Tripp, I have found that bug too, I think it suffice to replace M=[] with M=eye(4).
There is however another bug I am afraid. I have not gone deep into the code yet but it seems that, when doing 3D NonRigid registration only 1 direction out of 3 is computed, i.e. the resulting grid only has the estimated deformation in the third component, and components 1 and 2 remain unchanged. Ani hint on how to fix this?
Great submission!
I believe there is a slight bug in the 3D registration if one does non-rigid registration only. I get the following error:
??? Attempted to access M(1,1); index out of bounds because size(M)=[0,0].
Error in ==> make_init_grid at 63
O_trans(:,:,:,1) = mean(1) + M(1,1) * xd + M(1,2) *yd + M(1,3) *zd + M(1,4)* 1;
Error in ==> image_registration>Make_Initial_Grid at 475
O_trans=make_init_grid(Spacing,size(Imoving),M);
Error in ==> image_registration at 219
[O_trans,Spacing,MaxItt]=Make_Initial_Grid(O_trans,Spacing,Options,Imoving,M,IS3D);
If I had to guess, it seems like M (inverse transformation from rigid registration) isn't initialized in the 3D, non-rigid case. I do not get this error when running 2D non-rigid. I also do not get this error when running 3D rigid + non-rigid.
Hi Dirk, very good work and thank you. I think there is a minor bug here.
In the file "affine_registration_error.m You should have if(~exist('Spacing','var')),Spacing=[]; end
Or else, when you run rigid or affine registration, you will always ave to specify the space which is only necessary when bspline registration is used.
Dear Dirk, I want to know if this algo can register a 2d image to a 3d Volume? According to my limited understanding, such registrations are done using projection based methods.. Any suggestion on this. Many thanks.
Comment only