[Insight-users] Problems with ITK and Linux

Matt McCormick matt.mccormick at kitware.com
Thu Sep 27 22:59:30 EDT 2012


Hi Gabriel,

I have verified that I could build with Eclipse on Ubuntu 12.04.1.
Something I found tricky was that the "eclipse-cdt" package needs to
be installed.

This guide is also helpful:

  http://www.cmake.org/Wiki/CMake:Eclipse_UNIX_Tutorial

If you still have troubles, please let me know and I can record a video Monday.

Thanks,
Matt

On Wed, Sep 26, 2012 at 4:09 PM, Gabriel Santiago
<santiago.eletrica at gmail.com> wrote:
> I did that too.. It is not working...
>
> The library that is missing is not in "Includes" files when I run CMake.
> Could that be a problem?
>
> Thanks,
>
>
> On 26 September 2012 17:05, Matt McCormick <matt.mccormick at kitware.com>
> wrote:
>>
>> Hi Gabriel,
>>
>> I do not have much experience with Eclipse.  Could you please try the
>> Unix Makefiles first to see if that works?
>>
>> Thanks,
>> Matt
>>
>> On Wed, Sep 26, 2012 at 1:29 PM, Gabriel Santiago
>> <santiago.eletrica at gmail.com> wrote:
>> > I don't know if it is important, but in "Includes" folder in Eclipse,
>> > the
>> > path "/usrlocal//include/ITK-4.2" is not there.
>> >
>> > On 26 September 2012 14:12, Gabriel Santiago
>> > <santiago.eletrica at gmail.com>
>> > wrote:
>> >>
>> >> Well, I did use "Eclipse CDT 4" option, but still not working.
>> >>
>> >> Actually, I am using Eclipse Indigo. Could this be a problem?
>> >>
>> >>
>> >> On 26 September 2012 14:03, Matt McCormick <matt.mccormick at kitware.com>
>> >> wrote:
>> >>>
>> >>> PS.  Please reply-to-all so the messages are archived on the mailing
>> >>> list.
>> >>>
>> >>> On Wed, Sep 26, 2012 at 12:59 PM, Matt McCormick
>> >>> <matt.mccormick at kitware.com> wrote:
>> >>> > Hi Gabriel,
>> >>> >
>> >>> > You must use CMake to generate the Makefiles/Project Files.  Then,
>> >>> > use
>> >>> > your build system of choice to run the Makefiles/Project Files.  The
>> >>> > CMake default "generator" on Linux is "Unix Makefiles".  If you use
>> >>> > this, then run the "make" command in the CMake binary directory.  If
>> >>> > you want to use Eclipse, you must specify the "Eclipse CDT4 - Unix
>> >>> > Makefiles" generator.  This will create Eclipse CDT 4.9 projects
>> >>> > files.  You need to use these when you try to build, so Eclipse will
>> >>> > not
>> >>> > know where to look for the header files, libraries.
>> >>> >
>> >>> > HTH,
>> >>> > Matt
>> >>> >
>> >>> > On Wed, Sep 26, 2012 at 12:43 PM, Gabriel Santiago
>> >>> > <santiago.eletrica at gmail.com> wrote:
>> >>> >> Ok, I just run the example and got the same error:
>> >>> >>
>> >>> >> fatal error: vcl_config_manual.h: No such file or directory
>> >>> >> ComputeGradientMagnitudeOfGrayscaleImage        line 242, external
>> >>> >> location:
>> >>> >> /usr/local/include/ITK-4.2/vcl_compiler.h    C/C++ Problem
>> >>> >>
>> >>> >>
>> >>> >>
>> >>> >> On 26 September 2012 13:31, Gabriel Santiago
>> >>> >> <santiago.eletrica at gmail.com>
>> >>> >> wrote:
>> >>> >>>
>> >>> >>> In fact, when I import those files to Eclipse, it shows that every
>> >>> >>> single
>> >>> >>> line of the code has some kind of error and I can not build it.
>> >>> >>>
>> >>> >>>
>> >>> >>> On 26 September 2012 13:28, Gabriel Santiago
>> >>> >>> <santiago.eletrica at gmail.com>
>> >>> >>> wrote:
>> >>> >>>>
>> >>> >>>> Yes, that's correct. That's the the ITK_DIR:
>> >>> >>>> /usr/local/lib/cmake/ITK-4.2/
>> >>> >>>> I am trying to run the example you told me. But no success up to
>> >>> >>>> now...
>> >>> >>>> What should I do?
>> >>> >>>>
>> >>> >>>> thx!
>> >>> >>>>
>> >>> >>>>
>> >>> >>>> On 26 September 2012 13:24, Matt McCormick
>> >>> >>>> <matt.mccormick at kitware.com>
>> >>> >>>> wrote:
>> >>> >>>>>
>> >>> >>>>> Hi Gabriel,
>> >>> >>>>>
>> >>> >>>>> On Wed, Sep 26, 2012 at 12:02 PM, Gabriel Santiago
>> >>> >>>>> <santiago.eletrica at gmail.com> wrote:
>> >>> >>>>> > Thank you, Matt. But can you please, tell step by step exactly
>> >>> >>>>> > what
>> >>> >>>>> > should I
>> >>> >>>>> > do? I am a beginner to this CMake thing. What should be the
>> >>> >>>>> > ITK_DIR
>> >>> >>>>> > correct
>> >>> >>>>> > configuration?
>> >>> >>>>>
>> >>> >>>>> ITK_DIR should be the directory containing the file
>> >>> >>>>> ITKConfig.cmake.
>> >>> >>>>> If ITK is not install, it is the location of the binary build
>> >>> >>>>> directory.  If ITK is installed, I believe in your case it would
>> >>> >>>>> be
>> >>> >>>>> /usr/local/lib/cmake/ITK-4.2/
>> >>> >>>>>
>> >>> >>>>> HTH,
>> >>> >>>>> Matt
>> >>> >>>>>
>> >>> >>>>>
>> >>> >>>>> >
>> >>> >>>>> > Thanks again,
>> >>> >>>>> >
>> >>> >>>>> >
>> >>> >>>>> > On 26 September 2012 12:35, Matt McCormick
>> >>> >>>>> > <matt.mccormick at kitware.com>
>> >>> >>>>> > wrote:
>> >>> >>>>> >>
>> >>> >>>>> >> On Wed, Sep 26, 2012 at 10:37 AM, Gabriel Santiago
>> >>> >>>>> >> <santiago.eletrica at gmail.com> wrote:
>> >>> >>>>> >> > Hi Matt,
>> >>> >>>>> >> >
>> >>> >>>>> >> > Thanks for your reply.
>> >>> >>>>> >> >
>> >>> >>>>> >> > Here it is:
>> >>> >>>>> >> > //- File name: myProject.cpp in myProject folder.
>> >>> >>>>> >> > // -- Code:
>> >>> >>>>> >> >
>> >>> >>>>> >> > #include "/usr/local/include/ITK-4.2/itkImage.h"
>> >>> >>>>> >> > #include "/usr/local/include/ITK-4.2/itkImageFileReader.h"
>> >>> >>>>> >> > #include
>> >>> >>>>> >> >
>> >>> >>>>> >> > "/usr/local/include/ITK-4.2/itkGradientMagnitudeImageFilter.h"
>> >>> >>>>> >> >
>> >>> >>>>> >> > int main(int arcg, char** argv)
>> >>> >>>>> >> > {
>> >>> >>>>> >> >     typedef itk::Image<unsigned short, 2> ImageType;
>> >>> >>>>> >> >     typedef itk::ImageFileReader<ImageType> ReaderType;
>> >>> >>>>> >> >     typedef itk::GradientMagnitudeImageFilter<ImageType,
>> >>> >>>>> >> > ImageType>
>> >>> >>>>> >> > FilterType;
>> >>> >>>>> >> >
>> >>> >>>>> >> >     ReaderType::Pointer reader = ReaderType::New();
>> >>> >>>>> >> >     FilterType::Pointer filter = FilterType::New();
>> >>> >>>>> >> >
>> >>> >>>>> >> >     reader->SetFileName(argv[1]);
>> >>> >>>>> >> >     filter->SetInput(reader->GetOutput());
>> >>> >>>>> >> >     filter->Update();
>> >>> >>>>> >> >
>> >>> >>>>> >> >     return 0;
>> >>> >>>>> >> >
>> >>> >>>>> >> > }
>> >>> >>>>> >> >
>> >>> >>>>> >> > // -- CMakeLists.txt in myProject folder.
>> >>> >>>>> >> >
>> >>> >>>>> >> > PROJECT( myProject )
>> >>> >>>>> >> > FIND_PACKAGE ( ITK REQUIRED )
>> >>> >>>>> >> > IF ( ITK_FOUND )
>> >>> >>>>> >> > INCLUDE( ${ITK_USE_FILE} )
>> >>> >>>>> >> > ENDIF( ITK_FOUND )
>> >>> >>>>> >> > ADD_EXECUTABLE( myProject myProject.cpp )
>> >>> >>>>> >> > TARGET_LINK_LIBRARIES ( myProject ITKCommon ITKIO)
>> >>> >>>>> >> >
>> >>> >>>>> >> >
>> >>> >>>>> >> > Ow! And I forgot to mention that in order to make things
>> >>> >>>>> >> > work,
>> >>> >>>>> >> > I
>> >>> >>>>> >> > had to
>> >>> >>>>> >> > include the whole path to itk libraries.
>> >>> >>>>> >>
>> >>> >>>>> >> Yes, that should not be necessary.  It should be '#include
>> >>> >>>>> >> "itkImage.h"', etc.   The "INCLUDE" statement of your
>> >>> >>>>> >> CMakeLists.txt
>> >>> >>>>> >> should be calling the CMake "include_directories" statement,
>> >>> >>>>> >> which
>> >>> >>>>> >> sets up the right include "-I" flags when building.
>> >>> >>>>> >>
>> >>> >>>>> >> Some sanity checks:
>> >>> >>>>> >>
>> >>> >>>>> >> *  Make sure ITK_DIR is set correctly in the CMake
>> >>> >>>>> >> configuration.
>> >>> >>>>> >> *  build with "make VERBOSE=1" and make use there is a
>> >>> >>>>> >> "-I/usr/local/include/ITK-4.2"
>> >>> >>>>> >>
>> >>> >>>>> >> Try this example (code downloadable in the sidebar on the
>> >>> >>>>> >> left):
>> >>> >>>>> >>
>> >>> >>>>> >>
>> >>> >>>>> >>
>> >>> >>>>> >>
>> >>> >>>>> >>
>> >>> >>>>> >> http://itk.org/ITKExamples/Examples/Filtering/ImageGradient/ComputeGradientMagnitudeOfGrayscaleImage/ComputeGradientMagnitudeOfGrayscaleImage.html
>> >>> >>>>> >>
>> >>> >>>>> >> Hope this helps,
>> >>> >>>>> >> Matt
>> >>> >>>>> >>
>> >>> >>>>> >>
>> >>> >>>>> >> >
>> >>> >>>>> >> >
>> >>> >>>>> >> > On 26 September 2012 11:34, Matt McCormick
>> >>> >>>>> >> > <matt.mccormick at kitware.com>
>> >>> >>>>> >> > wrote:
>> >>> >>>>> >> >>
>> >>> >>>>> >> >> Hi Gabriel,
>> >>> >>>>> >> >>
>> >>> >>>>> >> >> Could you please share the source code you are using for
>> >>> >>>>> >> >> the
>> >>> >>>>> >> >> project.
>> >>> >>>>> >> >>
>> >>> >>>>> >> >> Thanks,
>> >>> >>>>> >> >> Matt
>> >>> >>>>> >> >>
>> >>> >>>>> >> >> On Wed, Sep 26, 2012 at 10:12 AM, Gabriel Santiago
>> >>> >>>>> >> >> <santiago.eletrica at gmail.com> wrote:
>> >>> >>>>> >> >> > Hi guys,
>> >>> >>>>> >> >> >
>> >>> >>>>> >> >> > I am trying to run ITK on my Ubuntu 12.04.1. I did
>> >>> >>>>> >> >> > exactly
>> >>> >>>>> >> >> > what
>> >>> >>>>> >> >> > the
>> >>> >>>>> >> >> > tutorial
>> >>> >>>>> >> >> > says, except that my Cmake and ITK are the most recent
>> >>> >>>>> >> >> > versions.
>> >>> >>>>> >> >> > I also installed the CMake gui interface, which does
>> >>> >>>>> >> >> > exactly
>> >>> >>>>> >> >> > what the
>> >>> >>>>> >> >> > ccmake
>> >>> >>>>> >> >> > does and has the same interface that the Windows
>> >>> >>>>> >> >> > version.
>> >>> >>>>> >> >> >
>> >>> >>>>> >> >> > After I installed ITK on my linux, I tried myProject
>> >>> >>>>> >> >> > example, as
>> >>> >>>>> >> >> > described
>> >>> >>>>> >> >> > in the tutorial. After I made the .cpp (or .cxx) file
>> >>> >>>>> >> >> > and
>> >>> >>>>> >> >> > the
>> >>> >>>>> >> >> > CMakeLists.txt
>> >>> >>>>> >> >> > with the same code found in "Getting Started I", I used
>> >>> >>>>> >> >> > CMake,
>> >>> >>>>> >> >> > choosing
>> >>> >>>>> >> >> > my
>> >>> >>>>> >> >> > /workspace/myProject as source folder and
>> >>> >>>>> >> >> > /workspace/myProject/bin as
>> >>> >>>>> >> >> > binary
>> >>> >>>>> >> >> > directory. Everything seems to work fine, until I try to
>> >>> >>>>> >> >> > build
>> >>> >>>>> >> >> > it.
>> >>> >>>>> >> >> >
>> >>> >>>>> >> >> > I get the following error message:
>> >>> >>>>> >> >> >
>> >>> >>>>> >> >> > fatal error: vcl_config_manual.h: No such file or
>> >>> >>>>> >> >> > directory
>> >>> >>>>> >> >> > myProject
>> >>> >>>>> >> >> > line 242, external location:
>> >>> >>>>> >> >> > /usr/local/include/ITK-4.2/vcl_compiler.h
>> >>> >>>>> >> >> > C/C++ Problem
>> >>> >>>>> >> >> >
>> >>> >>>>> >> >> > Can anyone, please, help me?
>> >>> >>>>> >> >> >
>> >>> >>>>> >> >> > Thanks in advance,
>> >>> >>>>> >> >> >
>> >>> >>>>> >> >> > --
>> >>> >>>>> >> >> > Gabriel Santiago
>> >>> >>>>> >> >> >
>> >>> >>>>> >> >
>> >>> >>>>> >> >
>> >>> >>>>> >> >
>> >>> >>>>> >> >
>> >>> >>>>> >
>> >>> >>>>> >
>> >>> >>>>> >
>> >>> >>>>> >
>> >>> >>>>> > --
>> >>>
>> >>>
>> >>
>> >
>
>
>
>
> --
> Gabriel Santiago
>


More information about the Insight-users mailing list