<div dir="ltr"><div style>I think you are right. The itkImageToVTKImageFilter does not support the matrix pixel type yet.</div><div style><br></div><div style>According to:</div><a href="http://www.itk.org/Doxygen/html/classitk_1_1VTKImageExport.html">http://www.itk.org/Doxygen/html/classitk_1_1VTKImageExport.html</a>, <div>
<div>&quot;<span style="color:rgb(0,0,0);font-family:&#39;Lucida Grande&#39;,Verdana,Geneva,Arial,sans-serif;font-size:12px;line-height:19px">Currently</span><span style="color:rgb(0,0,0);font-family:&#39;Lucida Grande&#39;,Verdana,Geneva,Arial,sans-serif;font-size:12px;line-height:19px"> </span><a class="" href="http://www.itk.org/Doxygen/html/classitk_1_1VTKImageExport.html" title="Connect the end of an ITK image pipeline to a VTK pipeline. " style="font-family:&#39;Lucida Grande&#39;,Verdana,Geneva,Arial,sans-serif;font-size:12px;line-height:19px;color:rgb(70,101,162);font-weight:bold">VTKImageExport</a><span style="color:rgb(0,0,0);font-family:&#39;Lucida Grande&#39;,Verdana,Geneva,Arial,sans-serif;font-size:12px;line-height:19px"> </span><span style="color:rgb(0,0,0);font-family:&#39;Lucida Grande&#39;,Verdana,Geneva,Arial,sans-serif;font-size:12px;line-height:19px">does not support pixel types with multiple components (like</span><span style="color:rgb(0,0,0);font-family:&#39;Lucida Grande&#39;,Verdana,Geneva,Arial,sans-serif;font-size:12px;line-height:19px"> </span><a class="" href="http://www.itk.org/Doxygen/html/classitk_1_1RGBPixel.html" title="Represent Red, Green and Blue components for color images. " style="font-family:&#39;Lucida Grande&#39;,Verdana,Geneva,Arial,sans-serif;font-size:12px;line-height:19px;color:rgb(70,101,162);font-weight:bold">RGBPixel</a><span style="color:rgb(0,0,0);font-family:&#39;Lucida Grande&#39;,Verdana,Geneva,Arial,sans-serif;font-size:12px;line-height:19px">).&quot;</span></div>
<div>and <a href="http://www.itk.org/Doxygen/html/classitk_1_1VTKImageImport.html">http://www.itk.org/Doxygen/html/classitk_1_1VTKImageImport.html</a>:<br></div><div>&quot;The images must have pixel types with one component.&quot;</div>
<div><br></div><div style>I am reading this thread:<a href="http://www.itk.org/pipermail/insight-users/2005-November/015553.html">http://www.itk.org/pipermail/insight-users/2005-November/015553.html</a></div><div style>It is not entirely clear, but it looks like it is worth trying with the itk vector image first. </div>
<div><br></div><div><br></div><dl class="" style="font-size:12px;line-height:19px;font-family:&#39;Lucida Grande&#39;,Verdana,Geneva,Arial,sans-serif;padding:0px;margin-left:0px;color:rgb(0,0,0)"></dl></div></div><div class="gmail_extra">
<br><br><div class="gmail_quote">On Mon, Jul 8, 2013 at 9:48 AM, Lawrence M. Lifshitz <span dir="ltr">&lt;<a href="mailto:Lawrence.Lifshitz@umassmed.edu" target="_blank">Lawrence.Lifshitz@umassmed.edu</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">I am trying to use the itkImageToVTKImageFilter on a itk::Matrix&lt;double,3,3&gt;  3D image type<br>
(as produced when calculating Hessians using itk::<u></u>HessianRecursiveGaussianImageF<u></u>ilter).<br>
It is failing at compile time (I use ITK 4.3 on fedora 16).<br>
<br>
In the past I have written this 3d image type out as a metaimage.mhd file, then read it back into a<br>
vtk based display program which uses vtkTensorGlyphFilter to display a representation of the matrices.<br>
I have templated some types in the itk program as:<br>
  typedef itk::Matrix&lt; double, 3, 3&gt; MatrixType;<br>
  typedef itk::Image&lt; MatrixType, 3 &gt; EigenMatrixImageType;<br>
  typedef itk::ImageFileWriter&lt; EigenMatrixImageType &gt; EigenMatrixWriterType;<br>
And in the vtk display program I use:<br>
  vtkMetaImageReader *reader;<br>
  vtkTensorGlyphFilter *GlyphFilter;<br>
