[ITK-users] error executing in median filter for nifty(nii) file
Bill Lorensen
bill.lorensen at gmail.com
Tue Apr 22 07:51:21 EDT 2014
Are you building your ITK and Median program in Release mode? If it is
build in Debug mode, the times can be 10-100 times slower.
On Tue, Apr 22, 2014 at 6:54 AM, neela <avcneela at gmail.com> wrote:
> hi
>
> i am new to itk programming. I want to just simple filter(say median
> filter) for nii file. I changed the MedianImageFilter.cxx program available
> with ITK as follows: (change size from 2 to 3) and include radius along z
> direction.
>
> #include "itkImageFileReader.h"
> #include "itkImageFileWriter.h"
>
> #include "itkMedianImageFilter.h"
>
> int main( int argc, char * argv[] )
> {
> if( argc < 3 )
> {
> std::cerr << "Usage: " << std::endl;
> std::cerr << argv[0] << " inputImageFile outputImageFile" <<
> std::endl;
> return EXIT_FAILURE;
> }
>
>
> typedef unsigned char InputPixelType;
> typedef unsigned char OutputPixelType;
>
> typedef itk::Image< InputPixelType, 3 > InputImageType;
> typedef itk::Image< OutputPixelType, 3 > OutputImageType;
>
> typedef itk::ImageFileReader< InputImageType > ReaderType;
> typedef itk::ImageFileWriter< OutputImageType > WriterType;
>
> ReaderType::Pointer reader = ReaderType::New();
> WriterType::Pointer writer = WriterType::New();
>
> reader->SetFileName( argv[1] );
> writer->SetFileName( argv[2] );
>
> typedef itk::MedianImageFilter<
> InputImageType, OutputImageType > FilterType;
>
> FilterType::Pointer filter = FilterType::New();
> InputImageType::SizeType indexRadius;
>
> indexRadius[0] = 1; // radius along x
> indexRadius[1] = 1; // radius along y
> indexRadius[2] = 1; // radius along z
>
> filter->SetRadius( indexRadius );
>
> filter->SetInput( reader->GetOutput() );
> writer->SetInput( filter->GetOutput() );
> writer->Update();
>
>
>
> return EXIT_SUCCESS;
> }
>
> But it works well for JPG images, when i tried for DCM images i got only
> partial output (only one slice) where as for nii image system hangs.
> Anybody please help me.
>
> thanks
>
>
> _____________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Kitware offers ITK Training Courses, for more information visit:
> http://www.kitware.com/products/protraining.php
>
> 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
--
Unpaid intern in BillsBasement at noware dot com
More information about the Insight-users
mailing list