<html><head><style type="text/css"><!-- DIV {margin:0px;} --></style></head><body><div style="font-family:times new roman,new york,times,serif;font-size:12pt;color:#000000;"><div>Hi,<br>I try to apply the discrete gaussian filter on a 3D dicom image. So i tried the code below. there's no errors on building step but the problem is after debugging. i don't have result.so i want to know where's the error or even i must do or add some codes to succeed execution.<br>the code is:<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 "itkImage.h"<br>#include "itkImageFileReader.h"<br>#include "itkImageFileWriter.h"<br>#include "itkRescaleIntensityImageFilter.h"<br><br><br>#include "itkDiscreteGaussianImageFilter.h"<br><br>int main( int argc, char * argv[] )<br>{argc = 2;<br> argv[1] = "003F87DA.png";<br> argv[2] = "DA.png";
<br> /*if( argc < 3 ) <br> { <br> std::cerr << "Usage: " << std::endl;<br> std::cerr << argv[0] << " inputImageFile outputImageFile variance maxKernelWidth " << std::endl;<br> return EXIT_FAILURE;<br> }*/<br><br> <br> typedef float InputPixelType;<br> typedef float OutputPixelType;<br><br> typedef itk::Image< InputPixelType, 3 > InputImageType;<br> typedef itk::Image< OutputPixelType, 3 > OutputImageType;<br> <br> typedef itk::ImageFileReader< InputImageType > ReaderType;<br><br><br> <br> typedef
itk::DiscreteGaussianImageFilter<<br> InputImageType, OutputImageType > FilterType;<br><br> FilterType::Pointer filter = FilterType::New();<br> <br> ReaderType::Pointer reader = ReaderType::New();<br> reader->SetFileName( argv[1] );<br> <br> filter->SetInput( reader->GetOutput() );<br> <br> const double gaussianVariance = atof( argv[3] );<br> const unsigned int maxKernelWidth = atoi( argv[4] );<br><br> filter->SetVariance( gaussianVariance );<br> filter->SetMaximumKernelWidth( maxKernelWidth );<br> <br> <br> filter->Update();<br> <br> typedef unsigned char WritePixelType;<br> typedef itk::Image< WritePixelType, 2 > WriteImageType;<br> typedef itk::RescaleIntensityImageFilter<
<br> OutputImageType, WriteImageType > RescaleFilterType;<br> RescaleFilterType::Pointer rescaler = RescaleFilterType::New();<br><br> rescaler->SetOutputMinimum( 0 );<br> rescaler->SetOutputMaximum( 255 );<br><br> typedef itk::ImageFileWriter< WriteImageType > WriterType;<br> WriterType::Pointer writer = WriterType::New();<br> writer->SetFileName( argv[2] );<br> <br> // Software Guide : BeginCodeSnippet<br> rescaler->SetInput( filter->GetOutput() );<br> writer->SetInput( rescaler->GetOutput() );<br> writer->Update();<br> <br> return EXIT_SUCCESS;<br>}<br><br>Thanks<br><br><br></div></div><br>
</body></html>