This all works correctly, the image is read as an image of doubles with 9<br>
components (3x3 matrix) for each pixel and is then rendered fine.<br>
<br>
I am now trying to combine the itk and vtk programs so that I can<br>
have interactive control of the itk based production of the hessian matrices<br>
and see the glyphs change as that happens.  So I have tried doing<br>
  typedef itk::ImageToVTKImageFilter&lt;<u></u>EigenMatrixImageType&gt; TensorConnectorType;<br>
  TensorConnectorType::Pointer tensorConnector = TensorConnectorType::New();<br>
But upon an attempt to compile this code the TensorConnectorType::New() line<br>
produces a compile time error message, the guts of which is:<br>
  /usr/local/include/ITK-4.3/<u></u>itkPixelTraits.h: In instantiation of &#39;itk::PixelTraits&lt;itk::Matrix&lt;<u></u>double, 3u, 3u&gt; &gt;&#39;:<br>
  /usr/local/include/ITK-4.3/<u></u>itkPixelTraits.h:49:3: error: &#39;Length&#39; is not a member of &#39;itk::Matrix&lt;double, 3u, 3u&gt;&#39;<br>
The offending code seems to be the line in itkPixelTraits.h:<br>
         /** Dimension of the pixel (range). */<br>
        itkStaticConstMacro(Dimension, unsigned int, TPixelType::Length);<br>
        [note itkMacro.h:  #define itkStaticConstMacro(name, type, value) enum { name = value }<br>
              so this is: enum {Dimension = TPixelType::Length}; or  enum {Dimension = itk::Matrix&lt;double, 3u, 3u&gt;::Length}; ? ]<br>
        ]<br>
<br>
I am thinking that ImageToVTKImageFilter can&#39;t handle an image templated with a Matrix for the pixel type.<br>
Am I correct about this?<br>
If so, what is the easiest way around it?<br>
Can I somehow derive a new class from ImageToVTKImageFilter which wouldn&#39;t have this problem?<br>
Or can I create easily create a new class via another method which would work?<br>
<br>
Thanks.<br>
<br>
-- <br>
Lawrence M. Lifshitz, Ph. D., Associate Professor<br>
Biomedical Imaging Group (<a href="http://big.umassmed.edu" target="_blank">http://big.umassmed.edu</a>)<br>
Program in Molecular Medicine<br>
University of Massachusetts Medical School (<a href="http://www.umassmed.edu" target="_blank">http://www.umassmed.edu</a>)<br>
Phone: <a href="tel:%28508%29%20856-3392" value="+15088563392" target="_blank">(508) 856-3392</a>   email: <a href="mailto:Lawrence.Lifshitz@umassmed.edu" target="_blank">Lawrence.Lifshitz@umassmed.edu</a><br>
Fax:   <a href="tel:%28508%29%20856-1840" value="+15088561840" target="_blank">(508) 856-1840</a>     web: <a href="http://big.umassmed.edu/lml" target="_blank">http://big.umassmed.edu/lml</a><br>
<br>
______________________________<u></u>_______<br>
Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at<br>
<a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/<u></u>opensource/opensource.html</a><br>
<br>
Kitware offers ITK Training Courses, for more information visit:<br>
<a href="http://www.kitware.com/products/protraining.php" target="_blank">http://www.kitware.com/<u></u>products/protraining.php</a><br>
<br>
Please keep messages on-topic and check the ITK FAQ at:<br>
<a href="http://www.itk.org/Wiki/ITK_FAQ" target="_blank">http://www.itk.org/Wiki/ITK_<u></u>FAQ</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://www.itk.org/mailman/listinfo/insight-users" target="_blank">http://www.itk.org/mailman/<u></u>listinfo/insight-users</a><br>
</blockquote></div><br><br clear="all"><div><br></div>-- <br><div><br></div><div><br></div>---------------------------------------------<br><b>Xiaoxiao Liu</b>, Ph.D.<div><div><div><font face="arial, sans-serif"><span style="border-collapse:collapse">R &amp; D Engineer</span></font></div>
<div><div><a href="http://www.kitware.com/" target="_blank">Kitware Inc</a>.</div></div><div><span style="border-collapse:collapse;font-family:arial,sans-serif;font-size:13px">Clifton Park, NY</span><div><div>Phone: (518) 881-4924  or  <span style="border-collapse:collapse;color:rgb(136,136,136);font-family:arial,sans-serif;font-size:13px">(518) 371-3971 x124</span></div>
<div><font face="Verdana, Arial, Helvetica, sans-serif"><span style="line-height:31px;font-size:x-small"><br></span></font></div></div></div></div></div>
</div>