[Insight-users] Converting itk::Image<float, 2> to
itk::Image<VectorPixelType, 2>
Carlos Cardenas
caedcasa at hotmail.com
Thu, 11 Mar 2004 16:01:52 +0000
<html><div style='background-color:'><DIV class=RTE>
<P>Hi James,<BR> Thank you for your help. Actually I want to use vector images because I want to apply some other filters like VectorGradientMagnitudeImageFilter. The part of source code you sent with your suggestion is the way I am trying to convert the image (see below), but the program crashes when it comes to convert the image. <BR>> <BR>> typedef itk::Image<float, 2> ImageTypeFloat2D;<BR>> typedef itk::Vector<float, 3> VectorPixelType;<BR>> typedef itk::Image<VectorPixelType, 2> VectorImageType;<BR>> typedef itk::ScalarToArrayCastImageFilter<ImageTypeFloat2D, VectorImageType> CastFilterTypeToVector;<BR>> CastFilterTypeToVector::Pointer casterToVector = CastFilterTypeToVector::New();<BR>> casterToVector->SetInput(imageFloat2D);<BR>> casterToVector->Update(); // my program says good bye at this point!!!!!<BR><BR>Do you see anything different? Is it because the input image is <float, 2>?</P>
<P>Thank you again for your help,</P>
<P>Best regards,</P>
<P>Carlos</P>
<P><BR><BR> </P></DIV>
<DIV></DIV>>From: "Miller, James V (Research)" <MILLERJV at CRD.GE.COM>
<DIV></DIV>>To: "'Carlos Cardenas'" <CAEDCASA at HOTMAIL.COM>, insight-users at itk.org
<DIV></DIV>>Subject: RE: [Insight-users] Converting itk::Image<FLOAT, 2> to itk::Image<VECTORPIXELTYPE, 2>
<DIV></DIV>>Date: Thu, 11 Mar 2004 10:39:33 -0500
<DIV></DIV>>
<DIV></DIV>>Carlos,
<DIV></DIV>>
<DIV></DIV>>Can simply use the GradientAnisotropicDiffusionImageFilter on your original
<DIV></DIV>>scalar image?
<DIV></DIV>>
<DIV></DIV>>I am not sure whether the VectorGradientAnisotropicDiffusionImageFilter will
<DIV></DIV>>like processing a vector image where the vector length is one.
<DIV></DIV>>
<DIV></DIV>>If you still need to convert a scalar image to a vector, this is how I have
<DIV></DIV>>done it in the past
<DIV></DIV>>
<DIV></DIV>> typedef itk::ScalarToArrayCastImageFilter<INPUTIMAGETYPE,VECTORIMAGETYPE>
<DIV></DIV>>ScalarToVectorFilterType;
<DIV></DIV>> ScalarToVectorFilterType::Pointer scalarToVector =
<DIV></DIV>>ScalarToVectorFilterType::New();
<DIV></DIV>> scalarToVector->SetInput( reader->GetOutput() );
<DIV></DIV>> scalarToVector->Update();
<DIV></DIV>>
<DIV></DIV>>
<DIV></DIV>>
<DIV></DIV>>-----Original Message-----
<DIV></DIV>>From: Carlos Cardenas [mailto:caedcasa at hotmail.com]
<DIV></DIV>>Sent: Wednesday, March 10, 2004 11:42 PM
<DIV></DIV>>To: insight-users at itk.org
<DIV></DIV>>Subject: [Insight-users] Converting itk::Image<FLOAT, 2> to
<DIV></DIV>>itk::Image<VECTORPIXELTYPE, 2>
<DIV></DIV>>
<DIV></DIV>>
<DIV></DIV>>Hi everyone,
<DIV></DIV>>
<DIV></DIV>> I was trying to find a solution for my problem looking into the old
<DIV></DIV>>emails sendet to the mailinglist but I did not find a solution. I am trying
<DIV></DIV>>to convert an itk::Image<FLOAT, 2> into a vector image.
<DIV></DIV>>I used the class ScalarToArrayCastImageFilter without success. I can compile
<DIV></DIV>>my program and also link it without problem. My program crashes when it
<DIV></DIV>>comes to the part where the image has to be converted. Could anybody tell
<DIV></DIV>>me what I am doing wrong and how I can convert my image into a vector image
<DIV></DIV>>so that I can use the VectorGradientAnisotropicDiffusionImageFilter.
<DIV></DIV>>
<DIV></DIV>> Part of the source code below:
<DIV></DIV>>
<DIV></DIV>> typedef itk::Image<FLOAT, 2>ImageTypeFloat2D;
<DIV></DIV>> typedef itk::Vector<FLOAT, 3> VectorPixelType;
<DIV></DIV>> typedef itk::Image<VECTORPIXELTYPE, 2> VectorImageType;
<DIV></DIV>>
<DIV></DIV>> typedef itk::ScalarToArrayCastImageFilter<IMAGETYPEFLOAT2D, DIV <>>VectorImageType> CastFilterTypeToVector;
<DIV></DIV>> CastFilterTypeToVector::Pointer casterToVector =
<DIV></DIV>>CastFilterTypeToVector::New();
<DIV></DIV>> casterToVector->SetInput(filterSlice->GetOutput());
<DIV></DIV>> casterToVector->Update(); // my program says good bye at this point
<DIV></DIV>>
<DIV></DIV>> typedef
<DIV></DIV>>itk::VectorGradientAnisotropicDiffusionImageFilter<VECTORIMAGETYPE, DIV <>>VectorImageType> FilterType;
<DIV></DIV>> FilterType::Pointer filter = FilterType::New();
<DIV></DIV>>
<DIV></DIV>>Thank you in advance for any help,
<DIV></DIV>>
<DIV></DIV>>Carlos
<DIV></DIV>>
<DIV></DIV>>
<DIV></DIV>> _____
<DIV></DIV>>
<DIV></DIV>>Lieblingssong auf's Handy laden oder Display aufpeppen - bei MSN gibt's
<DIV></DIV>>jetzt auch polyphone Klingeltöne & farbige Logos! Hier klicken
<DIV></DIV>><HTTP: 2740??PS="" 8HMBDEDE g.msn.com>
<DIV></DIV>>_______________________________________________ Insight-users mailing list
<DIV></DIV>>Insight-users at itk.org http://www.itk.org/mailman/listinfo/insight-users
<DIV></DIV>>
<DIV></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>