[Insight-users] Converting itk::Image<float, 2> to itk::Image<VectorPixelType, 2>

Carlos Cardenas caedcasa at hotmail.com
Thu, 11 Mar 2004 04:41:53 +0000


<html><div style='background-color:'><DIV class=RTE>Hi everyone,</DIV>
<DIV class=RTE>&nbsp;</DIV>
<DIV class=RTE>&nbsp;&nbsp;&nbsp; I was trying to find a solution for my problem looking into the old emails sendet to the mailinglist but I did not find a solution. I am trying to convert an itk::Image&lt;float, 2&gt; into a vector image.</DIV>
<DIV class=RTE>I used the class ScalarToArrayCastImageFilter without success. I can compile my program and also link it without problem. My program crashes when it comes to the part where the image has to be converted. &nbsp;Could anybody tell me what I am doing wrong and how I can convert my image into a vector image so that I can use the VectorGradientAnisotropicDiffusionImageFilter.</DIV>
<DIV class=RTE>&nbsp;</DIV>
<DIV class=RTE>&nbsp;&nbsp;&nbsp; Part of the source code below:</DIV>
<DIV class=RTE>&nbsp;</DIV>
<DIV class=RTE>&nbsp;typedef itk::Image&lt;float, 2&gt;ImageTypeFloat2D;<BR>&nbsp;typedef itk::Vector&lt;float, 3&gt; VectorPixelType;<BR>&nbsp;typedef itk::Image&lt;VectorPixelType, 2&gt; VectorImageType;</DIV>
<DIV class=RTE><BR>&nbsp;typedef itk::ScalarToArrayCastImageFilter&lt;ImageTypeFloat2D, VectorImageType&gt;&nbsp; CastFilterTypeToVector;<BR>&nbsp; CastFilterTypeToVector::Pointer casterToVector = CastFilterTypeToVector::New();<BR>&nbsp; casterToVector-&gt;SetInput(filterSlice-&gt;GetOutput());<BR>&nbsp; casterToVector-&gt;Update(); // my program says good bye at this point</DIV>
<DIV class=RTE>&nbsp;</DIV>
<DIV class=RTE>&nbsp; typedef itk::VectorGradientAnisotropicDiffusionImageFilter&lt;VectorImageType, VectorImageType&gt; FilterType;<BR>&nbsp;&nbsp; FilterType::Pointer filter = FilterType::New();</DIV>
<DIV class=RTE>&nbsp;</DIV>
<DIV class=RTE>Thank you in advance for any help,</DIV>
<DIV class=RTE>&nbsp;</DIV>
<DIV class=RTE>Carlos<BR>&nbsp;</DIV></div><br clear=all><hr>Lieblingssong auf’s Handy laden oder Display aufpeppen – bei MSN gibt’s jetzt auch polyphone Klingeltöne & farbige Logos! <a href="http://g.msn.com/8HMBDEDE/2740??PS=">Hier klicken</a> </html>