<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;">Hello,<div><br></div><div>I used SimpleITK in an IPython Jupiter Notebook to explore some of your questions. It can be found here:</div><div><br></div><div><a href="http://nbviewer.ipython.org/github/blowekamp/SimpleITK-Notebook-Answers/blob/master/ConnectedThresholdAndOtherFilterPerformance.ipynb">http://nbviewer.ipython.org/github/blowekamp/SimpleITK-Notebook-Answers/blob/master/ConnectedThresholdAndOtherFilterPerformance.ipynb</a></div><div><br></div><div><br></div><div>2) I was able to reproduce you experiment that the Median filter was faster that either of the rank filters. However this is very dependent on the image size and the radius of the neighborhood.</div><div><br></div><div><div>3) I was able to confirm that the ConnectedThresholdImageFilter does report progress as the region is growing. This is either a problem with your Qt application or you have a very small region growing that is less the 1% of the image.</div></div><div><br></div><div>4) In the notebook I did a brief comparison of the Binary and Grayscale dilate. For binary images they will result in the same output. They implement different algorithms, so they have different performance characteristics. I'd recommend reading the InsightJournal article [1] [2], and their reference papers on the algorithms used.</div><div><br></div><div>HTH,</div><div>Brad</div><div><br></div><div>[1] <a href="http://hdl.handle.net/1926/173">http://hdl.handle.net/1926/173</a></div><div>[2] <a href="http://hdl.handle.net/1926/308">http://hdl.handle.net/1926/308</a></div><div><br></div><div><div><div>On Jun 8, 2015, at 5:21 PM, zagwin <<a href="mailto:zagwin@gmail.com">zagwin@gmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div style="font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;">Hello Brad,<br><br>Thanks for your suggestions.<br><1>I did compile my project in release mode, and the<br>ConnectedThresholdImageFilter does not show progress.<br><br><2>I tried your suggested FastApproximageRankImageFilter, it works, however,<br>very strange, it is much slower than using medianfilter.<span class="Apple-converted-space"> </span><br>First, I check this using my project and see the progress of my progressBar.<span class="Apple-converted-space"> </span><br>Second, I created a simple project with two functions, the first is to load<br>image, the second is to run median and fast rank as this:<br>ProcessData()<br>{<br>       typedef itk::MedianImageFilter<InputImageType, InputImageType><br>MedianFilterType;<br><span class="Apple-tab-span" style="white-space: pre;">  </span>typedef itk::FastApproximateRankImageFilter<InputImageType, InputImageType><span class="Apple-converted-space"> </span><br>FastRankFilterType;<br><span class="Apple-tab-span" style="white-space: pre;">   </span>typedef InputImageType::SizeType  ImageSizeType;<br><br><span class="Apple-tab-span" style="white-space: pre;"> </span>MedianFilterType::Pointer smooth1 = MedianFilterType::New();<br><span class="Apple-tab-span" style="white-space: pre;">    </span>FastRankFilterType::Pointer smooth2 = FastRankFilterType::New();<br><br><span class="Apple-tab-span" style="white-space: pre;">      </span>ImageSizeType radius1;<br><span class="Apple-tab-span" style="white-space: pre;">  </span>radius1.Fill(1);<br><span class="Apple-tab-span" style="white-space: pre;">        </span>smooth1->SetRadius( radius1 );<br><span class="Apple-tab-span" style="white-space: pre;">       </span>smooth2->SetRadius( radius1 );<br><br><span class="Apple-tab-span" style="white-space: pre;">     </span>smooth1->SetInput(m_itkImage);<br><span class="Apple-tab-span" style="white-space: pre;">       </span>smooth2->SetInput(m_itkImage);<br><br><span class="Apple-tab-span" style="white-space: pre;">     </span>QTime time;<br><span class="Apple-tab-span" style="white-space: pre;">     </span>time.start(); //ms<br><span class="Apple-tab-span" style="white-space: pre;">      </span>int iter_num = 5;<br><span class="Apple-tab-span" style="white-space: pre;">       </span>for (int i=0; i< iter_num; ++i)<br><span class="Apple-tab-span" style="white-space: pre;">      </span>{<br><span class="Apple-tab-span" style="white-space: pre;">       </span><span class="Apple-tab-span" style="white-space: pre;">  </span>smooth1->Modified();<br><span class="Apple-tab-span" style="white-space: pre;"> </span><span class="Apple-tab-span" style="white-space: pre;">  </span>smooth1->Update();<br><span class="Apple-tab-span" style="white-space: pre;">   </span>}<br><span class="Apple-tab-span" style="white-space: pre;">       </span>int time_Diff = time.elapsed();<br><span class="Apple-tab-span" style="white-space: pre;"> </span>std::cerr << "Median time ms  " << time_Diff << std::endl;<br><span class="Apple-tab-span" style="white-space: pre;">     </span><br><span class="Apple-tab-span" style="white-space: pre;">        </span>time.start();<br><span class="Apple-tab-span" style="white-space: pre;">   </span>for (int i=0; i< iter_num; ++i)<br><span class="Apple-tab-span" style="white-space: pre;">      </span>{<br><span class="Apple-tab-span" style="white-space: pre;">       </span><span class="Apple-tab-span" style="white-space: pre;">  </span>smooth2->Modified();<br><span class="Apple-tab-span" style="white-space: pre;"> </span><span class="Apple-tab-span" style="white-space: pre;">  </span>smooth2->Update();<br><span class="Apple-tab-span" style="white-space: pre;">   </span>}<br><span class="Apple-tab-span" style="white-space: pre;">       </span>time_Diff = time.elapsed();<br><span class="Apple-tab-span" style="white-space: pre;">     </span>std::cerr << "FastRank time ms  " << time_Diff << std::endl;<br>}<br>The result is "Median time ms 90" and "FastRank time ms 27998"<br><br><3> I created simple project with one function to test<br>ConnectedThresholdImageFilter.<br>MainWindow::ProcessData()<br>{<br>      typedef itk::ConnectedThresholdImageFilter <InputImageType,<br>UCharImageType>  ConnectedThresholdFilterType;<br><span class="Apple-tab-span" style="white-space: pre;">  </span>typedef InputImageType::IndexType SeedIndexType;<br><br><span class="Apple-tab-span" style="white-space: pre;">      </span>ConnectedThresholdFilterType::Pointer  ccthreshold   =<br>ConnectedThresholdFilterType::New();<br><br><span class="Apple-tab-span" style="white-space: pre;">   </span>ItkQtProgress *progress = new ItkQtProgress(this);<span class="Apple-converted-space"> </span><br><span class="Apple-tab-span" style="white-space: pre;">       </span>progress->Observe(ccthreshold.GetPointer());<br><span class="Apple-tab-span" style="white-space: pre;"> </span>connect(progress, SIGNAL(postValue(float)), this,<br>SLOT(slot_progress(float)));<br><br><span class="Apple-tab-span" style="white-space: pre;">       </span>ccthreshold->SetLower(-1000);<br><span class="Apple-tab-span" style="white-space: pre;">        </span>ccthreshold->SetUpper(-300);<br><span class="Apple-tab-span" style="white-space: pre;"> </span>ccthreshold->SetReplaceValue(255);<br><br><span class="Apple-tab-span" style="white-space: pre;"> </span>SeedIndexType seed;<br><span class="Apple-tab-span" style="white-space: pre;">     </span>seed[0] = 156;<br><span class="Apple-tab-span" style="white-space: pre;">  </span>seed[1] = 250;<br><span class="Apple-tab-span" style="white-space: pre;">  </span>ccthreshold->SetSeed(seed);<br><br><span class="Apple-tab-span" style="white-space: pre;">        </span>ccthreshold->SetInput(m_itkImage);<br><br><span class="Apple-tab-span" style="white-space: pre;"> </span>ccthreshold->Update();<br>}<br>void MainWindow::slot_progress(float progress)<br>{<br><span class="Apple-tab-span" style="white-space: pre;"> </span>std::cout << "Progress value  " << progress << std::endl;<br>}<br><br>The result is "Progress value 0" and "Progress value 1", no other value, it<br>is the same as my "big" project using my progress bar.<span class="Apple-converted-space"> </span><br>I also try this simple project to test others, such as MeadianFilter, it<br>DOES have other value beside 0/1<br><br><4> I don't understand, since the output of ConnectedThresholdFilter is<br>Binary, why use GrayscaleDilateImageFilter other than<br>BinaryDilateImageFilter? I think the BinaryDilateFilter should be faster, am<br>I right?<br><br><br>Bradley Lowekamp wrote<br><blockquote type="cite">Please make sure you are compiling your code in Release mode. It can make<br>over a 10X performance difference.<br><br>The median image filter is not fast for large regions. You may want to<br>look into the FastApproximageRankImageFilter [1, 2], or just the<br>RankImageFilter.<br><br>You can look at how The ConnectedThresholdImageFitler reports progress in<br>the code [3]. It does as good of a job as possible reporting progress. It<br>will go smoothly for the number of pixels in the region, then just at the<br>end for the number of pixels not visited.<br><br>You may want to look into teh GrayscaleDilateImageFilter to do you binary<br>morphology [4].<br><br>HTH,<br>Brad<br><br>[1]<br><a href="http://www.itk.org/Doxygen/html/classitk_1_1FastApproximateRankImageFilter.html">http://www.itk.org/Doxygen/html/classitk_1_1FastApproximateRankImageFilter.html</a><br>[2] http://www.insight-journal.org/browse/publication/160<br>[3]<br>https://github.com/InsightSoftwareConsortium/ITK/blob/master/Modules/Segmentation/RegionGrowing/include/itkConnectedThresholdImageFilter.hxx#L268-L328<br>[4]<br>http://www.itk.org/Doxygen/html/classitk_1_1GrayscaleDilateImageFilter.html<br></blockquote><br><br><br><br><br>--<br>View this message in context:<span class="Apple-converted-space"> </span><a href="http://itk-users.7.n7.nabble.com/itkConnectedThresholdImageFilter-does-not-support-Progress-tp35782p35785.html">http://itk-users.7.n7.nabble.com/itkConnectedThresholdImageFilter-does-not-support-Progress-tp35782p35785.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</div></blockquote></div><br></div></body></html>