<div dir="ltr"><div>hi,<br><br><span id="result_box" class="" lang="en"><span class="">I finished the</span> <span class="">slice</span> <span class="">by</span> <span class="">slice</span> <span class="">region growing</span> <span class="">version of</span> <span class="">code.</span> <span class="">unfortunately</span> <span class="">I have these</span> <span class="">error</span><span>s:</span><br><br> <span class="">1) no</span> <span class="">matching</span> <span class="">function</span> <span class="">for call</span> <span class="">to '</span><span>itk</span> <span class="">::</span> <span class="">ConnectedThresholdImageFilter</span> <span class=""><</span><span>itk</span> <span class="">::</span> <span class="">Image <</span><span class="">short int</span><span>,</span> <span class="">2u</span><span>></span><span>,</span> <span class="">itk</span> <span class="">::</span> <span class="">Image <</span><span>unsigned char</span><span>,</span> <span class="">2u</span><span>></span><span>> ::</span> <span class="">SetSeed</span> <span class="">(</span><span>itk</span> <span class="">::</span> <span class="">Image <</span><span>short int</span><span>,</span> <span class="">3u</span><span>> ::</span> <span class="">INDEXTYPE</span> <span class="">&</span><span class="">) '</span><br><span class="">connectedThreshold-</span><span class="">></span> <span class="">SetSeed</span> <span class="">(index)</span></span><br><br>2) /home/doctorant/src/InsightToolkit-4.7.0/Modules/Segmentation/RegionGrowing/include/itkConnectedThresholdImageFilter.hxx:53:1: note: no known conversion for argument 1 from ‘itk::Image<short int, 3u>::IndexType {aka itk::Index<3u>}’ to ‘const IndexType& {aka const itk::Index<2u>&}’<br><br></div><div><br></div>here is my code :<br><br>#include "itkConnectedThresholdImageFilter.h"
<br>#include "itkImage.h"
<br>#include "itkImageFileReader.h"
<br>#include "itkImageFileWriter.h"
<br>#include "itkSliceBySliceImageFilter.h"
<br>#include "iostream"
<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> const int sliceDim =2;
<br> typedef itk::Image< InternalPixelType, Dimension > InternalImageType; // input
<br> typedef itk::Image< OutputPixelType, Dimension > OutputImageType; //output
<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::SliceBySliceImageFilter< InternalImageType,OutputImageType> SliceBySliceFilterType;
<br> <br> SliceBySliceFilterType::Pointer sliceBySliceFilter = SliceBySliceFilterType::New();
<br> <br> typedef itk::ConnectedThresholdImageFilter< SliceBySliceFilterType::InternalInputImageType,
<br> SliceBySliceFilterType::InternalOutputImageType > ConnectedFilterType;
<br> ConnectedFilterType::Pointer connectedThreshold =ConnectedFilterType::New();
<br> <br> const InternalPixelType lowerThreshold = -3700 ;
<br> const InternalPixelType upperThreshold = -600;
<br> <br> connectedThreshold->SetLower( lowerThreshold );
// error here<br> connectedThreshold->SetUpper( upperThreshold );
//error here<br> connectedThreshold->SetReplaceValue( 255 );
// error here<br> <br> InternalImageType::IndexType index;
<br> index[0] = 257;
<br> index[1] = 449;
<br> connectedThreshold->SetSeed(index);
// error here<br> <br> sliceBySliceFilter -> SetInput(reader->GetOutput());
<br> sliceBySliceFilter->SetFilter(connectedThreshold);
<br> writer->SetInput( sliceBySliceFilter->GetOutput());
<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></div><div class="gmail_extra"><br><div class="gmail_quote">2015-02-06 21:59 GMT+01:00 samah bouzidi <span dir="ltr"><<a href="mailto:samah.bouzidi@gmail.com" target="_blank">samah.bouzidi@gmail.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div>hi, <br><br></div><div><span lang="en"><span>sincerely</span><span>,</span> <span>I fail</span> <span>to understand</span> <span>the response of this</span> <span>filter,</span> <span>the algorithm </span><span>succeeds to segment the region</span> <span>.however, </span><span>in 3D,</span> <span>the first</span> <span>slice</span> <span>is the same </span><span> used</span> <span>to check</span> <span>the segmentation</span> <span>in 2D</span>, <span></span></span><span lang="en"><span>I am not getting</span><span> at least</span> <span>for the first</span> <span>slice</span> <span>the region</span> <span>obtained</span> <span>in 2D.<br></span></span></div><div><span lang="en"><span>ps: the modified code takes into account the third dimension :<br><br></span></span><span class=""><br><span lang="en"><span><span lang="en"><span>InternalImageType::IndexType index;<br> index[0] = 250;<br> index[1] = 239;<br></span></span></span></span></span></div><div><span lang="en"><span><span lang="en"><span> index[2]= 1;<br></span></span></span></span></div><div><span lang="en"><span><span lang="en"><span><br> connectedThreshold->SetSeed( index );<br><br></span></span></span></span><br><span lang="en"><span><span lang="en"><span>any help will be appreciated.
<br>thanks in advance.
<br></span></span><br><br></span></span></div></div><div class="HOEnZb"><div class="h5"><div class="gmail_extra"><br><div class="gmail_quote">2015-02-04 21:24 GMT+01:00 Christopher Mullins <span dir="ltr"><<a href="mailto:christopher.mullins@kitware.com" target="_blank">christopher.mullins@kitware.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><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" target="_blank">https://github.com/InsightSoftwareConsortium/ITK/blob/master/Examples/Segmentation/ConnectedThresholdImageFilter.cxx</a></div></div><div class="gmail_extra"><div><div><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><font color="#888888"><br></font></span></div><span><font color="#888888">Samah<br><div><div><div><br><br></div></div></div></font></span></div><div><div><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></div></div><span><font color="#888888">-- <br><div>Christopher Mullins<div>R&D Engineer</div><div>Kitware Inc.,</div><div><a href="tel:919.869.8871" value="+19198698871" target="_blank">919.869.8871</a></div></div>
</font></span></div>
</blockquote></div><br></div>
</div></div></blockquote></div><br></div>