Hej ;)
Mam problem z wrapperem do C#.
Jeśli to możliwe czy mógłby ktoś looknąć na poniższy kod :
Będę wdzięczna za jakieś uwagi :
Kod builduje się ok - bez błędów, program wywala się przy debugowaniu
**An unhandled exception of type 'System.EntryPointNotFoundException' occurred in WrapperITK.exe
Additional information: W bibliotece DLL 'ProgramITK.dll' nie można znaleźć punktu wejścia o nazwie 'KonwersjaPliku'.**
Nie wiem czym to może być spowodowane, w parametrze opakowanej metody przekazuje typ string (plik wejściowy i wyjściowy)
Kod w C++ :
#include "itkOrientedImage.h"
#include "itkGDCMImageIO.h"
#include "itkGDCMSeriesFileNames.h"
#include "itkImageSeriesReader.h"
#include "itkImageFileWriter.h"
#include "itkCommand.h"
#include "itkImage.h"
#include "itkImageFileReader.h"
#include "itkImageFileWriter.h"
using namespace std;
extern "C"
{
__declspec(dllexport) void __stdcall KonwersjaPliku(std::string plikWE, std::string plikWY)
{
typedef signed short PixelType;
const unsigned int Dimension = 3;
typedef itk::Image< PixelType, Dimension > ImageType;
typedef itk::ImageFileReader< ImageType > ReaderType;
ReaderType::Pointer reader = ReaderType::New();
reader->SetFileName(plikWE);
reader->Update();
std::cout << reader<< std::endl;
// Zapis jako VTK image file
typedef itk::ImageFileWriter<ImageType> WriterType;
WriterType::Pointer writerVTK = WriterType::New();
writerVTK->SetInput(reader->GetOutput());
writerVTK->SetFileName(plikWY);
writerVTK->Update();
}
}
Cod w C# :
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Runtime.InteropServices;
namespace WrapperITK
{
internal static class UnsafeNativeMethods
{
const string dllLocation = "ProgramITK.dll";
[DllImport(dllLocation)]
public static extern void KonwersjaPliku(string plikWE, string plikWY);
}
}
Kod w c# Form1 :
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Runtime.InteropServices;
namespace WrapperITK
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
Run();
}
public static void Run()
{
string plikDCM = "plikDCM.dcm";
string plikVTK = "plikVTK.vtk";
UnsafeNativeMethods.KonwersjaPliku(plikDCM, plikVTK); // tutaj wywala mi się
}
private void Form1_Load(object sender, EventArgs e)
{
}
}
}
Będę wdzięczna za każdą pomoc ;)