[Insight-users] Median filter on Volume: Performance
Gaëtan Lehmann
gaetan.lehmann at jouy.inra.fr
Wed Feb 23 08:47:07 EST 2011
Hi Mark,
What is the image size you are trying to filter?
Please make sure that your application is built in Release mode - this
can make a HUGE difference.
For the efficiency and the spherical neighborhood, you may want to try
the RankImageFilter which is in the Review directory.
For large neighborhoods, it may improve significantly the performance.
Regards,
Gaëtan
Le 23 févr. 11 à 14:36, sacrif a écrit :
>
> Hello!
>
> Actually I simply want to load a volume, run a median filter on it
> and write
> the resulting volume back to disk. Therefore I implemented the
> following
> code:
>
>
> typedef signed short PixelType;
> static const unsigned int Dimension = 3;
> typedef itk::Image<PixelType, Dimension> InputImageType;
> typedef itk::Image<PixelType, Dimension> OutputImageType;
> typedef itk::ImageFileReader<InputImageType> ReaderType;
> typedef itk::ImageFileWriter< InputImageType > WriterType;
> typedef itk::MedianImageFilter< InputImageType, OutputImageType >
> MedianFilterType;
>
> void MyClass::createMedianHdrFile(std::string filename)
> {
> ReaderType::Pointer reader = ReaderType::New();
> reader->SetFileName(filename.c_str());
>
> MedianFilterType::Pointer medianFilter = MedianFilterType::New();
> InputImageType::SizeType indexRadius;
> indexRadius[0] = 10; // radius along x
> indexRadius[1] = 10; // radius along y
> indexRadius[2] = 10; // radius along z
> medianFilter->SetRadius( indexRadius );
> medianFilter->SetInput(reader->GetOutput());
>
> std::string fnNoEnding = getFilenameWithErasedEnding(filename,
> ".hdr");
> std::string fnNewEnding = getFilenameWithNewEnding(fnNoEnding,
> "_Median.hdr");
>
> WriterType::Pointer writer = WriterType::New();
> writer->SetFileName( fnNewEnding.c_str());
> writer->SetInput( medianFilter->GetOutput() );
> writer->Update();
> cout << "Median End" << endl;
> }
>
>
> Basically this works if I use a very small filter with
> "indexRadius[0/1/2] =
> 1;". However, as soon as I use "indexRadius[0/1/2] = 10;" the
> calculation
> seems to take for ever.
> In the meanwhile the program ran for approximately 3 hours and did not
> finish yet. Is it really possible that the calculation of a "median
> volume"
> takes such a long time? And is there any way to reduce this time span?
>
> My input and output volume are in the Analyze format. For the
> current test
> run my input and output volume dimensions are 96x96x96 and the
> filter size
> is 10x10x10. However, I would also like to create "median volumes"
> of even
> larger data sets and with larger Filter dimensions.
> The test input volume min and max intensity are -1093 and 1086,
> respectively.
>
> Additionally I wanted to ask whether there is a simple way to run
> apply a
> spherical median filter of a certain radius instead of using the
> cuboid
> defined by "indexRadius[0/1/2]".
>
> Thank you for your help & Kind regards
> Mark
> --
> View this message in context: http://old.nabble.com/Median-filter-on-Volume%3A-Performance-tp30994977p30994977.html
> Sent from the ITK - Users mailing list archive at Nabble.com.
>
> _____________________________________
> 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.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
--
Gaëtan Lehmann
Biologie du Développement et de la Reproduction
INRA de Jouy-en-Josas (France)
tel: +33 1 34 65 29 66 fax: 01 34 65 29 09
http://voxel.jouy.inra.fr http://www.itk.org
http://www.mandriva.org http://www.bepo.fr
-------------- next part --------------
A non-text attachment was scrubbed...
Name: PGP.sig
Type: application/pgp-signature
Size: 203 bytes
Desc: Ceci est une signature ?lectronique PGP
URL: <http://www.itk.org/pipermail/insight-users/attachments/20110223/86ddacc6/attachment.pgp>
More information about the Insight-users
mailing list