<html><head><meta http-equiv="Content-Type" content="text/html charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><div style="margin: 0px; font-size: 11px; font-family: Menlo;"><span style="font-family: Helvetica; font-size: 12px;">Hello,</span></div><div style="margin: 0px; font-size: 11px; font-family: Menlo;"><span style="font-family: Helvetica; font-size: 12px;"><br></span></div><div style="margin: 0px; font-size: 11px; font-family: Menlo;"><span style="font-family: Helvetica; font-size: 12px;">I am getting similar performance on my laptop with a random image using SimpleITK:</span></div><div style="margin: 0px; font-size: 11px; font-family: Menlo;"><br></div><div style="margin: 0px; font-size: 11px; font-family: Menlo;"><div style="margin: 0px;"><span style="color: #5330e1">In [<b>4</b>]: </span>img = sitk.Image(512,512,512,sitk.sitkFloat32)</div><div style="margin: 0px;"><br></div><div style="margin: 0px;"><div style="margin: 0px;"><span style="color: #5330e1">In [<b>8</b>]: </span>img = sitk.AdditiveGaussianNoise(img, standardDeviation=20, mean=127)</div></div><div style="margin: 0px;"><br></div></div><div style="margin: 0px; font-size: 11px; font-family: Menlo;"><span style="color: #5330e1">In [<b>10</b>]: </span>%timeit -r 1 -n 1 sitk.AdaptiveHistogramEqualization( img, [1]*3, 1, 1)</div><div style="margin: 0px; font-size: 11px; font-family: Menlo;">1 loops, best of 1: 13min 59s per loop</div><div style="margin: 0px; font-size: 11px; font-family: Menlo;"><br></div><div><div>I did notice that this was a single threaded algorithm. From looking at the algorithm, there is an expensive amount of histogram work that needs to be done per pixel. This could easily be made multi-threaded. I would be happy to help and show you similar multi-threading implementation in ITK if you would like to take this up.</div><div><br></div><div>Additional, optimization could be achieved by changing the algorithm to a "MovingHistogram" based one.</div><div><br></div><div>Alternatively, there are other algorithms that you could use with similar effect such as unsharp mask from gaussian math, or the UnsharpMaskLevelSetImageFilter.</div><div><br></div><div>HTH,</div><div>Brad</div><div><br></div><div><br></div><div>On Oct 16, 2015, at 8:56 AM, JoseBarretoT <<a href="mailto:jose.de.paula@live.com">jose.de.paula@live.com</a>> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite">Hello guys,<br>itk::AdaptiveHistogramEqualizationImageFilter works well when applied in 3D<br>images?<br>Need to apply this filter to a .mhd arquido a DICOM (zraw), have a similar<br>effect as unsharp.<br>The problem is that when you step one reader pictures with 3 dimensions oo<br>filter takes almost 15 minutes to apply.<br>Really it does not apply in 3D images? Or am I doing something wrong?<br>Well, follows the code:<br><br><span class="Apple-tab-span" style="white-space:pre"> </span>itk::GDCMImageIOFactory::RegisterOneFactory();<br><span class="Apple-tab-span" style="white-space:pre"> </span><span class="Apple-tab-span" style="white-space:pre"> </span><span class="Apple-tab-span" style="white-space:pre"> </span>itk::MetaImageIOFactory::RegisterOneFactory();<br><span class="Apple-tab-span" style="white-space:pre"> </span><span class="Apple-tab-span" style="white-space:pre"> </span><span class="Apple-tab-span" style="white-space:pre"> </span>itk::VTKImageIOFactory::RegisterOneFactory();<br><span class="Apple-tab-span" style="white-space:pre"> </span><span class="Apple-tab-span" style="white-space:pre"> </span><span class="Apple-tab-span" style="white-space:pre"> </span>typedef signed short PixelType;<br><span class="Apple-tab-span" style="white-space:pre"> </span><span class="Apple-tab-span" style="white-space:pre"> </span><span class="Apple-tab-span" style="white-space:pre"> </span>const unsigned int Dimension = 3;<br><span class="Apple-tab-span" style="white-space:pre"> </span><span class="Apple-tab-span" style="white-space:pre"> </span><span class="Apple-tab-span" style="white-space:pre"> </span>typedef itk::Image< PixelType, Dimension > ImageType;<br><span class="Apple-tab-span" style="white-space:pre"> </span><span class="Apple-tab-span" style="white-space:pre"> </span><span class="Apple-tab-span" style="white-space:pre"> </span>typedef itk::ImageSeriesReader< ImageType > ReaderType;<br><br><span class="Apple-tab-span" style="white-space:pre"> </span><span class="Apple-tab-span" style="white-space:pre"> </span><span class="Apple-tab-span" style="white-space:pre"> </span>ReaderType::Pointer reader = ReaderType::New();<br><span class="Apple-tab-span" style="white-space:pre"> </span><span class="Apple-tab-span" style="white-space:pre"> </span><span class="Apple-tab-span" style="white-space:pre"> </span>reader->SetFileName(clXUteis::ConverterStringParaChar("panoramica.mhd"));<br><span class="Apple-tab-span" style="white-space:pre"> </span><span class="Apple-tab-span" style="white-space:pre"> </span><span class="Apple-tab-span" style="white-space:pre"> </span>reader->Update();<br><br><span class="Apple-tab-span" style="white-space:pre"> </span><span class="Apple-tab-span" style="white-space:pre"> </span><span class="Apple-tab-span" style="white-space:pre"> </span>typedef itk::AdaptiveHistogramEqualizationImageFilter< ImageType ><br>AdaptiveHistogramEqualizationImageFilterType;<br><span class="Apple-tab-span" style="white-space:pre"> </span><span class="Apple-tab-span" style="white-space:pre"> </span><span class="Apple-tab-span" style="white-space:pre"> </span>AdaptiveHistogramEqualizationImageFilterType::Pointer<br>adaptiveHistogramEqualizationImageFilter =<br>AdaptiveHistogramEqualizationImageFilterType::New();<br><span class="Apple-tab-span" style="white-space:pre"> </span><span class="Apple-tab-span" style="white-space:pre"> </span><span class="Apple-tab-span" style="white-space:pre"> </span>adaptiveHistogramEqualizationImageFilter->SetInput(reader->GetOutput());<br><span class="Apple-tab-span" style="white-space:pre"> </span><span class="Apple-tab-span" style="white-space:pre"> </span><span class="Apple-tab-span" style="white-space:pre"> </span>adaptiveHistogramEqualizationImageFilter->SetBeta(1);<br><span class="Apple-tab-span" style="white-space:pre"> </span><span class="Apple-tab-span" style="white-space:pre"> </span><span class="Apple-tab-span" style="white-space:pre"> </span>adaptiveHistogramEqualizationImageFilter->SetAlpha(1);<br><span class="Apple-tab-span" style="white-space:pre"> </span><span class="Apple-tab-span" style="white-space:pre"> </span><span class="Apple-tab-span" style="white-space:pre"> </span>adaptiveHistogramEqualizationImageFilter->SetRadius(1);<br><span class="Apple-tab-span" style="white-space:pre"> </span><span class="Apple-tab-span" style="white-space:pre"> </span><span class="Apple-tab-span" style="white-space:pre"> </span>adaptiveHistogramEqualizationImageFilter->Update(); //delay is 13~45<br>minutes<br><br><span class="Apple-tab-span" style="white-space:pre"> </span><span class="Apple-tab-span" style="white-space:pre"> </span><span class="Apple-tab-span" style="white-space:pre"> </span>typedef itk::ImageFileWriter< ImageType > WriterType;<br><span class="Apple-tab-span" style="white-space:pre"> </span><span class="Apple-tab-span" style="white-space:pre"> </span><span class="Apple-tab-span" style="white-space:pre"> </span>WriterType::Pointer writer = WriterType::New();<br><span class="Apple-tab-span" style="white-space:pre"> </span><span class="Apple-tab-span" style="white-space:pre"> </span><span class="Apple-tab-span" style="white-space:pre"> </span>writer->SetFileName("<a href="d://output.mhd">d://output.mhd</a>");<br><span class="Apple-tab-span" style="white-space:pre"> </span><span class="Apple-tab-span" style="white-space:pre"> </span><span class="Apple-tab-span" style="white-space:pre"> </span>writer->SetUseCompression(1);<br><br><span class="Apple-tab-span" style="white-space:pre"> </span><span class="Apple-tab-span" style="white-space:pre"> </span><span class="Apple-tab-span" style="white-space:pre"> </span>writer->SetInput(adaptiveHistogramEqualizationImageFilter->GetOutput());<br><span class="Apple-tab-span" style="white-space:pre"> </span><span class="Apple-tab-span" style="white-space:pre"> </span><span class="Apple-tab-span" style="white-space:pre"> </span>writer->Update();<br><br><br><br>--<br>View this message in context: <a href="http://itk-users.7.n7.nabble.com/AdaptiveHistogramEqualizationImageFilter-3D-tp36339.html">http://itk-users.7.n7.nabble.com/AdaptiveHistogramEqualizationImageFilter-3D-tp36339.html</a><br>Sent from the ITK - Users mailing list archive at <a href="http://Nabble.com">Nabble.com</a>.<br>_____________________________________<br>Powered by <a href="http://www.kitware.com">www.kitware.com</a><br><br>Visit other Kitware open-source projects at<br><a href="http://www.kitware.com/opensource/opensource.html">http://www.kitware.com/opensource/opensource.html</a><br><br>Kitware offers ITK Training Courses, for more information visit:<br>http://www.kitware.com/products/protraining.php<br><br>Please keep messages on-topic and check the ITK FAQ at:<br>http://www.itk.org/Wiki/ITK_FAQ<br><br>Follow this link to subscribe/unsubscribe:<br>http://public.kitware.com/mailman/listinfo/insight-users<br></blockquote></div><br></body></html>