<html><head><style type="text/css"><!-- DIV {margin:0px;} --></style></head><body><div style="font-family:times new roman, new york, times, serif;font-size:12pt"><DIV>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. 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; <FONT color=#2b91af size=2><FONT color=#2b91af size=2>
<P>itkImage_SS3 <FONT color=#000000 size=3>and</FONT> </FONT></FONT><FONT color=#2b91af size=2><FONT color=#2b91af size=2>itkImageToVTKImageFilter_ISS3,<FONT color=#000000> I get the error</FONT> : </FONT></FONT></P>
<P><FONT color=#2b91af size=2><FONT color=#2b91af size=2></FONT></FONT> </P>
<P><FONT size=2><FONT color=#000000 size=2><STRONG>ERROR: In m:\dev\cur\vtkdotnet\branch\50\Rendering\vtkImageActor.cxx, line 182<BR>vtkOpenGLImageActor (064064D8): This filter requires unsigned char scalars as input</STRONG></FONT></FONT></P>
<P><STRONG><FONT size=2></FONT></STRONG> </P>
<P><STRONG><FONT size=2></FONT></STRONG> </P>
<P><STRONG><FONT size=2></FONT></STRONG> </P><STRONG><FONT size=2>
<P><FONT size=2><FONT size=2><FONT>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?</FONT></FONT></FONT></P>
<P><FONT size=2><FONT size=2></FONT></FONT> </P>
<P><FONT size=2><FONT size=2>Thank you and here's the code (in visual c#):</FONT></FONT></P>
<P><FONT size=2><FONT size=2></FONT></FONT> </P>
<P> </P><FONT size=2>
<P></FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2></FONT></FONT> </P><FONT color=#0000ff size=2><FONT color=#0000ff size=2><FONT size=2>
<P></FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>class</FONT></FONT><FONT size=2> </FONT><FONT color=#2b91af size=2><FONT color=#2b91af size=2>HSImage</FONT></FONT><FONT size=2> </P>
<P>{</P>
<P></FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>private</FONT></FONT><FONT size=2> </FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>string</FONT></FONT><FONT size=2> ID; </FONT><FONT color=#008000 size=2><FONT color=#008000 size=2>// name of the object not set yet</P></FONT></FONT><FONT size=2>
<P></FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>private</FONT></FONT><FONT size=2> </FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>string</FONT></FONT><FONT size=2> imageName;</P>
<P></FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>private</FONT></FONT><FONT size=2> </FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>string</FONT></FONT><FONT size=2> imagePath;</P>
<P></FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>private</FONT></FONT><FONT size=2> </FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>string</FONT></FONT><FONT size=2> imagePathName;</P>
<P></FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>private</FONT></FONT><FONT size=2> </FONT><FONT color=#2b91af size=2><FONT color=#2b91af size=2>itkImageBase</FONT></FONT><FONT size=2> imageBase;</P>
<P></FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>private</FONT></FONT><FONT size=2> </FONT><FONT color=#2b91af size=2><FONT color=#2b91af size=2>itkPixelType</FONT></FONT><FONT size=2> pixelType;</P>
<P></FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>private</FONT></FONT><FONT size=2> </FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>uint</FONT></FONT><FONT size=2> dimension;</P>
<P></FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>private</FONT></FONT><FONT size=2> </FONT><FONT color=#2b91af size=2><FONT color=#2b91af size=2>itkSize</FONT></FONT><FONT size=2> size;</P>
<P></FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>private</FONT></FONT><FONT size=2> </FONT><FONT color=#2b91af size=2><FONT color=#2b91af size=2>itkSpacing</FONT></FONT><FONT size=2> spacing;</P>
<P></FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>private</FONT></FONT><FONT size=2> </FONT><FONT color=#2b91af size=2><FONT color=#2b91af size=2>itkPoint</FONT></FONT><FONT size=2> origin;</FONT></P>
<P><FONT size=2> </P>
<P></FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>public</FONT></FONT><FONT size=2> HSImage(</FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>string</FONT></FONT><FONT size=2> imagePathName)</P>
<P>{</P>
<P>setImagePathName(imagePathName);</P>
<P>setImageName(extractImageName(imagePathName));</P>
<P>setImagePath(extractImagePath(imagePathName));</P>
<P>setImagebase(imagePath);</P>
<P>setImageInfo(imagePath);</P>
<P>}</P>
<P></FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>public</FONT></FONT><FONT size=2> </FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>void</FONT></FONT><FONT size=2> setImageName(</FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>string</FONT></FONT><FONT size=2> imageName)</P>
<P>{</P>
<P></FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>this</FONT></FONT><FONT size=2>.imageName = imageName;</P>
<P>}</P>
<P></FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>public</FONT></FONT><FONT size=2> </FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>string</FONT></FONT><FONT size=2> getImageName()</P>
<P>{</P>
<P></FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>return</FONT></FONT><FONT size=2> </FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>this</FONT></FONT><FONT size=2>.imageName;</P>
<P>}</P>
<P></FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>public</FONT></FONT><FONT size=2> </FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>void</FONT></FONT><FONT size=2> setImagePath(</FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>string</FONT></FONT><FONT size=2> imagePath)</P>
<P>{</P>
<P></FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>this</FONT></FONT><FONT size=2>.imagePath = imagePath;</P>
<P>}</P>
<P></FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>public</FONT></FONT><FONT size=2> </FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>string</FONT></FONT><FONT size=2> getImagePath()</P>
<P>{</P>
<P></FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>return</FONT></FONT><FONT size=2> </FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>this</FONT></FONT><FONT size=2>.imagePath;</P>
<P>}</P>
<P></FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>public</FONT></FONT><FONT size=2> </FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>void</FONT></FONT><FONT size=2> setImagePathName(</FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>string</FONT></FONT><FONT size=2> imagePathName)</P>
<P>{</P>
<P></FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>this</FONT></FONT><FONT size=2>.imagePathName = imagePathName;</P>
<P>}</P>
<P></FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>public</FONT></FONT><FONT size=2> </FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>string</FONT></FONT><FONT size=2> getImagePathName()</P>
<P>{</P>
<P></FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>return</FONT></FONT><FONT size=2> </FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>this</FONT></FONT><FONT size=2>.imagePathName;</P>
<P>}</P>
<P> </P></FONT><FONT size=2>
<P></FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>private</FONT></FONT><FONT size=2> </FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>void</FONT></FONT><FONT size=2> setImagebase(</FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>string</FONT></FONT><FONT size=2> imagePath)</P>
<P>{</P>
<P></FONT><FONT color=#008000 size=2><FONT color=#008000 size=2>//this.imageBase = itkImage_UC3.New();</P></FONT></FONT><FONT size=2>
<P></FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>this</FONT></FONT><FONT size=2>.imageBase = </FONT><FONT color=#2b91af size=2><FONT color=#2b91af size=2>itkImage_SS3</FONT></FONT><FONT size=2>.New();</P>
<P></FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>this</FONT></FONT><FONT size=2>.imageBase.Read(imagePathName);</P>
<P>}</P></FONT></FONT></FONT>
<P><FONT color=#0000ff size=2><FONT color=#0000ff size=2></FONT></FONT> </P><FONT size=2><FONT size=2><FONT color=#2b91af size=2><FONT color=#2b91af size=2><FONT size=2>
<P></FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>public</FONT></FONT><FONT size=2> </FONT><FONT color=#2b91af size=2><FONT color=#2b91af size=2>vtkImageActor</FONT></FONT><FONT size=2> convertITKImageToVTKObject()</P>
<P>{</P></FONT></FONT></FONT></FONT></FONT>
<P><FONT size=2><FONT size=2><FONT color=#2b91af size=2><FONT color=#2b91af size=2>vtkImageActor</FONT></FONT><FONT size=2> vtkImageActor1 = </FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>new</FONT></FONT><FONT size=2> </FONT><FONT color=#2b91af size=2><FONT color=#2b91af size=2>vtkImageActor</FONT></FONT><FONT size=2>();</FONT></P>
<P> </P><FONT size=2>
<P></FONT><FONT color=#2b91af size=2><FONT color=#2b91af size=2>itkImageToVTKImageFilter_ISS3</FONT></FONT><FONT size=2> filter = </FONT><FONT color=#2b91af size=2><FONT color=#2b91af size=2>itkImageToVTKImageFilter_ISS3</FONT></FONT><FONT size=2>.New();</P></FONT><FONT size=2><FONT size=2>
<P>filter.SetInput(</FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>this</FONT></FONT><FONT size=2>.getImagebase());</P>
<P>vtkImageActor1.SetInput(filter.GetOutput());</P>
<P></FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>return</FONT></FONT><FONT size=2> (vtkImageActor1);</P></FONT></FONT></FONT></FONT></FONT></STRONG>
<P>}</P>
<P>}</P>
<P> </P>
<P> </P>
<P><FONT size=2><FONT size=2><FONT style="BACKGROUND-COLOR: #000000"></FONT> </P></FONT></FONT></DIV></div><br>
<hr size=1>
Not happy with your email address?
<br> <a href="http://uk.docs.yahoo.com/ymail/new.html"> Get the one you
really want</a> - millions of new email addresses available now at <a
href="http://uk.docs.yahoo.com/ymail/new.html"> Yahoo!</a></body></html>