[Insight-users] discrete gaussian filter

Luis Ibanez luis.ibanez at kitware.com
Tue Jul 28 07:16:31 EDT 2009


Hi Syrine,

You should use the SeriesImageReader in order
to load a 3D DICOM series from a directory.


Please see the Example:

      Insight/Examples/IO/DicomSeriesReadImageWriter2.cxx


   Regards,


         Luis


------------------------------------------------------------------------------------------
On Mon, Jul 27, 2009 at 9:19 AM, Syrine Sahmim <syrine.sahmim at yahoo.fr>wrote:

> Hi,
> 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.
> the code is:
> #if defined(_MSC_VER)
> #pragma warning ( disable : 4786 )
> #endif
>
> #ifdef __BORLANDC__
> #define ITK_LEAN_AND_MEAN
> #endif
>
> #include "itkImage.h"
> #include "itkImageFileReader.h"
> #include "itkImageFileWriter.h"
> #include "itkRescaleIntensityImageFilter.h"
>
>
> #include "itkDiscreteGaussianImageFilter.h"
>
> int main( int argc, char * argv[] )
> {argc = 2;
>     argv[1] = "003F87DA.png";
>     argv[2] = "DA.png";
>   /*if( argc < 3 )
>     {
>     std::cerr << "Usage: " << std::endl;
>     std::cerr << argv[0] << "  inputImageFile  outputImageFile  variance
> maxKernelWidth " << std::endl;
>     return EXIT_FAILURE;
>     }*/
>
>
>   typedef    float    InputPixelType;
>   typedef    float    OutputPixelType;
>
>   typedef itk::Image< InputPixelType,  3 >   InputImageType;
>   typedef itk::Image< OutputPixelType, 3 >   OutputImageType;
>
>   typedef itk::ImageFileReader< InputImageType >  ReaderType;
>
>
>
>   typedef itk::DiscreteGaussianImageFilter<
>                  InputImageType, OutputImageType >  FilterType;
>
>   FilterType::Pointer filter = FilterType::New();
>
>   ReaderType::Pointer reader = ReaderType::New();
>   reader->SetFileName( argv[1] );
>
>   filter->SetInput( reader->GetOutput() );
>
>   const double gaussianVariance = atof( argv[3] );
>   const unsigned int maxKernelWidth = atoi( argv[4] );
>
>   filter->SetVariance( gaussianVariance );
>   filter->SetMaximumKernelWidth( maxKernelWidth );
>
>
>   filter->Update();
>
>   typedef unsigned char WritePixelType;
>   typedef itk::Image< WritePixelType, 2 > WriteImageType;
>   typedef itk::RescaleIntensityImageFilter<
>                OutputImageType, WriteImageType > RescaleFilterType;
>   RescaleFilterType::Pointer rescaler = RescaleFilterType::New();
>
>   rescaler->SetOutputMinimum(   0 );
>   rescaler->SetOutputMaximum( 255 );
>
>   typedef itk::ImageFileWriter< WriteImageType >  WriterType;
>   WriterType::Pointer writer = WriterType::New();
>   writer->SetFileName( argv[2] );
>
>   // Software Guide : BeginCodeSnippet
>   rescaler->SetInput( filter->GetOutput() );
>   writer->SetInput( rescaler->GetOutput() );
>   writer->Update();
>
>   return EXIT_SUCCESS;
> }
>
> Thanks
>
>
>
>
> _____________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the ITK FAQ at:
> http://www.itk.org/Wiki/ITK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.itk.org/mailman/listinfo/insight-users
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20090728/0eaeeb7c/attachment.htm>


More information about the Insight-users mailing list