[Insight-users] Problem Wrapper ITK to C#

agatte wiatrak11 at poczta.onet.pl
Tue Apr 10 05:38:56 EDT 2012


Hi All Users ;)


I have a problem with wrapper  to c# .
I have already created method in ITK. 
It goes good. Program in C3 build good but I can't debug this project.
Could anyone look at my code ?
I would appreciate for any help.

During debuging I received a message :

An unhandled exception of type 'System.EntryPointNotFoundException' occurred
in WrapperITK.exe




Code in ITK (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; 

        // read dcm file
	ReaderType::Pointer reader = ReaderType::New();
	reader->SetFileName(plikWE);
	reader->Update(); 
	std::cout << reader<< std::endl;

       // Save  VTK image file
       typedef itk::ImageFileWriter<ImageType> WriterType;
       WriterType::Pointer writerVTK = WriterType::New();
       writerVTK->SetInput(reader->GetOutput());
       writerVTK->SetFileName(plikWY);
       writerVTK->Update();


}
}


Code in 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);

    }
}


Code in 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);
        }

        private void Form1_Load(object sender, EventArgs e)
        {

        }

      
    }
}

I would appreciate for any help ;)
-- 
View this message in context: http://old.nabble.com/Problem-Wrapper-ITK--to-C--tp33660249p33660249.html
Sent from the ITK - Users mailing list archive at Nabble.com.



More information about the Insight-users mailing list