Hello, <br><br>I am using visual stoudio 2010 and cmake. I am trying to 
run the &quot;DeformableModel1.cxx&quot;. But when I run it from the command line 
window my .exe program stop working, while it is trying to dodeformable 
mesh fitting.In this message I include the code. Could someone help me with this problem?<br>
<br>Thanks in advance<br><br><br>///////// code////// <br><br><br>#include &lt;iostream&gt;<br><br>#include &quot;itkDeformableMesh3DFilter.h&quot;<br><br>#include &quot;<div id=":10y">itkGradientRecursiveGaussianImageFilter.h&quot;<br>

#include &quot;itkGradientMagnitudeRecursiveGaussianImageFilter.h&quot;<br><br>#include &quot;itkImage.h&quot;<br>#include &quot;itkMesh.h&quot;<br><br><br>#include &quot;itkCovariantVector.h&quot;<br><br>#include &quot;itkPointSetToImageFilter.h&quot;<br>

<br>#include &quot;itkImageFileReader.h&quot;<br>#include &quot;itkImageFileWriter.h&quot;<br><br>int main( int argc, char *argv[] )<br>{<br><br>  if( argc &lt; 4 )<br>    {<br>    std::cerr &lt;&lt; &quot;Missing Parameters &quot; &lt;&lt; std::endl;<br>

    std::cerr &lt;&lt; &quot;Usage: &quot; &lt;&lt; argv[0];<br>    std::cerr &lt;&lt; &quot; InputImage  BinaryImage DeformedMaskImage&quot; &lt;&lt; std::endl;<br>    return 1;<br>    }<br> <br><br> <br>  const     unsigned int    Dimension = 3;<br>

  typedef   double                         PixelType;<br>  typedef itk::Image&lt;PixelType, Dimension&gt; ImageType;<br><br>  typedef itk::Image&lt; unsigned char, Dimension &gt;   BinaryImageType;<br> <br>  typedef  itk::Mesh&lt;double&gt;     MeshType;<br>

 <br>  typedef itk::CovariantVector&lt; double, Dimension &gt;  GradientPixelType;<br>  typedef itk::Image&lt; GradientPixelType, Dimension &gt; GradientImageType;<br> <br>  typedef itk::GradientRecursiveGaussianImageFilter&lt;ImageType, GradientImageType&gt;<br>

    GradientFilterType;<br>  typedef itk::GradientMagnitudeRecursiveGaussianImageFilter&lt;ImageType,ImageType&gt;<br>    GradientMagnitudeFilterType;<br> <br><br>  typedef itk::BinaryMask3DMeshSource&lt; BinaryImageType, MeshType &gt;  MeshSourceType;<br>

  <br><br>  typedef itk::DeformableMesh3DFilter&lt;MeshType,MeshType&gt;  DeformableFilterType;<br> <br>  typedef itk::ImageFileReader&lt; ImageType       &gt;  ReaderType;<br>  typedef itk::ImageFileReader&lt; BinaryImageType &gt;  BinaryReaderType;<br>

  ReaderType::Pointer       imageReader   =  ReaderType::New();<br>  BinaryReaderType::Pointer maskReader    =  BinaryReaderType::New();<br> <br>  imageReader-&gt;SetFileName( argv[1] );<br>  maskReader-&gt;SetFileName(  argv[2] );<br>

 <br><br>  GradientMagnitudeFilterType::Pointer  gradientMagnitudeFilter<br>                                          = GradientMagnitudeFilterType::New();<br><br>  gradientMagnitudeFilter-&gt;SetInput( imageReader-&gt;GetOutput() ); <br>

  gradientMagnitudeFilter-&gt;SetSigma( 1.0 );<br> <br>  GradientFilterType::Pointer gradientMapFilter = GradientFilterType::New();<br> <br>  gradientMapFilter-&gt;SetInput( gradientMagnitudeFilter-&gt;GetOutput());<br>  gradientMapFilter-&gt;SetSigma( 1.0 );<br>

 <br><br>  try<br>    {<br> <br>    gradientMapFilter-&gt;Update();<br><br>    }<br>  catch( itk::ExceptionObject &amp; e )<br>    {<br>    std::cerr &lt;&lt; &quot;Exception caught when updating gradientMapFilter &quot; &lt;&lt; std::endl;<br>

    std::cerr &lt;&lt; e &lt;&lt; std::endl;<br>    return -1;<br>    }<br> <br><br><br>  std::cout &lt;&lt; &quot;The gradient map created!&quot; &lt;&lt; std::endl;<br><br><br>  MeshSourceType::Pointer meshSource = MeshSourceType::New();<br>

  <br><br>  DeformableFilterType::Pointer deformableModelFilter = <br>                                     DeformableFilterType::New();<br>  deformableModelFilter-&gt;SetGradient( gradientMapFilter-&gt;GetOutput() );<br>
 <br>
  BinaryImageType::Pointer mask = maskReader-&gt;GetOutput();<br>  meshSource-&gt;SetInput( mask );<br>  meshSource-&gt;SetObjectValue( 200 );<br><br>  std::cout &lt;&lt; &quot;Creating mesh...&quot; &lt;&lt; std::endl;<br>

  try <br>    {<br>    meshSource-&gt;Update();<br>    }<br>  catch( itk::ExceptionObject &amp; excep )<br>    {<br>    std::cerr &lt;&lt; &quot;Exception Caught !&quot; &lt;&lt; std::endl;<br>    std::cerr &lt;&lt; excep &lt;&lt; std::endl;<br>

    }<br><br>  deformableModelFilter-&gt;SetInput(  meshSource-&gt;GetOutput() );<br> <br><br>  meshSource-&gt;GetOutput()-&gt;Print(std::cout);<br><br>  std::cout &lt;&lt; &quot;Deformable mesh created using Marching Cube!&quot; &lt;&lt; std::endl;<br>

