Hello to everyone,<br><br>I am trying to run the DerivativeImageFilter.cxx from the filter examples of itk. My project is built corectly but when I run the command prompt window giving the following parametres: <i>DerivativeImageFilter input.png output.png normalize.png 1 0</i>, I get a Debug error. Does anybody know what is the problem? Also, what is the <i>order </i>in a derivative image filter and what values does it get in the command prompt window?<br>
<br>Thanks<br><br>\\\\\\\\\\\\\\\\\\\\DerivativeImageFilter.cxx\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\<br><br><br>#include "itkImage.h"<br>#include "itkImageFileReader.h"<br>#include "itkImageFileWriter.h"<br>
#include "itkRescaleIntensityImageFilter.h"<br><br>#include "itkDerivativeImageFilter.h"<br><br><br><br>int main( int argc, char * argv[] )<br>{<br> if( argc < 6 )<br> {<br> std::cerr << "Usage: " << std::endl;<br>
std::cerr << argv[0] << " inputImageFile outputImageFile normalizedOutputImageFile ";<br> std::cerr << " derivativeOrder direction" << std::endl;<br> return EXIT_FAILURE;<br>
}<br><br> typedef float InputPixelType;<br> typedef float OutputPixelType;<br><br> const unsigned int Dimension = 2;<br><br> typedef itk::Image< InputPixelType, Dimension > InputImageType;<br> typedef itk::Image< OutputPixelType, Dimension > OutputImageType;<br>
<br><br> typedef itk::ImageFileReader< InputImageType > ReaderType;<br> typedef itk::ImageFileWriter< OutputImageType > WriterType;<br><br> ReaderType::Pointer reader = ReaderType::New();<br> WriterType::Pointer writer = WriterType::New();<br>
<br> reader->SetFileName( argv[1] );<br> writer->SetFileName( argv[2] );<br><br><br> typedef itk::DerivativeImageFilter<<br> InputImageType, OutputImageType > FilterType;<br><br> FilterType::Pointer filter = FilterType::New();<br>
// Software Guide : EndCodeSnippet<br><br><br> filter->SetOrder( atoi( argv[4] ) );<br> filter->SetDirection( atoi( argv[5] ) );<br><br> filter->SetInput( reader->GetOutput() );<br> writer->SetInput( filter->GetOutput() );<br>
writer->Update();<br><br><br><br> typedef itk::Image< unsigned char, Dimension > WriteImageType;<br><br> typedef itk::RescaleIntensityImageFilter< <br> OutputImageType,<br>
WriteImageType > NormalizeFilterType;<br><br> typedef itk::ImageFileWriter< WriteImageType > NormalizedWriterType;<br><br> NormalizeFilterType::Pointer normalizer = NormalizeFilterType::New();<br>
NormalizedWriterType::Pointer normalizedWriter = NormalizedWriterType::New();<br><br> normalizer->SetInput( filter->GetOutput() );<br> normalizedWriter->SetInput( normalizer->GetOutput() );<br><br> normalizer->SetOutputMinimum( 0 );<br>
normalizer->SetOutputMaximum( 255 );<br><br> normalizedWriter->SetFileName( argv[3] );<br> normalizedWriter->Update();<br><br> return EXIT_SUCCESS;<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>