[Insight-users] ManagedITK + vtkdotnet

Dan Mueller dan.muel at gmail.com
Mon Aug 13 01:01:32 EDT 2007


Hi Dário,

At the moment, itkVTKImageExport is not wrapped in ManagedITK, but you
should still be able to use vtkImageImport to import an image (below
example in C#):

// Read image using ITK
const uint dim = 3;
itk.itkPixelType pixel = itk.itkPixelType.UC;
itk.itkImage input = itk.itkImage.New(pixel, dim);
input.Read("C:/Temp/engine.mhd");

// Import image to VTK
vtk.vtkImageImport import = new vtk.vtkImageImport();
import.SetImportVoidPointer(input.Buffer);
import.SetDataScalarTypeToUnsignedChar();
import.SetNumberOfScalarComponents((int)input.PixelType.NumberOfComponentsPerPixel);
import.SetDataExtent(0, input.Size[0], 0, input.Size[1], 0, input.Size[2]);
import.SetDataSpacing(input.Spacing.Data);
import.SetDataOrigin(input.Origin.Data);
import.Update();

If you need the update requests to be propagated between the ITK and
VTK pipelines, then you will need to wrap itkVTKImageExport. I don't
have the time to do this at the moment, but let me know if you really
need this and I can give you some good pointers for how to get started
with a ManagedITK external project to make it happen.

Hope this helps,

Cheers, Dan

On 13/08/07, Dário Augusto Borges Oliveira <darioaugusto at gmail.com> wrote:
> Hi you all,
>
> I was trying to develop a non-clr library based on ITK, and then wrap it
> into another library to .NET, so as to use itk and vtkdotnet with Windows
> Forms. I haven't succeed yet because I'm having memory access violation
> issues, and I saw the ManagedITK available in Insight-Journal. Does anyone
> know if ManagedITK has support to export images for vtk visualization?
>
> I tried to use the VTKImageExport and VTKImageExportBase in the namespace
> created by ManagedITK dlls, but they don't seen to be functional, I can't
> even create an instance. I read in the article that is possible to work with
> VTK, using a .NET vtk wrapper, but I need to be able to export the itk image
> before.
>
> If they are functional how should I proceed?
>
> Any help will be really great
> Thank you
> --
> Dário Oliveira


More information about the Insight-users mailing list