[Insight-users] managedITK, converting itkImage to vtkImage

Dan Mueller dan.muel at gmail.com
Mon Jul 7 12:29:39 EDT 2008


Hi Shady,

2008/7/7 Shady Shidfar <shady_shidfar at yahoo.com>:
> Hi Dan, Thankyou so much for your quick reply. I'm trying to compile
> managedITK3.6.0.2. after applying the patches, in Common\CMakeLists.txt
> there are 2 lines of itkNumericTraitsRGBAPixel.cxx and no
> itkNumericTraitsRGBPixel.cxx. I just wanted to make sure if
> itkNumericTraitsRGBPixel.cxx is not needed.

The instructions in Patch/Readme.txt say the following:

1. Download the patch program from http://gnuwin32.sourceforge.net/
(click Packages, then Patch)
2. Add patch to your PATH environment variable (eg.
PATH=%PATH%;C:/Utils/GnuWin32/bin)
3. Apply each patch in this directory to your ITK source
4. Copy all header (*.h) and source (*.cxx,*.txx) files to the ITK Common folder

Make sure you follow these four steps (don't forget the last step,
copying itkNumericTraitsRGBAPixel.h and itkNumericTraitsRGBAPixel.cxx
to your {ITK_DIR}/Common directory). itkNumericTraitsRGBPixel should
already be in your {ITK_DIR}/Common directory.

On a side note: I have submitted itkNumericTraitsRGBAPixel.h/.cxx to
the Insight Journal. Hopefully these files will be included in the
release version of ITK soon...

I hope this answers your question.

> ----- Original Message ----
> From: Dan Mueller <dan.muel at gmail.com>
> To: Shady Shidfar <shady_shidfar at yahoo.com>
> Cc: insight users <insight-users at itk.org>
> Sent: Thursday, 3 July, 2008 6:44:45 PM
> Subject: Re: [Insight-users] managedITK, converting itkImage to vtkImage
>
> Hi Shady,
>
> My responses inline below.
>
> 2008/7/3 Shady Shidfar <shady_shidfar at yahoo.com>:
>> Hi everyone, I need help with managedITK(ITK .net). I've just started
>> using
>> managedITK instead of using ITK, c++ and FLTK and it's very very cool. I
>> hope I won't need to go back to FLTK anymore.
>
> I'm glad it's helpful. I too find Windows Forms development much
> easier (at the expense of cross platform support). Perhaps you could
> leave a review at the Insight Journal:
>
> http://www.insight-journal.org/InsightJournalManager/view_reviews.php?pubid=151
>
> You may also be interested to know I recently uploaded a new version
> (3.6.0.2). It includes a number of important changes, so you may want
> to check it out before you get too far. The Insight Journal submission
> system can't handle large files, so I've only uploaded the source for
> this version (I may have to consider moving to Google Code or
> Sourceforge to make the pre-compiled assemblies available).
>
>> Anyway I'm trying to read an
>> image , create an itkImage, export it to VTK and then view it.
>> Everything's
>> fine when I have a unsigned char itkImage (itkImage_UC3)  and accordingly
>> itkImageToVTKImageFilter_IUC3 but when I change the image and filter into
>> signed type;
>>
>> itkImage_SS3 and
>>
>> itkImageToVTKImageFilter_ISS3, I get the error :
>>
>>
>>
>> ERROR: In m:\dev\cur\vtkdotnet\branch\50\Rendering\vtkImageActor.cxx, line
>> 182
>> vtkOpenGLImageActor (064064D8): This filter requires unsigned char scalars
>> as input
>>
>> Does anyone know what's the problem and how can I have a unsigned image
>> and
>> convert it to vtkImage using ManagedITK and VTK.net ofcourse?
>
> I can't reproduce your problem. Can you please provide a minimal
> example? Here is the minimal example I was trying:
>
> using System;
> using itk;
> using vtk;
>
> namespace ItkVtkTest
> {
>     static class ItkVtkTest
>     {
>         [STAThread]
>         static void Main()
>         {
>             try
>             {
>                 //  Read ITK image
>                 itkImage_SS3 input = itkImage_SS3.New();
>                 input.Read("D:/Temp/engine.mhd");
>                 input.DisconnectPipeline();
>
>                 // Import ITK image to VTK
>                 itkImageToVTKImageFilter itk2vtk =
>                     itkImageToVTKImageFilter.New(input);
>                 itk2vtk.SetInput(input);
>                 itk2vtk.Update();
>                 vtkImageData data = itk2vtk.GetOutput();
>
>                 vtkImageActor actor = new vtkImageActor();
>                 actor.SetInput(data);
>                 Console.WriteLine(actor.ToString());
>
>                 // Clean up
>                 actor.Dispose();
>                 itk2vtk.Dispose();
>                 input.Dispose();
>             }
>             catch (Exception ex)
>             {
>                 Console.WriteLine(ex);
>             }
>         }
>     }
> }


More information about the Insight-users mailing list