[Insight-users] Re: MutualinformationEulerRegistration project : Moving out of source tree"

Luis Ibanez luis . ibanez at kitware . com
Mon, 15 Jul 2002 08:50:52 -0400


Hi Zhang,


The warning you are getting in your project is a serious one:

 >> c:\insight\code\common\itkeventobject.h(132) : warning C4541:
 >> 'dynamic_cast' used on polymorphic type 'class itk::EventObject' 
with >> /GR-; unpredictable behavior may result


It indicates that your VC++ workspace has  RTTI (Run Time Type
Information) disabled.  This is a big problem since a lot of ITK
funcionalities rely on this relatively new C++ feature.

RTTI allow to discover at run time the real type of polymorphic
classes. This is required for managing exceptions (in general C++)
and it is also used by ITK in order to manage "itk::Events".

Please make sure that your .dsw project has RTTI enabled.

You can do this on the Project-->Settings-->C/C++ option.
Make sure to enable "Exception Management" too.

BUT...

If you use CMake to set up your project, you will not have to
deal with these details and could make a much better use of
your time   [:-)]


A CMakeLists.txt file like the one provided as example of
an external project in :

     Insight/Examples/SampleProject

can be put outside the ITK source tree (that means, anywhere in
your disk). It will ask you where the Binary and Source ITK trees
are located, and from them it will import all the appropiate ITK 
settings, Including the ones for RTTI and Exceptions management.

Please keep in mind that initial development of CMake was motivated
by how hard it was to setup a project correctly using the traditional
method (read: "hacking the Project/Settings options").

CMake also solved the problem of portability: Windows + Unix

Spending some hours in getting familiar with CMake will save
you a lot of time and effort. You can certainly live without
CMake and configure the .dsw options by yourself but ...
why to do that when you can use this time for writing papers,
applying for grants or playing Go ?


Please let us know if your find any more problems setting up
your project.

Thanks,

   Luis


PS: the second warning : C4786: on the other hand is harmless.

It just indicates that MS-VC++ is not capable of managing symbols
longer than 254 characters when debugging.  This is a VC++
limitation (not ITK related at all) that appears even when
compiling standard STL classes. We use to disable this warning
in our ITK projects.

==========================================================

zhangzhijun wrote:

Dear luis:


Some questions:

1) What version of ITK (beta/cvs) ?

    It's almost newest cvs version, I download it one week before.



2) When you move the files to another directory:
    Does it compiles without warnings ?

    yes, there are some warnings. I attached the two warnings into 2 files
and attached
them in this mail.


3) The MetaImage files,
    are both the .mha and the .raw in the same
    directory ?

      Yes, there are one .raw image in  my directory, but when I remove the
raw file, the
problem still exists.


    Can you open the same files when you use
    the project from ITK.dsw ?

       I can open the same file in the itk.dsw.


4) Do you have other copies of ITK installed
    in your system that can eventually be
    confusing your built ?

       I only have one itk installed.



My guess is that the CMakeLists.txt file is not being
modified correctly....


Luis


----------------------------------------------------------

zhangzhijun wrote:


Dear Luis:

I have run the program and want to modified it. When the project is in

the

itk.dsw, the program runs fine.
but When I copy all of the files related with the
mutualinformationeularregistration project into some other
place and setup a new project. there is something mistake. This time

when I

run it and open a MetaImage,
there will be an error in loading the image. I still havent' find the
problem ,  do you have any hints on this?

regards,
zhang zhijun