<div dir="ltr">The ConnectedThresholdImageFilter example [1] might be of use.<br><div><br></div><div>[1] <a href="https://github.com/InsightSoftwareConsortium/ITK/blob/master/Examples/Segmentation/ConnectedThresholdImageFilter.cxx">https://github.com/InsightSoftwareConsortium/ITK/blob/master/Examples/Segmentation/ConnectedThresholdImageFilter.cxx</a></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Feb 4, 2015 at 3:14 PM, samah bouzidi <span dir="ltr"><<a href="mailto:samah.bouzidi@gmail.com" target="_blank">samah.bouzidi@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><div><div><div>hi Matt, <br><br></div>thank you for replying.<br><br></div><span>I can't find the error in my code</span> (a black volume result)<pre><span style="font-family:arial,helvetica,sans-serif">can you please look at my code.</span><br></pre></div><div><br><br></div>Regards<span class="HOEnZb"><font color="#888888"><br></font></span></div><span class="HOEnZb"><font color="#888888">Samah<br><div><div><div><br><br></div></div></div></font></span></div><div class="HOEnZb"><div class="h5"><div class="gmail_extra"><br><div class="gmail_quote">2015-02-04 20:36 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">Hi Samah,<br>
<br>
Welcome to ITK!<br>
<br>
For a 3D image, the third index of the seed does need to be defined.<br>
<br>
To apply a filter on each slice independently, use the<br>
SliceBySliceImageFilter [1].<br>
<br>
HTH,<br>
Matt<br>
<br>
[1] <a href="http://www.itk.org/Doxygen/html/classitk_1_1SliceBySliceImageFilter.html" target="_blank">http://www.itk.org/Doxygen/html/classitk_1_1SliceBySliceImageFilter.html</a><br>
<div><div><br>
On Wed, Feb 4, 2015 at 1:59 PM, samah bouzidi <<a href="mailto:samah.bouzidi@gmail.com" target="_blank">samah.bouzidi@gmail.com</a>> wrote:<br>
> hello itk users,<br>
><br>
> I am a beginner ITK users. I am trying to segment a volume using region<br>
> growing algorithm. I am able to do it in a 2D image (dicom) but not for a<br>
> volume.<br>
> 1) I saw that for 3D region growing the seed point have 3 coordinates (x, y,<br>
> z). In my case, z is the slice number (i am using .img format). Can I use an<br>
> (x,y) seed point?<br>
> 2) I have another idea, reading an image series and applied the filter for<br>
> each image and then writing them in volume. Are there any examples ( applied<br>
> a filter in image series) that one could help me?<br>
><br>
> regards<br>
> Samah.<br>
><br>
> My source code is as follows<br>
> ================================<br>
> #include "itkConnectedThresholdImageFilter.h"<br>
> #include "itkImage.h"<br>
> #include "itkImageFileReader.h"<br>
> #include "itkImageFileWriter.h"<br>
><br>
> int main( int argc, char *argv[])<br>
> {<br>
> typedef signed short InternalPixelType;<br>
> typedef unsigned char OutputPixelType;<br>
> const unsigned int Dimension = 3;<br>
> typedef itk::Image< InternalPixelType, Dimension > InternalImageType;<br>
><br>
> typedef itk::Image< OutputPixelType, Dimension > OutputImageType;<br>
><br>
> typedef itk::ImageFileReader< InternalImageType > ReaderType;<br>
> typedef itk::ImageFileWriter< OutputImageType > WriterType;<br>
><br>
> ReaderType::Pointer reader = ReaderType::New();<br>
> WriterType::Pointer writer = WriterType::New();<br>
><br>
> reader->SetFileName( "/home/doctorant/Téléchargements/Images/in.img" );<br>
> writer->SetFileName( "/home/doctorant/Téléchargements/Images/out.img");<br>
><br>
><br>
> typedef itk::ConnectedThresholdImageFilter< InternalImageType,<br>
> OutputImageType > ConnectedFilterType;<br>
><br>
> ConnectedFilterType::Pointer connectedThreshold =<br>
> ConnectedFilterType::New();<br>
><br>
> connectedThreshold->SetInput( reader->GetOutput() );<br>
> writer->SetInput( connectedThreshold->GetOutput() );<br>
><br>
><br>
> const InternalPixelType lowerThreshold = -1050 ;<br>
> const InternalPixelType upperThreshold = -600;<br>
><br>
> connectedThreshold->SetLower( lowerThreshold );<br>
> connectedThreshold->SetUpper( upperThreshold );<br>
><br>
> connectedThreshold->SetReplaceValue( 255 );<br>
><br>
><br>
><br>
><br>
> InternalImageType::IndexType index;<br>
> index[0] = 250;<br>
> index[1] = 239;<br>
><br>
> connectedThreshold->SetSeed( index );<br>
><br>
><br>
> try<br>
> {<br>
> writer->Update();<br>
> }<br>
> catch( itk::ExceptionObject & excep )<br>
> {<br>
> std::cerr << "Exception caught !" << std::endl;<br>
> std::cerr << excep << std::endl;<br>
> }<br>
><br>
> return 0;<br>
> }<br>
><br>
</div></div>> _____________________________________<br>
> Powered by <a href="http://www.kitware.com" 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" 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" 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" 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" target="_blank">http://public.kitware.com/mailman/listinfo/insight-users</a><br>
><br>
</blockquote></div><br></div>
</div></div><br>_____________________________________<br>
Powered by <a href="http://www.kitware.com" 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" 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" 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" 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" target="_blank">http://public.kitware.com/mailman/listinfo/insight-users</a><br>
<br></blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature">Christopher Mullins<div>R&D Engineer</div><div>Kitware Inc.,</div><div>919.869.8871</div></div>
</div>