problem with registration

141 views
Skip to first unread message

JPatrick

unread,
May 23, 2012, 10:59:50 PM5/23/12
to Plastimatch
Hello,

I'm new to plastimatch, so I apologize if I'm missing something
obvious.
I'm running Ubuntu 12.04 and I used synaptic package manager to
install plastimatch.

I have an MRI volume that I would like register to another. But the
finished 'warped' image is identical to the original 'moving' image.
Both my 'fixed' and 'moving' files are two part 'mhd' files.
My command file is...

# MRIreg_01to12.txt
[GLOBAL]
fixed=./12M/12_MRI_512x512x299.mhd
moving=./01M/01_MRI_512x512x299.mhd
img_out=./Registrations/12M/01_regTo_12_MRI.mhd
xform_out=./Registrations/12M/reg01to12_B.txt

[STAGE]
xform=bspline
impl=itk
metric=mi
max_its=60
grid_spac=10 10 10
mi_histogram_bins=100
num_samples=250000
background_val=0

...and I call it from the command line with

plastimatch register MRIreg_01to12.txt

Any help as to why this registration isn't working for me would be
greatly appreciated.

Sharp, Gregory C.

unread,
May 24, 2012, 9:05:28 AM5/24/12
to plast...@googlegroups.com

Hi John, welcome,

Can you paste the output from plastimatch? I would be interested
to see if the cost is being reduced (mi is increasing).

Greg
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 Partners Compliance HelpLine at
http://www.partners.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.

JPatrick

unread,
May 24, 2012, 9:46:21 AM5/24/12
to Plastimatch
Thank you for quick reply!

It looks like plastimatch is loading the same file
(12_MRI_512x512x299.mhd) as both the fixed and moving. I'm not sure
why though. I've attached the output below.

jpatrick@snapdragon:~/Desktop/plastimatchScripts$ plastimatch register
MRIreg_01to12.txt
Loading fixed image: ./12M/12_MRI_512x512x299.mhd
Loading moving image: ./12M/12_MRI_512x512x299.mhd
[1] xf_in->m_type = 0, xf_out->m_type = 0
Origin = -523.082 -547.588 -849.894
Spacing = 8.20314 8.20314 9.81006
Size = 85 85 100
Direction Cosines =
 1 0 0
 0 1 0
 0 0 1
Origin = -451.312 -534.006 -867.898
Spacing = 8.20314 8.20314 9.81006
Size = 85 85 100
Direction Cosines =
 1 0 0
 0 1 0
 0 0 1




Starting Registration
MSE [ 0, 80]     1.115 [52.192 secs]
EndEvent:




Registration done.
[2] xf_out->m_type = 5, xf_in->m_type = 0
Writing transformation ...
Warping...
plm_warp_itk: xform_to_itk_vf
plm_warp_itk: convert_to_itk
plm_warp_itk: warping...
Saving image...
Trying to write image to ./Registrations/12M/01_regTo_12_MRI.mhd
Load:   2.53586
Run:    52.3946
Save:   317.5
Total:  372.43
Finished!
jpatrick@snapdragon:~/Desktop/plastimatchScripts$
> contains patient information, please contact the Partners Compliance HelpLine athttp://www.partners.org/complianceline. If the e-mail was sent to you in error

Sharp, Gregory C.

unread,
May 24, 2012, 9:52:47 AM5/24/12
to plast...@googlegroups.com

Ah, that would explain it. There was a bug which causes this
to happen sometimes. It is fixed now, but I'm afraid you will
need to upgrade your plastimatch version.

Are you comfortable compiling the source code? There are
instructions here:

http://plastimatch.org/getting_started.html

