Can't rigid registration

60 views
Skip to first unread message

Taiki Isomura

unread,
Nov 24, 2020, 4:08:28 AM11/24/20
to Plastimatch
Hi.
I ran rigid registration to CT images.
but finished image was not change!
Same result no matter how many times...
Do CT images have a problem??

The command file is below
I use sample code.

[GLOBAL]
fixed=file_name.mha
moving= file_name.mha
img_out= file_name.mha

[STAGE]
xform=rigid
optim=versor
impl=itk
threading=openmp
max_its=70
img_out= file_name  .mha
 

Paolo Zaffino

unread,
Nov 24, 2020, 10:25:48 AM11/24/20
to plast...@googlegroups.com
Hi,
try something like this:

[GLOBAL]
moving=
fixed=
img_out=

[STAGE]
metric=mattes
xform=rigid
optim=versor
impl=itk
res=1 1 1
max_its=500
max_step=1.0
min_step=0.001
num_samples=0.3
mi_histogram_bins=256
rsg_grad_tol=0.00000000001
translation_scale_factor=200

It use mattes as metric, but if you are registering CT-CT you can use mse (in case remove the line "mi_histogram_bins").

HTH.

Paolo
--
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/d6a589e4-218c-4cdf-948c-119e806e91fdn%40googlegroups.com.


Taiki Isomura

unread,
Nov 24, 2020, 8:44:06 PM11/24/20
to Plastimatch
Thanks for your reply.

I tried that program.
but error message was displayed below

"VersorRigid3DTransformOptimizer: Cost function error after 1 iterations. 
itk::ERROR: MeanSquaresImageToImageMetric(0000019610DD9AF0): 
Too many samples map outside moving image buffer: 0 / 33554432"

Before this message displayed , but I missed it . sorry.

Can I solve this error??



2020年11月25日水曜日 0:25:48 UTC+9 Paolo Zaffino:

Paolo Zaffino

unread,
Nov 25, 2020, 3:07:11 AM11/25/20
to plast...@googlegroups.com
Hi,
I think the images have to be centered before rigid registration (so you need an initialization stage):

[GLOBAL]
moving=
fixed=
img_out=

[STAGE]
xform = align_center

[STAGE]
metric=mattes
xform=rigid
optim=versor
impl=itk
res=1 1 1
max_its=500
max_step=1.0
min_step=0.001
num_samples=0.3
mi_histogram_bins=256
rsg_grad_tol=0.00000000001
translation_scale_factor=200


Paolo

Taiki Isomura

unread,
Nov 26, 2020, 3:34:14 AM11/26/20
to Plastimatch
Hi

When I tried it, CT image moved to the center, but rigid registration didn't start.
Error message was displayed again.

 VersorRigid3DTransformOptimizer: Cost function error after 1 iterations. 
itk::ERROR: MattesMutualInformationImageToImageMetric(000001B9064E4830): Joint PDF summed to zero
ITK failed with too few samples.

Please reply again.

2020年11月25日水曜日 17:07:11 UTC+9 Paolo Zaffino:

Paolo Zaffino

unread,
Nov 26, 2020, 3:54:02 AM11/26/20
to plast...@googlegroups.com
Hi,
if it is Ct-CT registration try to use mse as metric.

[GLOBAL]
moving=
fixed=
img_out=

[STAGE]
xform = align_center

[STAGE]
metric=mse
xform=rigid
optim=versor
impl=itk
res=2 2 1
max_its=500
max_step=1.0
min_step=0.001
num_samples=0.3
rsg_grad_tol=0.00000000001
translation_scale_factor=200

What about the fields of view?
Are they similar of very different?

Paolo

Taiki Isomura

unread,
Nov 27, 2020, 5:34:06 AM11/27/20
to Plastimatch
Hi,
I used mse as metric, but I got the same error as the first.
I used patient's CT image of the same part on the same day.
Two images are very similar.

I tried to run it with  other parameter changed, but it didn't work. 



