<div dir="ltr"><div><div><div>Hi,<br></div>I've used this filter with 3D MRI images with more resolution that daoud23's, and my results were correct. I used 3D Slicer to visualize the 3D images and the result were interesting.<br></div>I hope this helps.<br></div>Regards.<br></div><div class="gmail_extra"><br><div class="gmail_quote">2015-11-11 13:45 GMT+01:00 Matt McCormick <span dir="ltr"><<a href="mailto:matt.mccormick@kitware.com" target="_blank">matt.mccormick@kitware.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hello,<br>
<br>
>From the screenshot, it is unclear whether the thinning worked or not<br>
-- it would be better to visualize in 3D instead of 2D planes.<br>
<br>
HTH,<br>
Matt<br>
<div class="HOEnZb"><div class="h5"><br>
On Wed, Nov 11, 2015 at 3:33 AM, Daoued23 <<a href="mailto:mlt.khawla@gmail.com">mlt.khawla@gmail.com</a>> wrote:<br>
> Hello everyone,<br>
><br>
> I want to get an Hybrid Skeleton. So I started by testing itk's filter<br>
> "itk::BinaryThinningImageFilter3D" to obtain the curve skeleton, but it<br>
> doesn't seem to work. Here is my code.<br>
><br>
> #include "itkImage.h"<br>
> #include "itkImageFileReader.h"<br>
> #include "itkImageFileWriter.h"<br>
><br>
> #include "itkConnectedThresholdImageFilter.h"<br>
> #include "itkImageRegionIterator.h"<br>
> #include "itkBinaryThinningImageFilter3D.h"<br>
><br>
> #include <iostream><br>
> #include <stdlib.h><br>
> using namespace std;<br>
><br>
> int main(int argc, char* argv[])<br>
> {<br>
>   // Verify the number of parameters in the command line<br>
>   if( argc <= 2 )<br>
>   {<br>
>     std::cerr << "Usage: " << std::endl;<br>
>     std::cerr << argv[0] << " inputImageFile outputImageFile" << std::endl;<br>
>     return EXIT_FAILURE;<br>
>   }<br>
>   char* infilename  = argv[1];<br>
>   char* outfilename = argv[2];<br>
><br>
>   const   unsigned int Dimension = 3;<br>
>   typedef signed short PixelType;<br>
>   typedef itk::Image< PixelType, Dimension > ImageType;<br>
><br>
>   // Read image<br>
>   typedef itk::ImageFileReader< ImageType > ReaderType;<br>
>   ReaderType::Pointer reader = ReaderType::New();<br>
>   reader->SetFileName( infilename );<br>
>   try<br>
>   {<br>
>     reader->Update();<br>
>   }<br>
>   catch (itk::ExceptionObject &ex)<br>
>   {<br>
>     std::cout << ex << std::endl;<br>
>     return EXIT_FAILURE;<br>
>   }<br>
>   cout << infilename << " sucessfully read." << endl;<br>
><br>
>   // Define the thinning filter<br>
>   typedef itk::BinaryThinningImageFilter3D< ImageType, ImageType ><br>
> ThinningFilterType;<br>
>   ThinningFilterType::Pointer thinningFilter = ThinningFilterType::New();<br>
>   thinningFilter->SetInput( reader->GetOutput() );<br>
>   thinningFilter->Update();<br>
><br>
>   // output to file<br>
>   typedef itk::ImageFileWriter< ImageType > WriterType;<br>
>   WriterType::Pointer writer = WriterType::New();<br>
>   writer->SetInput( thinningFilter->GetOutput() );<br>
>   writer->SetFileName( outfilename );<br>
><br>
>   try<br>
>   {<br>
>     writer->Update();<br>
>   }<br>
>   catch (itk::ExceptionObject &ex)<br>
>   {<br>
>     std::cout << ex << std::endl;<br>
>     return EXIT_FAILURE;<br>
>   }<br>
>   cout << outfilename << " sucessfully written." << endl;<br>
><br>
>   cout << "Program terminated normally." << endl;<br>
>   return EXIT_SUCCESS;<br>
> }<br>
><br>
><br>
> And here is the volume I get in return, the initial volume is a region of<br>
> trabecular bone of size 30x30x30 voxels.<br>
> <<a href="http://itk-users.7.n7.nabble.com/file/n36449/thinningitk.png" rel="noreferrer" target="_blank">http://itk-users.7.n7.nabble.com/file/n36449/thinningitk.png</a>><br>
><br>
><br>
><br>
> --<br>
> View this message in context: <a href="http://itk-users.7.n7.nabble.com/itk-BinaryThinningImageFilter3D-tp36449.html" rel="noreferrer" target="_blank">http://itk-users.7.n7.nabble.com/itk-BinaryThinningImageFilter3D-tp36449.html</a><br>
> Sent from the ITK - Users mailing list archive at Nabble.com.<br>
> _____________________________________<br>
> Powered by <a href="http://www.kitware.com" rel="noreferrer" target="_blank">www.kitware.com</a><br>
><br>
> Visit other Kitware open-source projects at<br>
> <a href="http://www.kitware.com/opensource/opensource.html" rel="noreferrer" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
><br>
> Kitware offers ITK Training Courses, for more information visit:<br>
> <a href="http://www.kitware.com/products/protraining.php" rel="noreferrer" target="_blank">http://www.kitware.com/products/protraining.php</a><br>
><br>
> Please keep messages on-topic and check the ITK FAQ at:<br>
> <a href="http://www.itk.org/Wiki/ITK_FAQ" rel="noreferrer" target="_blank">http://www.itk.org/Wiki/ITK_FAQ</a><br>
><br>
> Follow this link to subscribe/unsubscribe:<br>
> <a href="http://public.kitware.com/mailman/listinfo/insight-users" rel="noreferrer" target="_blank">http://public.kitware.com/mailman/listinfo/insight-users</a><br>
_____________________________________<br>
Powered by <a href="http://www.kitware.com" rel="noreferrer" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at<br>
<a href="http://www.kitware.com/opensource/opensource.html" rel="noreferrer" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Kitware offers ITK Training Courses, for more information visit:<br>
<a href="http://www.kitware.com/products/protraining.php" rel="noreferrer" target="_blank">http://www.kitware.com/products/protraining.php</a><br>
<br>
Please keep messages on-topic and check the ITK FAQ at:<br>
<a href="http://www.itk.org/Wiki/ITK_FAQ" rel="noreferrer" target="_blank">http://www.itk.org/Wiki/ITK_FAQ</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://public.kitware.com/mailman/listinfo/insight-users" rel="noreferrer" target="_blank">http://public.kitware.com/mailman/listinfo/insight-users</a><br>
</div></div></blockquote></div><br></div>