<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<style>
<!--
@font-face
        {font-family:Calibri}
@font-face
        {font-family:Consolas}
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri","sans-serif"}
a:link, span.MsoHyperlink
        {color:blue;
        text-decoration:underline}
a:visited, span.MsoHyperlinkFollowed
        {color:purple;
        text-decoration:underline}
span.EmailStyle17
        {font-family:"Calibri","sans-serif";
        color:windowtext}
.MsoChpDefault
        {font-family:"Calibri","sans-serif"}
@page WordSection1
        {margin:1.0in 1.0in 1.0in 1.0in}
div.WordSection1
        {}
-->
</style>
</head>
<body lang="EN-US" link="blue" vlink="purple">
<div class="WordSection1">
<p class="MsoNormal">Hi,</p>
<p class="MsoNormal"> </p>
<p class="MsoNormal">I get the following errors when I try to run the following code in command window
</p>
<p class="MsoNormal"> </p>
<p class="MsoNormal"> </p>
<p class="MsoNormal"> </p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt; font-family:Consolas; color:blue">#include</span><span style="font-size:9.5pt; font-family:Consolas">
<span style="color:#A31515">"stdafx.h"</span></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt; font-family:Consolas"> </span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt; font-family:Consolas; color:blue">#include</span><span style="font-size:9.5pt; font-family:Consolas">
<span style="color:#A31515">"itkImage.h"</span></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt; font-family:Consolas; color:blue">#include</span><span style="font-size:9.5pt; font-family:Consolas">
<span style="color:#A31515">"itkImageFileReader.h"</span></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt; font-family:Consolas; color:blue">#include</span><span style="font-size:9.5pt; font-family:Consolas">
<span style="color:#A31515">"itkImageFileWriter.h"</span></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt; font-family:Consolas; color:blue">#include</span><span style="font-size:9.5pt; font-family:Consolas">
<span style="color:#A31515">"itkBinaryBallStructuringElement.h"</span></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt; font-family:Consolas; color:blue">#include</span><span style="font-size:9.5pt; font-family:Consolas">
<span style="color:#A31515">"itkBinaryDilateImageFilter.h"</span></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt; font-family:Consolas"> </span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt; font-family:Consolas; color:blue">int</span><span style="font-size:9.5pt; font-family:Consolas"> main(<span style="color:blue">int</span> argc,
<span style="color:blue">char</span> *argv[])</span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt; font-family:Consolas">{</span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt; font-family:Consolas">
<span style="color:blue">if</span>( argc < 4 )</span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt; font-family:Consolas"> {</span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt; font-family:Consolas"> std::cerr <<
<span style="color:#A31515">"Usage: "</span> << std::endl;</span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt; font-family:Consolas"> std::cerr << argv[0] <<
<span style="color:#A31515">" <inputImage> <outputImage> <radius>"</span>;</span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt; font-family:Consolas"> std::cerr << std::endl;</span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt; font-family:Consolas">
<span style="color:blue">return</span> EXIT_FAILURE;</span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt; font-family:Consolas"> }</span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt; font-family:Consolas">
<span style="color:blue">typedef</span> <span style="color:blue">unsigned</span> <span style="color:blue">
char</span> PixelType;</span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt; font-family:Consolas">
<span style="color:blue">const</span> <span style="color:blue">unsigned</span> <span style="color:blue">
int</span> Dimension = 2;</span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt; font-family:Consolas"> </span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt; font-family:Consolas">
<span style="color:blue">typedef</span> itk::Image< PixelType, Dimension > ImageType;</span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt; font-family:Consolas">
<span style="color:blue">typedef</span> itk::ImageFileReader< ImageType > ReaderType;</span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt; font-family:Consolas"> ReaderType::Pointer reader = ReaderType::New();</span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt; font-family:Consolas"> reader->SetFileName( argv[1] );</span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt; font-family:Consolas"> </span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt; font-family:Consolas">
<span style="color:blue">typedef</span> itk::BinaryBallStructuringElement< PixelType, Dimension > StructuringElementType;</span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt; font-family:Consolas"> StructuringElementType structuringElement;</span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt; font-family:Consolas"> structuringElement.SetRadius( atoi( argv[3] ) );</span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt; font-family:Consolas"> structuringElement.CreateStructuringElement();</span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt; font-family:Consolas"> </span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt; font-family:Consolas">
<span style="color:blue">typedef</span> itk::BinaryDilateImageFilter< ImageType, ImageType, StructuringElementType > BinaryDilateImageFilterType;</span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt; font-family:Consolas"> </span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt; font-family:Consolas"> BinaryDilateImageFilterType::Pointer dilateFilter = BinaryDilateImageFilterType::New();</span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt; font-family:Consolas"> dilateFilter->SetInput( reader->GetOutput() );</span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt; font-family:Consolas"> dilateFilter->SetKernel( structuringElement );</span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt; font-family:Consolas"> </span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt; font-family:Consolas">
<span style="color:blue">typedef</span> itk::ImageFileWriter< ImageType > WriterType;</span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt; font-family:Consolas"> WriterType::Pointer writer = WriterType::New();</span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt; font-family:Consolas"> writer->SetInput( dilateFilter->GetOutput() );</span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt; font-family:Consolas"> writer->SetFileName( argv[2] );</span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt; font-family:Consolas"> </span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt; font-family:Consolas">
<span style="color:blue">try</span></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt; font-family:Consolas"> {</span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt; font-family:Consolas"> writer->Update();</span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt; font-family:Consolas"> }</span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt; font-family:Consolas">
<span style="color:blue">catch</span>( itk::ExceptionObject & e )</span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt; font-family:Consolas"> {</span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt; font-family:Consolas"> std::cerr <<
<span style="color:#A31515">"Error: "</span> << e << std::endl;</span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt; font-family:Consolas">
<span style="color:blue">return</span> EXIT_FAILURE;</span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt; font-family:Consolas"> }</span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt; font-family:Consolas"> </span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt; font-family:Consolas">
<span style="color:blue">return</span> EXIT_SUCCESS;</span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt; font-family:Consolas">}</span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt; font-family:Consolas"> </span></p>
<p class="MsoNormal"> </p>
<p class="MsoNormal"> </p>
<p class="MsoNormal"> </p>
<p class="MsoNormal"> </p>
<p class="MsoNormal">Error:</p>
<p class="MsoNormal">itk::ImageFileWriterException (0046ED04)</p>
<p class="MsoNormal">Location: "void __thiscall itk::ImageFileWriter<class itk::Image<unsigned char,2> >::Write(void)"</p>
<p class="MsoNormal">File: d:\itk\insighttoolkit-4.1.0\modules\io\imagebase\include\itkimagefilewriter.hxx</p>
<p class="MsoNormal">Line: 152</p>
<p class="MsoNormal">Description: Could not create IO object for file D:\dilatedoutput.jpg</p>
<p class="MsoNormal"> Tried to create one of the following:</p>
<p class="MsoNormal"> You probably failed to set a file suffix, or</p>
<p class="MsoNormal"> set the suffix to an unsupported type.</p>
<p class="MsoNormal"> </p>
<p class="MsoNormal"> </p>
<p class="MsoNormal"> </p>
<p class="MsoNormal">I am using InsightToolkit-4.1.0 with Visual Studio 2010 on Windows 7. How do I resolve these errors?</p>
<p class="MsoNormal"> </p>
<p class="MsoNormal"> </p>
<p class="MsoNormal">Thank you.</p>
<p class="MsoNormal"> </p>
<p class="MsoNormal"> </p>
<p class="MsoNormal">Regards,</p>
<p class="MsoNormal">Ravi Teja</p>
<p class="MsoNormal"> </p>
<p class="MsoNormal"> </p>
<p class="MsoNormal"> </p>
</div>
<br>
<hr>
<font face="Arial" color="Gray" size="1">The information contained in this message may be confidential and legally protected under applicable law. The message is intended solely for the addressee(s). If you are not the intended recipient, you are hereby notified
that any use, forwarding, dissemination, or reproduction of this message is strictly prohibited and may be unlawful. If you are not the intended recipient, please contact the sender by return e-mail and destroy all copies of the original message.<br>
</font>
</body>
</html>