Hello to everyone,<br>I am using visual studio 2010 with the help of cmake. I want to create a program which change the extension of the file, for example makes a <i>test.png</i> file to<i> test.jpeg</i> file. I have written the following code which is compiled without failures. When I run the .exe file I get this message (as it was expected):<br>
<br><i>Usage:<br>name_of_project.exe inputImageFile outputImageFile<br></i><br>I would like to ask what exactly I must type to the Command Prompt window after running the .exe file to get the new .jpeg file.<br><br><br>-----------------code------------------------------------------------<br>
---------------------------------------------------------------------------------------------------<br><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 "itkImageFileReader.h"<br>#include "itkImageFileWriter.h"<br><br><br>#include "itkImage.h"<br><br><br>int main( int argc, char ** argv )<br>{<br> if( argc < 3 )<br>
{<br> std::cerr << "Usage: " << std::endl;<br> std::cerr << argv[0] << " inputImageFile outputImageFile " << std::endl;<br> return EXIT_FAILURE;<br> }<br>
<br><br> typedef short PixelType;<br> const unsigned int Dimension = 2;<br> typedef itk::Image< PixelType, Dimension > ImageType;<br><br><br> typedef itk::ImageFileReader< ImageType > ReaderType;<br>
typedef itk::ImageFileWriter< ImageType > WriterType;<br><br><br> ReaderType::Pointer reader = ReaderType::New();<br> WriterType::Pointer writer = WriterType::New();<br><br><br> const char * inputFilename = argv[1];<br>
const char * outputFilename = argv[2];<br><br><br><br> reader->SetFileName( inputFilename );<br> writer->SetFileName( outputFilename);<br><br><br><br> writer->SetInput( reader->GetOutput() );<br><br><br><br>
<br> try <br> { <br> writer->Update(); <br> } <br> catch( itk::ExceptionObject & err ) <br> { <br> std::cerr << "ExceptionObject caught !" << std::endl; <br> std::cerr << err << std::endl; <br>
return EXIT_FAILURE;<br> } <br><br><br><br><br> return EXIT_SUCCESS;<br>}<br><br><br><div style="visibility: hidden; left: -5000px; position: absolute; z-index: 9999; padding: 0px; margin-left: 0px; margin-top: 0px; overflow: hidden; word-wrap: break-word; color: black; font-size: 10px; text-align: left; line-height: 130%;" id="avg_ls_inline_popup">
</div>