2020年11月26日木曜日 17:54:02 UTC+9 Paolo Zaffino:

Paolo Zaffino

unread,
Nov 27, 2020, 3:53:03 PM11/27/20
to plast...@googlegroups.com
Can you anonymize and share the data?

Paolo

Taiki Isomura

unread,
Dec 3, 2020, 2:39:57 AM12/3/20
to Plastimatch
Sorry, I can't share the date... 
This program was run successfully with Sample date.
When my date has been converted with plastimatch, the z coordinate value is -1822.
This value is not usually. z coordinate value is between -100 to 100 before converted with plastimatch. 
Is this value cause the error?


[when converted sample date]
Setting PIH from M_IMG
PIH is:
Origin = -241.5524 -241.5524 -100.0000
Size = 256 256 41
Spacing = 1.8945 1.8945 5.0000
Direction = 1.0000 0.0000 0.0000 0.0000 1.0000 0.0000 0.0000 0.0000 1.0000
Rt_study_warp: Saving m_img (test.nrrd)
Trying to write image to test.nrrd
Rt_study_warp: warp and save ss.
Finished!
 
[when converted my date]
Setting PIH from RDD
PIH is:
Origin = -275.0000 -275.0000 -1822.0000
Size = 512 512 128
Spacing = 1.0740 1.0740 2.0000
Direction = 1.0000 0.0000 0.0000 0.0000 1.0000 0.0000 0.0000 0.0000 1.0000
Rt_study_warp: Saving m_img (test.nrrd)
Trying to write image to test.nrrd
Rt_study_warp: warp and save ss.
Finished!

2020年11月28日土曜日 5:53:03 UTC+9 Paolo Zaffino:

Sharp, Gregory C.

unread,
Dec 3, 2020, 3:37:13 PM12/3/20
to plast...@googlegroups.com

Hi,

 

The difference in Z is probably real.  If this is CT, it means that the zero position of the scanner was about 1.8 meters from the first (inferior-most) slice.  This can vary between different manufacturers and scanner vendors.

 

I investigated the problem, and there appears to be a bug of some sort.  What is happening is that the optimizer is taking too big of a step.  I'll try to fix it.  Meanwhile, you can try setting the translation_scale_factor and rotation_scale_factor manually.  Unfortunately this only works with the rsg optimizer.

 

[STAGE]

xform=align_center

 

[STAGE]

metric=mse

xform=rigid

optim=rsg

impl=itk

translation_scale_factor=1

rotation_scale_factor=0.001

 

Greg

 

 

From: plast...@googlegroups.com <plast...@googlegroups.com> On Behalf Of Taiki Isomura
Sent: Thursday, December 03, 2020 2:40 AM
To: Plastimatch <plast...@googlegroups.com>
Subject: Re: [Plastimatch] Can't rigid registration

 

        External Email - Use Caution        

The information in this e-mail is intended only for the person to whom it is addressed. If you believe this e-mail was sent to you in error and the e-mail contains patient information, please contact the Mass General Brigham Compliance HelpLine at http://www.massgeneralbrigham.org/complianceline . If the e-mail was sent to you in error but does not contain patient information, please contact the sender and properly dispose of the e-mail.

Taiki Isomura

unread,
Dec 6, 2020, 8:28:39 PM12/6/20
to Plastimatch
Hi, Greg

Thanks for your reply.
This problem was caused by a bug.
I tried it according to the advise and it ran fine!
But the accuracy is not very high now,  especially not match rotation axis.
I try to improve it from now on. 
 


2020年12月4日金曜日 5:37:13 UTC+9 Sharp, Gregory C.:

Sharp, Gregory C.

unread,
Dec 7, 2020, 10:27:56 AM12/7/20
to plast...@googlegroups.com

Hi Taiki,

 

I learned a bit more about this bug.  It is related to rotation center.  If you can modify your workflow so that the images have image center near zero, it should work better.

 

Meanwhile, I will try to fix the original bug.

Reply all
Reply to author
Forward
0 new messages