Closed bcdarwin closed 4 years ago
That will happen if you set the number of iterations at the top levels to 0.
Sorry, I disabled the finest resolution iterations just for the purposes of speed. The output shape is unchanged if you run some. (I've updated the code example and output above.)
(Also, even if true, wouldn't the output header above still imply the voxel spacing of the output had been set incorrectly?)
500 is way too large for a debugging example. I can reproduce with an image of 100x100x100.
The pyramid scheme is not resampling properly for this particular number of levels and image size. Definitely a bug and something for which a fix and pull request would be nice. But it's probably not something anybody will be fixing on our end as ANTS
is somewhat deprecated.
Apparently more than somewhat: I didn't adjust any parameters above to trigger the bug, so this means that an arbitrary ANTS call is now likely broken.
As nick said, we don’t maintain that program , we leave it up to the community.
The old program is superseded by antsRegistration.
On Fri, Sep 4, 2020 at 6:41 PM Ben Darwin notifications@github.com wrote:
Apparently more than somewhat: I didn't adjust any parameters above to trigger the bug, so this means that an arbitrary ANTS call is now likely broken.
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/ANTsX/ANTs/issues/1076#issuecomment-687440448, or unsubscribe https://github.com/notifications/unsubscribe-auth/AACPE7TYDJACKBMICS5M2PLSEFUJHANCNFSM4QZJNA6A .
--
brian
Of course I don't mind that, I just have some code that I didn't switch to antsRegistration since I didn't know this was the case (it's not gated in the cmake config, doesn't print any warning, I didn't see a changelog, etc.)
Thanks for clarifying!
One thought, though, is that this is an obvious bug---something that we would've caught before now. I'm wondering if something was checked in recently or if ITK made some changes which are now causing this issue. Perhaps I'll check if I can find some time.
Git bisect would help here
Bisecting now, will update when I find the problem.
f0977f8c3c69fdb6e7b98231f85f9a491007041e is the first bad commit
commit f0977f8c3c69fdb6e7b98231f85f9a491007041e
Author: Hans Johnson <hans.j.johnson@gmail.com>
Date: Sun Aug 18 14:18:04 2019 -0500
COMP: Allow building with ITK_LEGACY_REMOVE turned on
The VectorExpandImage filter specialization is no longer needed because
the ExpandImage filter now works with both vector and scalar types
uniformly.
ImageRegistration/itkANTSImageRegistrationOptimizer.h | 6 +++---
SuperBuild/External_ITKv5.cmake | 2 +-
2 files changed, 4 insertions(+), 4 deletions(-)
https://github.com/ANTsX/ANTs/commit/f0977f8c3c69fdb6e7b98231f85f9a491007041e
That's awesome, @cookpa and makes sense. Do you want me to fix it or do you want to give it a go?
Would you be OK with putting the old vector expander class back in? That's all I can see that might explain the change.
Yeah, that's the first thing I would try and, if it works, I would just leave the old one.
@ntustison looks like that class has been removed from ITK
Hey @cookpa , Sorry just got back from a run but I'm pretty sure I found the issue without even looking at the ANTs code. Look at the different signatures for the likely culprit function:
# Line 134
SetExpandFactors(const float factor);
vs.
# Line 112
SetExpandFactors(const unsigned int factor);
Going to do some digging in the optimizer class to verify that this is the issue. Tagging @hjmjohnson since he made the original change and I don't know yet if this needs to be reported back to ITK.
That function is overloaded, the other version takes a templated array. I'm going to try to get that to take a float
EDIT: it's a static attribute, so I don't think I can change it.
Right. But am I not reading correctly that a related difference is the template type for that array (Line 106 vs. Lines 116-117)?
No you're right. I was looking at the other method:
virtual void | SetExpandFactors (const unsigned int factor)
But you're right, it's declared as float in the vector class and unsigned int in the regular class. So unless there's some way to change that at compile time, it's not going to work for us.
Okay, then I'm thinking we simply replace the ExpandImageFilter approach with appropriate calls to the ResampleImageFilter class. How does that sound?
Describe the problem
ANTS produces a warp field that is smaller than the input images, so the resampled moving image is not fully aligned to the fixed image.
To Reproduce
Make some random data using numpy and nibabel and run a trivial registration of the image to itself:
This seems to be independent of IO (e.g., MINC vs NIFTI inputs/outputs produce the same result).
System information
OS: Ubuntu Linux
OS version: 16.04 (system gcc 5.4.0)
Type of system: desktop
OS: CentOS
OS version: 6 (gcc 7.2.0)
Type of system: cluster
OS: CentOS + Nixpkgs
OS version: 7 (gcc 8.3)
Type of system: cluster
ANTs version information
(also present with 2.3.1.dev90-g55fa5, but not in 2.2.0)
Additional information
Running with a debug build produces no errors, but valgrind produces a couple suspicious things such as:
but I didn't investigate this further.
Initial discovery by @mcvaneede.