I am trying to get a version of the example surface extraction code running.  I had problems with the CMakeLists.txt file, but that has been resolved.  My problem now is that I am getting a segmentation fault at the line "meshSource->Update()".  I tried using .ima files, and .dcm files located in the same directory
as my .cxx and CMakeLists files.  I added a try/catch block around this line as Luis suggested and re-built the example, but the program still faults out at that location.  I am running the executable with the
command &quot;SurfaceExtraction CT0001.dcm 400&quot;.&nbsp; <br><br>The relevant .cxx file code is as follows:<br><br>//Surface Extraction code modified from ITK Surface Extraction Example included in ITK build<br>#if defined(_MSC_VER)
<br>#pragma warning ( disable : 4786 )<br>#endif<br><br>#ifdef __BORLANDC__<br>#define ITK_LEAN_AND_MEAN<br>#endif<br><br>#include &quot;itkImageFileReader.h&quot;<br>#include &quot;itkBinaryMask3DMeshSource.h&quot;<br>#include &quot;
itkImage.h&quot;<br>#include &quot;itkMesh.h&quot;<br>#include &lt;iostream&gt;<br>using namespace std;<br><br>int main(int argc, char * argv[] ) <br>{<br><br>&nbsp; if( argc &lt; 3 )<br>&nbsp;&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp; std::cerr &lt;&lt; &quot;Usage: IsoSurfaceExtraction&nbsp; inputImageFile&nbsp;&nbsp; objectValue &quot; &lt;&lt; std::endl;
<br>&nbsp;&nbsp;&nbsp; return EXIT_FAILURE;<br>&nbsp;&nbsp;&nbsp; }<br><br>&nbsp; const unsigned int Dimension = 3;<br>&nbsp; typedef unsigned char&nbsp; PixelType;<br><br>&nbsp; typedef itk::Image&lt; PixelType, Dimension &gt;&nbsp;&nbsp; ImageType;<br>&nbsp; typedef itk::ImageFileReader&lt; ImageType &gt;&nbsp;&nbsp;&nbsp; ReaderType;
<br>&nbsp; ReaderType::Pointer reader = ReaderType::New();<br>&nbsp; reader-&gt;SetFileName( argv[1] );<br><br>&nbsp; try<br>&nbsp;&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp; reader-&gt;Update();<br>&nbsp;&nbsp;&nbsp; }<br>&nbsp; catch( itk::ExceptionObject &amp; exp )<br>&nbsp;&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp; std::cerr &lt;&lt; &quot;Exception thrown while reading the input file &quot; &lt;&lt; std::endl;
<br>&nbsp;&nbsp;&nbsp; std::cerr &lt;&lt; exp &lt;&lt; std::endl;<br>&nbsp;&nbsp;&nbsp; return EXIT_FAILURE;<br>&nbsp;&nbsp;&nbsp; }<br><br>&nbsp; typedef itk::Mesh&lt;double&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; MeshType;<br>&nbsp; typedef itk::BinaryMask3DMeshSource&lt; ImageType, MeshType &gt;&nbsp;&nbsp; MeshSourceType;
<br>&nbsp; MeshSourceType::Pointer meshSource = MeshSourceType::New();<br><br>&nbsp; const PixelType objectValue = static_cast&lt;PixelType&gt;( atof( argv[2] ) );<br><br>&nbsp; meshSource-&gt;SetObjectValue( objectValue );<br><br>&nbsp;&nbsp;&nbsp; cout &lt;&lt; &quot;Before meshSource input set.&quot; &lt;&lt; endl;
<br>&nbsp;&nbsp;&nbsp; try<br>&nbsp; &nbsp;&nbsp;&nbsp; {<br>&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; meshSource-&gt;SetInput( reader-&gt;GetOutput() );<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }<br>&nbsp; &nbsp;&nbsp;&nbsp; catch( itk::ExceptionObject &amp; exp )<br>&nbsp; &nbsp;&nbsp;&nbsp; {<br>&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;std::cerr &lt;&lt; &quot;Exception thrown during setting mesh input() &quot; &lt;&lt; std::endl;
<br>&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;std::cerr &lt;&lt; exp &lt;&lt; std::endl;<br>&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;return EXIT_FAILURE;<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }<br><br>&nbsp;&nbsp;&nbsp; cout &lt;&lt; &quot;Before meshSource update&quot; &lt;&lt; endl;<br>&nbsp; try<br>&nbsp;&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp; meshSource-&gt;Update();&nbsp; //--------------------------SEGMENTATION FAULT HERE--------------------------------------------
<br>&nbsp;&nbsp;&nbsp; }<br>&nbsp; catch( itk::ExceptionObject &amp; exp )<br>&nbsp;&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp; cerr &lt;&lt; &quot;Exception thrown during Update() &quot; &lt;&lt; std::endl;<br>&nbsp;&nbsp;&nbsp; cerr &lt;&lt; exp &lt;&lt; std::endl;<br>&nbsp;&nbsp;&nbsp; return EXIT_FAILURE;
<br>&nbsp;&nbsp;&nbsp; }<br><br>&nbsp; cout &lt;&lt; &quot;Nodes = &quot; &lt;&lt; meshSource-&gt;GetNumberOfNodes() &lt;&lt; std::endl;<br>&nbsp; cout &lt;&lt; &quot;Cells = &quot; &lt;&lt; meshSource-&gt;GetNumberOfCells() &lt;&lt; std::endl;<br>
<br>&nbsp; return EXIT_SUCCESS;<br>}<br><br>Does anyone have any suggestions?<br><br>Thanks,<br>Catherine<br><br>