<DIV>Can anyone tell me what's wrong with the code? It gave me a black output image&nbsp;file. I try reading a dicom file and output a "png" file. </DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp; typedef unsigned char InternalPixelType;<BR>&nbsp; typedef float&nbsp;&nbsp;&nbsp;floatPixelType;<BR>&nbsp; const&nbsp;&nbsp;&nbsp;&nbsp; unsigned int&nbsp;&nbsp;&nbsp; Dimension = 2;<BR>&nbsp;<BR>&nbsp; typedef itk::Image&lt; InternalPixelType, Dimension &gt;&nbsp; InternalImageType;<BR>&nbsp; typedef unsigned char OutputPixelType;<BR>&nbsp; typedef itk::Image&lt; OutputPixelType, Dimension &gt;&nbsp;&nbsp;&nbsp; OutputImageType;<BR>&nbsp; typedef itk::Image&lt;floatPixelType, Dimension &gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; floatImageType;&nbsp;&nbsp; </DIV>
<DIV>&nbsp; typedef itk::CastImageFilter&lt; InternalImageType, floatImageType &gt; CastingToFloatType;<BR>&nbsp; CastingToFloatType::Pointer caster = CastingToFloatType::New();<BR>&nbsp; typedef itk::CastImageFilter&lt;floatImageType, OutputImageType&gt; CastingToCharType;<BR>&nbsp; CastingToCharType::Pointer caster2 = CastingToCharType::New();</DIV>
<DIV><BR>&nbsp; typedef&nbsp; itk::ImageFileReader&lt; InternalImageType &gt; ReaderType;<BR>&nbsp; typedef&nbsp; itk::ImageFileWriter&lt;&nbsp; OutputImageType&nbsp; &gt; WriterType;</DIV>
<DIV>&nbsp; ReaderType::Pointer reader = ReaderType::New();<BR>&nbsp; WriterType::Pointer writer = WriterType::New();<BR>&nbsp; reader-&gt;SetFileName( argv[1] );<BR>&nbsp; writer-&gt;SetFileName( argv[2] );</DIV>
<DIV><BR>&nbsp; typedef itk::CurvatureFlowImageFilter&lt; floatImageType, floatImageType &gt; CurvatureFlowImageFilterType;<BR>&nbsp; CurvatureFlowImageFilterType::Pointer smoothing = <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; CurvatureFlowImageFilterType::New();</DIV>
<DIV>&nbsp; typedef itk::ConnectedThresholdImageFilter&lt; floatImageType, floatImageType &gt; ConnectedFilterType;<BR>&nbsp; ConnectedFilterType::Pointer connectedThreshold = ConnectedFilterType::New();</DIV>
<DIV>&nbsp; caster-&gt;SetInput( reader-&gt;GetOutput() );<BR>&nbsp; smoothing-&gt;SetInput( caster-&gt;GetOutput() );<BR>&nbsp; connectedThreshold-&gt;SetInput( smoothing-&gt;GetOutput() );<BR>&nbsp; caster2-&gt;SetInput( connectedThreshold-&gt;GetOutput() );<BR>&nbsp; writer-&gt;SetInput( caster2-&gt;GetOutput() );</DIV>
<DIV>&nbsp; smoothing-&gt;SetNumberOfIterations( 5 );<BR>&nbsp; smoothing-&gt;SetTimeStep( 0.125 );</DIV>
<DIV>&nbsp; const InternalPixelType lowerThreshold = atof( argv[5] );<BR>&nbsp; const InternalPixelType upperThreshold = atof( argv[6] );</DIV>
<DIV>&nbsp; <BR>&nbsp; connectedThreshold-&gt;SetLower(&nbsp; lowerThreshold&nbsp; );<BR>&nbsp; connectedThreshold-&gt;SetUpper(&nbsp; upperThreshold&nbsp; );</DIV>
<DIV><BR>&nbsp; connectedThreshold-&gt;SetReplaceValue( 255 );</DIV>
<DIV>&nbsp; InternalImageType::IndexType&nbsp; index;<BR>&nbsp; <BR>&nbsp; index[0] = atoi( argv[3] );<BR>&nbsp; index[1] = atoi( argv[4] );</DIV>
<DIV><BR>&nbsp; connectedThreshold-&gt;SetSeed( index );</DIV>
<DIV>&nbsp; try<BR>&nbsp;&nbsp;&nbsp; {<BR>&nbsp;&nbsp;&nbsp; writer-&gt;Update();<BR>&nbsp;&nbsp;&nbsp; }<BR>&nbsp; catch( itk::ExceptionObject &amp; excep )<BR>&nbsp;&nbsp;&nbsp; {<BR>&nbsp;&nbsp;&nbsp; std::cerr &lt;&lt; "Exception caught !" &lt;&lt; std::endl;<BR>&nbsp;&nbsp;&nbsp; std::cerr &lt;&lt; excep &lt;&lt; std::endl;<BR>&nbsp;&nbsp;&nbsp; }<BR>&nbsp; <BR>&nbsp;</DIV>
<DIV>&nbsp; return 0;<BR>}<BR></DIV><p><br><hr size=1>Post your free ad now! <a href="http://ca.personals.yahoo.com/"><b>Yahoo! Canada Personals</b></a><br>