Skip to content

Commit

Permalink
Comment
Browse files Browse the repository at this point in the history
There was a rare bug in the final space setup of the deformation map, where I added a correction as comment if this occurs more often.
  • Loading branch information
robdahn committed Feb 20, 2025
1 parent 3f4382c commit e17a897
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions cat_main_registration.m
Original file line number Diff line number Diff line change
Expand Up @@ -419,7 +419,10 @@
%% define warping variables based on previous deformation
% estimate the inverse transformation
yid = spm_diffeo('invdef', Yy , odim, inv(tpmM\M1), M1\res.Affine*M0);
% RD202502: strange error with Rusak2021_sub-ADNI003S5209_simGMatrophy0.00mm.nii so we repalce bad voxels by neighbors
%yidbad = isinf(yid) | yid<0 | yid>200; yid(yidbad) = nan; clear yidbad;
yi = spm_diffeo('invdef', yid, idim, inv(M1\res.Affine*M0), eye(4)); clear yid;
%yibad = isinf(yi) | yi<0 | yi>max(size(yi)); yi(yibad) = nan; clear clear yidbad;
yi2 = spm_diffeo('invdef', yi , odim, eye(4), eye(4));
w = max( eps , abs(spm_diffeo('def2det', yi2 ) ) );
% Adaption to avoid boundary effects by correcting the voxel close
Expand Down Expand Up @@ -506,7 +509,10 @@

% estimate the inverse transformation
yid = spm_diffeo('invdef', Yy , sdim, inv(tpmM\M1), M1\res.Affine*M0);
% RD202502: strange error with Rusak2021_sub-ADNI003S5209_simGMatrophy0.00mm.nii so we repalce bad voxels by neighbors% RD202502: strange error with Rusak2021_sub-ADNI003S5209_simGMatrophy0.00mm.nii so we repalce bad voxels by neighbors
%yidbad = isinf(yid) | yid<0 | yid>200; yid(yidbad) = nan; clear yidbad;
yi = spm_diffeo('invdef', yid, idim, inv(M1\res.Affine*M0), eye(4)); clear yid;
%yibad = isinf(yi) | yi<0 | yi>max(size(yi)); yi(yibad) = nan; clear clear yidbad;
yi2 = spm_diffeo('invdef', yi , odim, eye(4), eye(4));
w = max( eps , abs(spm_diffeo('def2det', yi2 ) ) );
% Adaption to avoid boundary effects by correcting the voxel close
Expand Down

0 comments on commit e17a897

Please sign in to comment.