(You don't need to build ITK, you can use the one from Ubuntu)

-Greg

JPatrick

unread,
May 24, 2012, 10:09:26 AM5/24/12
to Plastimatch
Excellent! I'll give it a try and get back to you.

Thanks!

JPatrick

unread,
May 24, 2012, 4:16:47 PM5/24/12
to Plastimatch
Hi Greg,

I was able to download the latest version of plastimatch with..
svn co http://forge.abcd.harvard.edu/svn/plastimatch/plastimatch/trunk
plastimatch

I created a 'bin' directory within the plastimatch directory, and from
within the bin directory I called 'ccmake ..'
CMake started, I pressed 'c' to configure, and I got the following
error...

CMake Warning at /usr/lib/InsightToolkit/UseITK.cmake:98
(FIND_PACKAGE):
Could not find module FindGDCM.cmake or a configuration file for
package
GDCM.

Adjust CMAKE_MODULE_PATH to find FindGDCM.cmake or set GDCM_DIR to
the
directory containing a CMake configuration file for GDCM. The file
will
have one of the following names:

GDCMConfig.cmake
gdcm-config.cmake

Call Stack (most recent call first):
CMakeLists.txt:640 (include)



CMake Error at /usr/lib/InsightToolkit/UseITK.cmake:102 (MESSAGE):
UseITK could not load GDCM settings from "GDCM_DIR-NOTFOUND" even
through
ITK was built using GDCM from this location.
Call Stack (most recent call first):
CMakeLists.txt:640 (include)

Does this mean that I am missing a package or library?

Sharp, Gregory C.

unread,
May 24, 2012, 5:38:35 PM5/24/12
to plast...@googlegroups.com
Hi,

Yes, I understand the problem. The one you are missing
is "libgdcm2-dev".

In case you still have problem, here is the full list
of build dependencies.

cmake,
gfortran,
libdcmtk2-dev,
libfftw3-dev,
libgdcm2-dev,
libinsighttoolkit3-dev,
libpng-dev,
libtiff4-dev,
uuid-dev,
zlib1g-dev

(it might be the case that your libpng-dev is called libpng12-dev)

JPatrick

unread,
May 24, 2012, 10:47:58 PM5/24/12
to Plastimatch
Hi Greg,

Thanks again for your help with this.

I've installed all of the packages listed above.
When I ran CMake I got the following warning...

CMake Warning at src/plastimatch/CMakeLists.txt:117 (message):
Plastimatch is built with GDCM 2.X -- DICOM-RT functions are
disabled; if
possible, please use GDCM 1.X instead.

I still went ahead and selected 'g' to generate.
I then ran 'make' and it seemed to run right up to 85%, but I got the
following error at the end...

...
[ 85%] Building CXX object src/plastimatch/cli/CMakeFiles/
plastimatch.dir/plastimatch_main.cxx.o
Linking CXX executable ../../../plastimatch
/usr/bin/ld: /home/jpatrick/plastimatch/bin/libs/lua-5.1.4/
liblua.a(loadlib.c.o): undefined reference to symbol
'dlclose@@GLIBC_2.2.5'
/usr/bin/ld: note: 'dlclose@@GLIBC_2.2.5' is defined in DSO /usr/lib/
gcc/x86_64-linux-gnu/4.6/../../../x86_64-linux-gnu/libdl.so so try
adding it to the linker command line
/usr/lib/gcc/x86_64-linux-gnu/4.6/../../../x86_64-linux-gnu/libdl.so:
could not read symbols: Invalid operation
collect2: ld returned 1 exit status
make[2]: *** [plastimatch] Error 1
make[1]: *** [src/plastimatch/cli/CMakeFiles/plastimatch.dir/all]
Error 2
make: *** [all] Error 2

Is this because of the GDCM warning?
> svn cohttp://forge.abcd.harvard.edu/svn/plastimatch/plastimatch/trunk

Sharp, Gregory C.

unread,
May 25, 2012, 3:55:22 PM5/25/12
to plast...@googlegroups.com
Hi John,

Sorry about that. We could reproduce the problem, and patched
the build scripts. Could you please "svn update" and give it another try?

Thank you,

JPatrick

unread,
May 27, 2012, 10:06:17 PM5/27/12
to Plastimatch
Hi Greg,

I ran the svn update and aside from the following warning during
CMake...

CMake Warning at src/plastimatch/CMakeLists.txt:117 (message):
Plastimatch is built with GDCM 2.X -- DICOM-RT functions are
disabled; if
possible, please use GDCM 1.X instead.

I was still able to generate the makefile etc. I was also able to run
the make to 100%.
Thank you!

However, when I run the command file (included in the first post
above) the registered image is still identical to the the original
'moving' image.
I get the following output when I run it...

jpatrick@MercutioNix:~/Desktop/plastimatchScripts$ ../../plastimatch/
bin/plastimatch register MRIreg_01to12.txt
Loading fixed image: ./12M/12_MRI_512x512x299.mhd
Loading moving image: ./01M/01_MRI_512x512x299.mhd
[1] xf_in->m_type = 0, xf_out->m_type = 0
Origin = 175.552 151.046 -849.894
Dim = 8.20314 8.20314 9.81006
Spacing = 85 85 100
Direction Cosines =
-1 0 0
0 -1 0
0 0 1
Origin = 247.322 164.628 -867.898
Dim = 8.20314 8.20314 9.81006
Spacing = 85 85 100
Direction Cosines =
-1 0 0
0 -1 0
0 0 1
Starting ITK registration
MSE [ 0,43477920] 1.330 [25.797 secs]
EndEvent:
ITK registration complete
[2] xf_out->m_type = 5, xf_in->m_type = 0
Writing transformation ...
Warping...
plm_warp_itk: xform_to_itk_vf
plm_warp_itk: convert_to_itk
plm_warp_itk: warping...
Saving image...
Trying to write image to ./Registrations/12M/01_regTo_12.mhd
Load: 1.22809
Run: 26.6468
Save: 301.307
Total: 329.182
Finished!
jpatrick@MercutioNix:~/Desktop/plastimatchScripts$

JPatrick

unread,
Jun 1, 2012, 1:29:32 PM6/1/12
to plast...@googlegroups.com
Is it possible that the output image (which should be registered) is remaining unchanged because of the warning I receive about GDCM?  If so, would someone be able to advise me on how to obtain GDCM 1.X?
I haven't been able to find it anywhere.

Or perhaps I need to go back to an earlier version of Ubuntu?

Greg Sharp

unread,
Jun 7, 2012, 9:20:28 PM6/7/12
to plast...@googlegroups.com, john.c....@gmail.com

Hi JP,

So sorry for the delay. It took a while to figure this out.

(1) The GDCM 2.X warning is benign. It only affects DICOM-RT
import/export.

(2) I *think* your problem is that the lbfgsb optimizer
is hitting the PGTOL limit on the first iteration.
Try adding the following line to your [STAGE] section:

grad_tol=1e-8

If this works OK, then I will work on a more permanent
solution which can try to set this value automatically.

Thanks for your patience!
-Greg
Reply all
Reply to author
Forward
0 new messages