Too many samples map outside moving image buffer

744 views
Skip to first unread message

Hongying Feng

unread,
Mar 30, 2021, 9:24:23 PM3/30/21
to Plastimatch
Hi, I am testing the xform=rigid optim=versor registration with a clinical example. But I got a error message saying"
"
Fixed image for this stage:
Dim = 64 64 54
Origin = -319.922 -548.422 -211.2
Spacing = 10.1563 10.1563 8
Direction Cosines =
 1 0 0
 0 1 0
 0 0 1
Moving image for this stage:
Dim = 64 64 57
Origin = -319.922 -419.922 -1046.4
Spacing = 10.1563 10.1563 8
Direction Cosines =
 1 0 0
 0 1 0
 0 0 1
Initial Parameters = [0, 0, 0, 0, 0, 0]
Starting ITK registration
StartEvent: [0, 0, 0, 0, 0, 0]
EndEvent: [0, 0, 0, 0, 0, 0]
VersorRigid3DTransformOptimizer: Cost function error after 0 iterations. itk::ERROR: MeanSquaresImageToImageMetric(0000028FE6180C50): Too many samples map outside moving image buffer: 0 / 221184
"
What can I do to fixed this?

Dylan Hsu

unread,
Apr 7, 2021, 12:02:01 PM4/7/21
to Plastimatch
Dear mystery user,

Your initial parameters are bad. At a glance, the images have different origins. For a quick solution, you could translate one image towards the other by the offset using Plastimatch and a transform text file, then run your registration. Alternatively, you could obtain a moments-based initialization using CenteredTransformInitializer in ITK or SimpleITK.

Dylan Hsu


Hongying Feng

unread,
Apr 12, 2021, 7:30:25 PM4/12/21
to Plastimatch
Thank you for you response.
I used ITK and get a the moments-based initialized image using CenteredTransformInitializer. Then I did the Versor rigid registration  with:
"
[STAGE]
xform=rigid
optim=versor
max_its=30
res=1 1 1
"
This time, the origin are the same. But after 1 iteration, I got the same error:
"
Fixed image for this stage:
Dim = 512 512 222
Origin = -324.365 -424.365 -1029.9
Spacing = 1.26953 1.26953 2
Direction Cosines =
 1 0 0
 0 1 0
 0 0 1
Moving image for this stage:
Dim = 512 512 222
Origin = -324.365 -424.365 -1029.9
Spacing = 1.26953 1.26953 2
Direction Cosines =
 1 0 0
 0 1 0
 0 0 1
Initial Parameters = [0, 0, 0, 0, 0, 0]
Starting ITK registration
StartEvent: [0, 0, 0, 0, 0, 0]
MSE [ 0,  0, 1.00] 70653.202 [0.40521575236740237, -0.10190427381798242, 0.00853184515201954, 0.12648496106378895, 0.47455224786986283, 0.12338896764366468] *
EndEvent: [0.40521575236740237, -0.10190427381798242, 0.00853184515201954, 0.12648496106378895, 0.47455224786986283, 0.12338896764366468]
VersorRigid3DTransformOptimizer: Cost function error after 1 iterations. itk::ERROR: MeanSquaresImageToImageMetric(000001EB63792C30): Too many samples map outside moving image buffer: 827197 / 58195968
"
What's problem now?

Best,
Hongying

Hongying Feng

unread,
Apr 13, 2021, 1:54:35 AM4/13/21
to Plastimatch
To be more specific.
I did the same thing based on several cases.
After the moments-based initialization, fixed and moving images have the same origin.
I can do diffeomorphic and fast symmetric force to these two images, but I can not do versor rigid 3d registration to some of the image pairs with the error message I mentioned previously.


Best,
Hongying

在2021年4月7日星期三 UTC-7 上午9:02:01<dylan...@gmail.com> 写道:

Sharp, Gregory C.

unread,
Apr 13, 2021, 9:45:29 AM4/13/21
to Plastimatch
Hi Hongying,

You might try adding a first stage before the rigid registration.

First, I would try aligning the image centers.

[STAGE]
xform=align_center

If that doesn't work, you could try a global search.  Slow, but sometimes helps.

[STAGE]
xform=translation
optim=grid_search
# metric=(mi or mse)

Greg


From: plast...@googlegroups.com <plast...@googlegroups.com> on behalf of Hongying Feng <trac...@gmail.com>
Sent: Tuesday, April 13, 2021 1:54 AM
To: Plastimatch <plast...@googlegroups.com>
Subject: [Plastimatch] Re: Too many samples map outside moving image buffer
 

        External Email - Use Caution        

--
You received this message because you are subscribed to the Google Groups "Plastimatch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to plastimatch...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/plastimatch/29d58617-8c14-40c3-afd0-a82f628ff977n%40googlegroups.com.

Paolo Zaffino

unread,
Apr 13, 2021, 4:23:46 PM4/13/21
to plast...@googlegroups.com
Hi,
if you set the fixed/moving masks, you can initialize the registration by aligning the center of mass.
To do this you can use:
xform=align_center_of_gravity

Best,
Paolo
Reply all
Reply to author
Forward
0 new messages