Hi Ahmad,

I don't think that you are missing any dependencies. It rather looks to me like incorrect exports for the instantiations of the template method ConvertIplToMitkImage in our OpenCV library (on Windows).

Instead of calling the static function directly, you can try to use the mitk::OpenCVToMitkImageFilter class.

mitk::OpenCVToMitkImageFilter::Pointer openCVToMitkFilter = mitk::OpenCVToMitkImageFilter::New();
openCVToMitkFilter->SetOpenCVImage(img2);
openCVToMitkFilter->Update();
mitk::Image::Pointer image = openCVToMitkFilter->GetOutput();

Best,
Sascha

On 03/14/2013 12:06 PM, Ahmad Ahmadi wrote:
Dear list,

first of all, thanks for the prompt answer!
"My code" is an extension of the project template provided by MITK, (https://github.com/MITK/MITK-ProjectTemplate).

Thanks to your answer, I managed to make my project depend on mitkOpenCVVideoSupport and the header files/classes are found now.
However, when I build my project, I get a linker error:

Error1error LNK2019: unresolved external symbol "public: static class itk::SmartPointer<class mitk::Image> __cdecl mitk::OpenCVToMitkImageFilter::ConvertIplToMitkImage<unsigned char,2>(struct _IplImage const *,bool)" (??$ConvertIplToMitkImage@E$01@OpenCVToMitkImageFilter@mitk@@SA?AV?$SmartPointer@VImage@mitk@@@itk@@PEBU_IplImage@@_N@Z) referenced in function "protected: void __cdeclQmitkTCUSView::loadUSSweep(void)" (?loadUSSweep@QmitkTCUSView@@IEAAXXZ)F:\Developer\apps\TCUSProject_MITK\TCUSProject-superbuild\TCUSProject-build\Plugins\my.tcusproject.tcusplugin\QmitkTCUSView.obj

When I checked the project settings for myPlugin though, it seems that the correct .lib file is already in the list of "Additional Dependencies" (with absolute path!):
F:\Developer\MITK-superbuild\MITK-build\bin\Debug\mitkOpenCVVideoSupport.lib

I am calling the static function from my code in the following way:

// myPlugin.cpp
#include <mitkOpenCVToMitkImageFilter.h>
[...]
void myPlugin::loadCVImage()
{
IplImage* img2 = cvLoadImage("f:\\tmp\\gray640x480_1channel_uchar.bmp",1); mitk::Image::Pointer image = mitk::OpenCVToMitkImageFilter::ConvertIplToMitkImage<uchar,2>( img2 );
}

Am I missing the correct link to some other .lib file?

Thanks in advance!
Cheers,
Ahmad



On Tue, Mar 12, 2013 at 4:38 PM, Sascha Zelzer <[email protected] <mailto:[email protected]>> wrote:

    Hi,

    welcome to MITK!

    When you say "my code", are you reffering to a MITK Modules
    (shared library) similar to the ones found in the MITK source code
    under the "Modules" directory?

    If yes, you need to state your module dependencies explicitly in
    the MITK_CREATE_MODULE macro call in your modules CMakeLists.txt
    file. In the case of a OpenCV module dependency, the macro call in
    your CMakeLists.txt would look something like this:

    MITK_CREATE_MODULE(MyModule DEPENDS mitkOpenCVVideoSupport)

    Best,
    Sascha



    On 03/12/2013 04:30 PM, Ahmad Ahmadi wrote:

        Dear list,

        I'm new to MITK and to CMake as well, so I have a very basic
        question.
        I am trying to use certain modules / plugins in my code, but I
        have problems figuring out how to use CMake to include the
        correct modules into my project.
        Two concrete examples:

        1.)
        I would like to use functionality from the
        mitk::OpenCVToMitkImageFilter class. However, when I include
        the following header:
        #include <mitkOpenCVToMitkImageFilter.h>
        it cannot be found by my IDE (VS2010), because it is not in
        the path.
        Consequently the OpenCVToMitkImageFilter class does not appear
        in the mitk namespace.

        2.)
        Later in my project, I am planning to use the
        "mitkTrackedBscanData" class, since I work with ultrasound
        images. However, the following header can also not be found:
        #include <mitkTrackedBscanData.h>
        and the class is also not in my namespace.

        In the MITK build instructions, there are only instructions on
        how to configure CMake to offer general OpenCV support. Also,
        there is a checkbox to build all plugins. But this apparently
        does not suffice to have access to specific modules as in the
        two examples above.

        Thanks in advance for your help!

        Cheers,
        A.Ahmadi




------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_d2d_mar
_______________________________________________
mitk-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mitk-users

Reply via email to