<div dir="ltr"><div><div><div><div><div>hi,<br><br></div>thank you <span name="Matt McCormick" class="">Matt McCormick </span><span class="">for your reply</span><font>.<br>I<b><span style="font-weight:normal"><span style="font-family:arial,helvetica,sans-serif"> finally fixed "The Problem"</span></span></b></font>.<br><br></div><div>// the code <br><br>#include "itkConnectedThresholdImageFilter.h"<br>#include "itkImage.h"<br>#include "itkImageFileReader.h"<br>#include "itkImageFileWriter.h"<br>#include "itkSliceBySliceImageFilter.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>  const     unsigned int         sliceDim =2;<br>  typedef itk::Image< InternalPixelType, Dimension > InternalImageType; // input<br>  typedef itk::Image< InternalPixelType, sliceDim > sliceType; // 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>  SliceBySliceFilterType::InternalInputImageType::InternalPixelType lowerThreshold =  -1100;<br>  SliceBySliceFilterType::InternalInputImageType::InternalPixelType upperThreshold = -600;<br>  SliceBySliceFilterType::InternalOutputImageType::InternalPixelType x = 255;<br>  connectedThreshold->SetLower(lowerThreshold);<br>  connectedThreshold->SetUpper(  upperThreshold  );<br>  connectedThreshold->SetReplaceValue( x );<br>  // 250, 239<br>  SliceBySliceFilterType::InternalInputImageType::IndexType  index;<br>    index[0] = 252;<br>    index[1] = 275;<br>  connectedThreshold->SetSeed(index);<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><br></div></div></div></div><span name="Matt McCormick" class=""><br></span><div><div><div><div><div><h3 class=""><span name="Matt McCormick" class=""><br></span></h3><br></div></div></div></div></div></div><div class="gmail_extra"><br><div class="gmail_quote">2015-02-08 21:58 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,<br>
<br>
These errors suggest that a 2D IndexType must be passed.<br>
<br>
HTH,<br>
Matt<br>
<div class="HOEnZb"><div class="h5"><br>
On Sun, Feb 8, 2015 at 7:07 AM, samah bouzidi <<a href="mailto:samah.bouzidi@gmail.com">samah.bouzidi@gmail.com</a>> wrote:<br>
> hi,<br>
><br>
> I finished the slice by slice region growing version of code. unfortunately<br>
> I have these errors:<br>
><br>
> 1) no matching function for call to 'itk :: ConnectedThresholdImageFilter<br>
> <itk :: Image <short int, 2u>, itk :: Image <unsigned char, 2u>> :: SetSeed<br>
> (itk :: Image <short int, 3u> :: INDEXTYPE &) '<br>
> connectedThreshold-> SetSeed (index)<br>
><br>
> 2)<br>
> /home/doctorant/src/InsightToolkit-4.7.0/Modules/Segmentation/RegionGrowing/include/itkConnectedThresholdImageFilter.hxx:53:1:<br>
> note:   no known conversion for argument 1 from ‘itk::Image<short int,<br>
> 3u>::IndexType {aka itk::Index<3u>}’ to ‘const IndexType& {aka const<br>
> itk::Index<2u>&}’<br>
><br>
><br>
> 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; //<br>
> 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><br>
> SliceBySliceFilterType;<br>
><br>
>   SliceBySliceFilterType::Pointer sliceBySliceFilter =<br>
> SliceBySliceFilterType::New();<br>
><br>
>   typedef itk::ConnectedThresholdImageFilter<<br>
> SliceBySliceFilterType::InternalInputImageType,<br>
>           SliceBySliceFilterType::InternalOutputImageType ><br>
> ConnectedFilterType;<br>
>   ConnectedFilterType::Pointer connectedThreshold<br>
> =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>
><br>
> 2015-02-06 21:59 GMT+01:00 samah bouzidi <<a href="mailto:samah.bouzidi@gmail.com">samah.bouzidi@gmail.com</a>>:<br>
>><br>
>> hi,<br>
>><br>
>> sincerely, I fail to understand the response of this filter, the algorithm<br>
>> succeeds to segment the region .however, in 3D, the first  slice is the same<br>
>> used to check the segmentation in 2D, I am not getting at least for the<br>
>> first slice the region obtained in 2D.<br>
>> ps: the modified code takes into account the third dimension :<br>
>><br>
>><br>
>> InternalImageType::IndexType  index;<br>
>>   index[0] = 250;<br>
>>   index[1] = 239;<br>
>>   index[2]= 1;<br>
>><br>
>>   connectedThreshold->SetSeed( index );<br>
>><br>
>><br>
>> any help will be appreciated.<br>
>> thanks in advance.<br>
>><br>
>><br>
>><br>
>> 2015-02-04 21:24 GMT+01:00 Christopher Mullins<br>
>> <<a href="mailto:christopher.mullins@kitware.com">christopher.mullins@kitware.com</a>>:<br>
>>><br>
>>> The ConnectedThresholdImageFilter example [1] might be of use.<br>
>>><br>
>>> [1]<br>
>>> <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><br>
>>><br>
>>> On Wed, Feb 4, 2015 at 3:14 PM, samah bouzidi <<a href="mailto:samah.bouzidi@gmail.com">samah.bouzidi@gmail.com</a>><br>
>>> wrote:<br>
>>>><br>
>>>> hi Matt,<br>
>>>><br>
>>>> thank you for replying.<br>
>>>><br>
>>>> I can't find the error in my code (a black volume result)<br>
>>>><br>
>>>> can you please look at my code.<br>
>>>><br>
>>>><br>
>>>><br>
>>>> Regards<br>
>>>> Samah<br>
>>>><br>
>>>><br>
>>>><br>
>>>> 2015-02-04 20:36 GMT+01:00 Matt McCormick <<a href="mailto:matt.mccormick@kitware.com">matt.mccormick@kitware.com</a>>:<br>
>>>>><br>
>>>>> 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]<br>
>>>>> <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>
>>>>><br>
>>>>> On Wed, Feb 4, 2015 at 1:59 PM, samah bouzidi <<a href="mailto:samah.bouzidi@gmail.com">samah.bouzidi@gmail.com</a>><br>
>>>>> wrote:<br>
>>>>> > hello itk users,<br>
>>>>> ><br>
>>>>> > I am a beginner ITK users. I am trying to segment a volume using<br>
>>>>> > region<br>
>>>>> > growing algorithm. I am able to do it in a 2D image (dicom) but not<br>
>>>>> > for a<br>
>>>>> > volume.<br>
>>>>> > 1) I saw that for 3D region growing the seed point have 3 coordinates<br>
>>>>> > (x, y,<br>
>>>>> > z). In my case, z is the slice number (i am using .img format). Can I<br>
>>>>> > use an<br>
>>>>> > (x,y) seed point?<br>
>>>>> > 2) I have another idea,  reading an image series  and applied the<br>
>>>>> > filter for<br>
>>>>> > each image and then writing them in volume. Are there any examples (<br>
>>>>> > 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 ><br>
>>>>> > 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(<br>
>>>>> > "/home/doctorant/Téléchargements/Images/in.img" );<br>
>>>>> >     writer->SetFileName(<br>
>>>>> > "/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>
>>>>> > _____________________________________<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>
>>>><br>
>>>><br>
>>>><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>
>>><br>
>>><br>
>>><br>
>>> --<br>
>>> Christopher Mullins<br>
>>> R&D Engineer<br>
>>> Kitware Inc.,<br>
>>> <a href="tel:919.869.8871" value="+19198698871">919.869.8871</a><br>
>><br>
>><br>
><br>
><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>
</div></div></blockquote></div><br></div>