Hi Stefan,
so the first problem was solved...but then another came.
 
As I was saying earlier Im using the Tutorial Part1 and all I want to change is the way an image is used. Instead of having it in the command argument thingy I want to open an image using QfileDialog which works but its not displaying the image yet.
 
Heres the source code for clarification:
 
MainWindow.cpp
//Construktor Destruktor...
 
void MainWindow::on_openButton_pressed()
{       
    // Create a DataStorage
    mitk::StandaloneDataStorage::Pointer ds = mitk::StandaloneDataStorage::New();
 
    // Create a DataNodeFactory to read a data format supported
    mitk::DataNodeFactory::Pointer reader = mitk::DataNodeFactory::New();
 
    QString imagePath = QFileDialog::getOpenFileName(this,
        "Select one or more files to open",
        "/home",
        "Images (*.DCM)");
    char* filename;
    filename = new char[imagePath.toStdString().size() + 1];
    strcpy(filename, imagePath.toStdString().c_str());
    
    try
    {
        reader->SetFileName(filename);
        reader->Update();
        // Add the node to the DataStorage
        ds->Add(reader->GetOutput());
    }
    catch (...)
    {
        fprintf(stderr, "Could not open file %s \n\n", filename);
        exit(2);
    }
  
    //create render window
    QmitkRenderWindow *scene;

    // Tell the RenderWindow which part of the datastorage to render
    scene->GetRenderer()->SetDataStorage(ds);

    // Initialize the RenderWindow
    mitk::TimeGeometry::Pointer geo = ds->ComputeBoundingGeometry3D(ds->GetAll());
    mitk::RenderingManager::GetInstance()->InitializeViews(geo);
 
    // Select a slice
    mitk::SliceNavigationController::Pointer sliceNaviController = scene->GetSliceNavigationController();
    if (sliceNaviController)
        sliceNaviController->GetSlice()->SetPos(0);
 
    //Show image
    scene->show();
    scene->resize(256, 256);

    ds = NULL;
 
The QmitkRegisterClasses() Funktion is in main.cpp, but causes the following error when not commented out:
error LNK2019: unresolved external symbol "__declspec(dllimport) void __cdecl QmitkRegisterClasses(void)" (__imp_?QmitkRegisterClasses@@YAXXZ) referenced in function main
 
Also, is there a way to have the image show up in a widget of my ui-file (QGraphicsView)? How can they be connected?
 
Thank you in advance
Best regards
Sina
Gesendet: Dienstag, 13. Oktober 2015 um 14:29 Uhr
Von: "Kislinskiy, Stefan" <s.kislins...@dkfz-heidelberg.de>
An: "Sina Gerlach" <sina.gerlac...@gmx.de>
Cc: "mitk-users@lists.sourceforge.net" <mitk-users@lists.sourceforge.net>
Betreff: RE: RE: [mitk-users] error LNK2019: unresolved external symbol

I guess in that case it is the MODULES line at the end. :)
(Please keep the conversation on the list so that others can benefit from it as well, thank you)

 

From: Sina Gerlach [mailto:sina.gerlac...@gmx.de]
Sent: Dienstag, 13. Oktober 2015 14:24
To: Kislinskiy, Stefan
Subject: Aw: RE: [mitk-users] error LNK2019: unresolved external symbol

 

Hi Stefan, 

thanks for the fast response.

I'm not quite sure where to add that mentioned line.

This is what my cmakelists looks like:

 

project(AwesomeApp)

set(_app_options)
if(${MY_PROJECT_NAME}_SHOW_CONSOLE_WINDOW)
  list(APPEND _app_options SHOW_CONSOLE)
endif()

# Plug-ins listed below will not be
#  - added as a build-time dependency to the executable
#  - listed in the provisioning file for the executable
#  - installed if they are external plug-ins

set(_exclude_plugins

)

mitkFunctionCreateBlueBerryApplication(
  NAME ${MY_APP_NAME}
  DESCRIPTION "MITK - ${MY_APP_NAME} Application"
  EXCLUDE_PLUGINS ${_exclude_plugins}
  ${_app_options}
)
mitk_use_modules(TARGET ${MY_APP_NAME}
  MODULES MitkAppUtil
  PACKAGES Qt4|QtGui Qt5|Widgets
)

 

Best 

Sina

Gesendet: Dienstag, 13. Oktober 2015 um 14:00 Uhr
Von: "Kislinskiy, Stefan" <s.kislins...@dkfz-heidelberg.de>
An: "Sina Gerlach" <sina.gerlac...@gmx.de>, "mitk-users@lists.sourceforge.net" <mitk-users@lists.sourceforge.net>
Betreff: RE: [mitk-users] error LNK2019: unresolved external symbol

Hi Sina,

 

it seems that the linker isn’t able to find mitk::DataNodeFactory, which is located in the MitkLegacyIO module. Add MitkLegacyIO to the DEPENDS line of your module CMakeLists.txt.

 

Best,
Stefan

 

From: Sina Gerlach [mailto:sina.gerlac...@gmx.de]
Sent: Dienstag, 13. Oktober 2015 12:27
To: mitk-users@lists.sourceforge.net
Subject: [mitk-users] error LNK2019: unresolved external symbol

 

Hello,

 

I am new to MITK and am trying to use the MITK Tutorial to display an image in my own Qt User Interface.

 

When trying to build my project the following error occurs:

 

7>     Creating library C:/MITK-pt-sb/AwesomeProject-build/bin/Debug/AwesomeApp.lib and object C:/MITK-pt-sb/AwesomeProject-build/bin/Debug/AwesomeApp.exp
7>MainWindow.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: static class itk::SmartPointer<class mitk::DataNodeFactory> __cdecl mitk::DataNodeFactory::New(void)" (__imp_?New@DataNodeFactory@mitk@@SA?AV?$SmartPointer@VDataNodeFactory@mitk@@@itk@@XZ) referenced in function "public: void __cdecl MainWindow::on_openButton_pressed(void)" (?on_openButton_pressed@MainWindow@@QEAAXXZ)

 

 

I know this is a linker problem but I dont know which library to link or what else has to be done to solve this error.

 

I hope anyone can help

 

Best Regards

Sina

------------------------------------------------------------------------------
_______________________________________________
mitk-users mailing list
mitk-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mitk-users

Reply via email to