<br><br>  typedef itk::CovariantVector&lt;double, 2&gt;           double2DVector;<br>  typedef itk::CovariantVector&lt;double, 3&gt;           double3DVector;<br><br>  double2DVector stiffness;<br>  stiffness[0] = 0.0001;<br>

  stiffness[1] = 0.1;<br><br>  double3DVector scale;<br>  scale[0] = 1.0;<br>  scale[1] = 1.0; <br>  scale[2] = 1.0;<br><br>  deformableModelFilter-&gt;SetStiffness( stiffness );<br>  deformableModelFilter-&gt;SetScale( scale );<br>

 <br>  deformableModelFilter-&gt;SetGradientMagnitude( 0.8 );<br>  deformableModelFilter-&gt;SetTimeStep( 0.01 );<br>  deformableModelFilter-&gt;SetStepThreshold( 60 );<br><br><br>  std::cout &lt;&lt; &quot;Deformable mesh fitting...&quot;;<br>

<br><br>  try <br>    {<br>    deformableModelFilter-&gt;Update();<br>    }<br>  catch( itk::ExceptionObject &amp; excep )<br>    {<br>    std::cerr &lt;&lt; &quot;Exception Caught !&quot; &lt;&lt; std::endl;<br>    std::cerr &lt;&lt; excep &lt;&lt; std::endl;<br>

    }<br> <br><br>  std::cout &lt;&lt; &quot;Mesh Source: &quot; &lt;&lt; meshSource;<br><br> <br>  typedef itk::PointSetToImageFilter&lt;MeshType,ImageType&gt; MeshFilterType;<br>  MeshFilterType::Pointer meshFilter = MeshFilterType::New();<br>

  meshFilter-&gt;SetOrigin(mask-&gt;GetOrigin());<br>  meshFilter-&gt;SetSize(mask-&gt;GetLargestPossibleRegion().GetSize());<br>  meshFilter-&gt;SetSpacing(mask-&gt;GetSpacing());<br>  meshFilter-&gt;SetInput(meshSource-&gt;GetOutput());<br>

  try <br>    {<br>    meshFilter-&gt;Update();<br>    }<br>  catch( itk::ExceptionObject &amp; excep )<br>    {<br>    std::cerr &lt;&lt; &quot;Exception Caught !&quot; &lt;&lt; std::endl;<br>    std::cerr &lt;&lt; excep &lt;&lt; std::endl;<br>

    }<br><br>  typedef itk::ImageFileWriter&lt;ImageType&gt; WriterType;<br>  WriterType::Pointer writer = WriterType::New();<br>  writer-&gt;SetInput(meshFilter-&gt;GetOutput());<br>  writer-&gt;SetFileName(argv[3]);<br>

  writer-&gt;Update();<br><br><br>  return EXIT_SUCCESS;<br>}</div>