[Insight-developers] [Insight-users] Problems with ITK

Cory Quammen cquammen at cs.unc.edu
Tue Oct 23 09:56:30 EDT 2012


Gabriel,

You must be trying to use CUDA in your project. I wouldn't be
surprised if the CUDA compiler has trouble with all the features of
C++ that ITK uses.

The good news is that you don't need to define your main function
inside a CUDA source file. You can instead compile only your CUDA
source with the CUDA compiler, and all your regular C++ code as C++
files. Just put the CUDA code in a .cu file, put your main C++ code in
a .cpp file, then add all the source files to your call to
CUDA_ADD_EXECUTABLE. CMake should figure out how to compile them
automatically.

Hope that helps,
Cory

On Tue, Oct 23, 2012 at 9:45 AM, Bill Lorensen <bill.lorensen at gmail.com> wrote:
> Why are you using .cu?
>
> On Tue, Oct 23, 2012 at 9:37 AM, Gabriel Santiago
> <santiago.eletrica at gmail.com> wrote:
>>
>> I am using 3.20.1 version.
>>
>> If I change to .cpp instead of .cu everything works fine.
>>
>>
>> On 23 October 2012 11:34, Bill Lorensen <bill.lorensen at gmail.com> wrote:
>>>
>>> Please keep on list....
>>>
>>> What version of ITK? And what happens if you define it as a .cxx rather
>>> than .cu?
>>>
>>>
>>> On Tue, Oct 23, 2012 at 9:17 AM, Gabriel Santiago
>>> <santiago.eletrica at gmail.com> wrote:
>>>>
>>>> Sure!
>>>>
>>>> In my main.cu file:
>>>>
>>>> #include <iostream>
>>>> #include <string>
>>>> #include "itkImageFileReader.h"
>>>>
>>>> using std::cout;
>>>> using std::string;
>>>>
>>>> int main(void){
>>>>
>>>> string filename = "dicom_file.dcm";
>>>>
>>>> typedef signed int InputPixelType;
>>>> typedef itk::Image<InputPixelType, 3> InputImageType;
>>>> typedef itk::ImageFileReader<InputImageType> ReaderType;
>>>> ReaderType::Pointer reader = ReaderType::New();
>>>> reader->SetFileName(filename.c_str());
>>>>
>>>> return 0;
>>>>
>>>> }
>>>>
>>>> My CMakeLists.txt file conatins:
>>>>
>>>> PROJECT( PROJECT_NAME )
>>>> CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
>>>> FIND_PACKAGE ( ITK REQUIRED )
>>>> FIND_PACKAGE(CUDA)
>>>> INCLUDE(FindCUDA)
>>>> IF ( ITK_FOUND )
>>>> INCLUDE( ${ITK_USE_FILE} )
>>>> ENDIF( ITK_FOUND )
>>>> CUDA_ADD_EXECUTABLE( PROJECT_NAME main.cu )
>>>> TARGET_LINK_LIBRARIES ( PROJECT_NAME ITKCommon ITKIO)
>>>>
>>>> Thank you for your reply,
>>>>
>>>> On 23 October 2012 11:08, Bill Lorensen <bill.lorensen at gmail.com> wrote:
>>>>>
>>>>> Gabriel,
>>>>>
>>>>> Can you provide a small compilable example to illustrate your problem?
>>>>>
>>>>> Bill
>>>>>
>>>>> On Mon, Oct 22, 2012 at 7:35 AM, Gabriel Santiago
>>>>> <santiago.eletrica at gmail.com> wrote:
>>>>>>
>>>>>> Hi guys,
>>>>>>
>>>>>> I am trying to read a DICOM file using ITK. I am doing exactly what is
>>>>>> described in the ITK User Guide but I am getting some weird error messages.
>>>>>> Here they are:
>>>>>>
>>>>>>  overriding ‘itk::ImageBase<VImageDimension>::Pointer
>>>>>> itk::ImageBase<VImageDimension>::CreateAnother() const [with unsigned int
>>>>>> VImageDimension = 3u, itk::ImageBase<VImageDimension>::Pointer =
>>>>>> itk::SmartPointer<itk::ImageBase<3u> >]’
>>>>>>
>>>>>> overriding ‘virtual itk::LightObject::Pointer
>>>>>> itk::Object::CreateAnother() const’
>>>>>>
>>>>>> invalid covariant return type for
>>>>>> ‘itk::ImageBase<VImageDimension>::Pointer
>>>>>> itk::ImageBase<VImageDimension>::CreateAnother() const [with unsigned int
>>>>>> VImageDimension = 3u, itk::ImageBase<VImageDimension>::Pointer =
>>>>>> itk::SmartPointer<itk::ImageBase<3u> >]’
>>>>>>
>>>>>> invalid covariant return type for ‘itk::LightObject::Pointer
>>>>>> itk::Image<TPixel, VImageDimension>::CreateAnother() const [with TPixel =
>>>>>> int, unsigned int VImageDimension = 3u, itk::LightObject::Pointer =
>>>>>> itk::SmartPointer<itk::LightObject>]’
>>>>>>
>>>>>> All of them are not in my code. Can anyone here, please tell me what
>>>>>> is going on?
>>>>>>
>>>>>> Thank you all,
>>>>>>
>>>>>> --
>>>>>> Gabriel Santiago
>>>>>>
>>>>>> ~"As long as I live so long do I learn"~
>>>>>> Ramakhrishna
>>>>>>
>>>>>>
>>>>>> _____________________________________
>>>>>> 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
>>>>>>
>>>>>
>>>>>
>>>>>
>>>>> --
>>>>> Unpaid intern in BillsBasement at noware dot com
>>>>>
>>>>
>>>>
>>>>
>>>> --
>>>> Gabriel Santiago
>>>>
>>>>
>>>> ~"As long as I live so long do I learn"~
>>>> Ramakhrishna
>>>>
>>>
>>>
>>>
>>> --
>>> Unpaid intern in BillsBasement at noware dot com
>>>
>>
>>
>>
>> --
>> Gabriel Santiago
>>
>> ~"As long as I live so long do I learn"~
>> Ramakhrishna
>>
>
>
>
> --
> Unpaid intern in BillsBasement at noware dot com
>
>
> _______________________________________________
> 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://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-developers
>



-- 
Cory Quammen
Research Associate
Department of Computer Science
The University of North Carolina at Chapel Hill


More information about the Insight-developers mailing list