[Insight-users] Problems with ITK and Linux

Matt McCormick matt.mccormick at kitware.com
Wed Sep 26 13:03:28 EDT 2012


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
>>>>> >> >> >
>>>>> >> >> > _____________________________________
>>>>> >> >> > Powered by www.kitware.com
>>>>> >> >> >
>>>>> >> >> > Visit other Kitware open-source projects at
>>>>> >> >> > http://www.kitware.com/opensource/opensource.html
>>>>> >> >> >
>>>>> >> >> > Kitware offers ITK Training Courses, for more information visit:
>>>>> >> >> > http://www.kitware.com/products/protraining.php
>>>>> >> >> >
>>>>> >> >> > Please keep messages on-topic and check the ITK FAQ at:
>>>>> >> >> > http://www.itk.org/Wiki/ITK_FAQ
>>>>> >> >> >
>>>>> >> >> > Follow this link to subscribe/unsubscribe:
>>>>> >> >> > http://www.itk.org/mailman/listinfo/insight-users
>>>>> >> >> >
>>>>> >> >
>>>>> >> >
>>>>> >> >
>>>>> >> >
>>>>> >> > --
>>>>> >> > Gabriel Santiago
>>>>> >> > Engenheiro de Computação - Serviço de Informática/ Hospital das
>>>>> >> > Clínicas
>>>>> >> > de
>>>>> >> > São Paulo
>>>>> >> > santiago.eletrica at gmail.com
>>>>> >> > Cel.: +55 11 99801-0881
>>>>> >> >
>>>>> >> > ~"As long as I live so long do I learn"~
>>>>> >> > Ramakhrishna
>>>>> >> >
>>>>> >
>>>>> >
>>>>> >
>>>>> >
>>>>> > --
>>>>> > Gabriel Santiago
>>>>> > Engenheiro de Computação - Serviço de Informática/ Hospital das
>>>>> > Clínicas de
>>>>> > São Paulo
>>>>> > santiago.eletrica at gmail.com
>>>>> > Cel.: +55 11 99801-0881
>>>>> >
>>>>> > ~"As long as I live so long do I learn"~
>>>>> > Ramakhrishna
>>>>> >
>>>>
>>>>
>>>>
>>>>
>>>> --
>>>> Gabriel Santiago
>>>> Engenheiro de Computação - Serviço de Informática/ Hospital das Clínicas
>>>> de São Paulo
>>>> santiago.eletrica at gmail.com
>>>> Cel.: +55 11 99801-0881
>>>>
>>>> ~"As long as I live so long do I learn"~
>>>> Ramakhrishna
>>>>
>>>
>>>
>>>
>>> --
>>> Gabriel Santiago
>>> Engenheiro de Computação - Serviço de Informática/ Hospital das Clínicas
>>> de São Paulo
>>> santiago.eletrica at gmail.com
>>> Cel.: +55 11 99801-0881
>>>
>>> ~"As long as I live so long do I learn"~
>>> Ramakhrishna
>>>
>>
>>
>>
>> --
>> Gabriel Santiago
>> Engenheiro de Computação - Serviço de Informática/ Hospital das Clínicas de
>> São Paulo
>> santiago.eletrica at gmail.com
>> Cel.: +55 11 99801-0881
>>
>> ~"As long as I live so long do I learn"~
>> Ramakhrishna
>>


More information about the Insight-users mailing list