[ITK] [ITK-users] problem with 3d region growing

samah bouzidi samah.bouzidi at gmail.com
Wed Feb 4 15:14:38 EST 2015


hi Matt,

thank you for replying.

I can't find the error in my code (a black volume result)

can you please look at my code.



Regards
Samah



2015-02-04 20:36 GMT+01:00 Matt McCormick <matt.mccormick at kitware.com>:

> Hi Samah,
>
> Welcome to ITK!
>
> For a 3D image, the third index of the seed does need to be defined.
>
> To apply a filter on each slice independently, use the
> SliceBySliceImageFilter [1].
>
> HTH,
> Matt
>
> [1]
> http://www.itk.org/Doxygen/html/classitk_1_1SliceBySliceImageFilter.html
>
> On Wed, Feb 4, 2015 at 1:59 PM, samah bouzidi <samah.bouzidi at gmail.com>
> wrote:
> > hello itk users,
> >
> > I am a beginner ITK users. I am trying to segment a volume using region
> > growing algorithm. I am able to do it in a 2D image (dicom) but not for a
> > volume.
> > 1) I saw that for 3D region growing the seed point have 3 coordinates
> (x, y,
> > z). In my case, z is the slice number (i am using .img format). Can I
> use an
> > (x,y) seed point?
> > 2) I have another idea,  reading an image series  and applied the filter
> for
> > each image and then writing them in volume. Are there any examples (
> applied
> > a filter in image series) that one could help me?
> >
> > regards
> > Samah.
> >
> > My source code is as follows
> > ================================
> > #include "itkConnectedThresholdImageFilter.h"
> > #include "itkImage.h"
> > #include "itkImageFileReader.h"
> > #include "itkImageFileWriter.h"
> >
> > int main( int argc, char *argv[])
> > {
> >   typedef   signed short         InternalPixelType;
> >   typedef   unsigned char        OutputPixelType;
> >   const     unsigned int           Dimension = 3;
> >   typedef itk::Image< InternalPixelType, Dimension > InternalImageType;
> >
> >   typedef itk::Image< OutputPixelType, Dimension > OutputImageType;
> >
> >   typedef  itk::ImageFileReader< InternalImageType > ReaderType;
> >   typedef  itk::ImageFileWriter<  OutputImageType  > WriterType;
> >
> >   ReaderType::Pointer reader = ReaderType::New();
> >   WriterType::Pointer writer = WriterType::New();
> >
> >     reader->SetFileName( "/home/doctorant/Téléchargements/Images/in.img"
> );
> >     writer->SetFileName(
> "/home/doctorant/Téléchargements/Images/out.img");
> >
> >
> >   typedef itk::ConnectedThresholdImageFilter< InternalImageType,
> > OutputImageType > ConnectedFilterType;
> >
> >   ConnectedFilterType::Pointer connectedThreshold =
> > ConnectedFilterType::New();
> >
> >   connectedThreshold->SetInput( reader->GetOutput() );
> >   writer->SetInput( connectedThreshold->GetOutput() );
> >
> >
> >   const InternalPixelType lowerThreshold =  -1050  ;
> >   const InternalPixelType upperThreshold = -600;
> >
> >   connectedThreshold->SetLower(  lowerThreshold  );
> >   connectedThreshold->SetUpper(  upperThreshold  );
> >
> >   connectedThreshold->SetReplaceValue( 255 );
> >
> >
> >
> >
> >   InternalImageType::IndexType  index;
> >   index[0] = 250;
> >   index[1] = 239;
> >
> >   connectedThreshold->SetSeed( index );
> >
> >
> >   try
> >     {
> >     writer->Update();
> >     }
> >   catch( itk::ExceptionObject & excep )
> >     {
> >     std::cerr << "Exception caught !" << std::endl;
> >     std::cerr << excep << std::endl;
> >     }
> >
> >   return 0;
> > }
> >
> > _____________________________________
> > Powered by www.kitware.com
> >
> > Visit other Kitware open-source projects at
> > http://www.kitware.com/opensource/opensource.html
> >
> > Kitware offers ITK Training Courses, for more information visit:
> > http://www.kitware.com/products/protraining.php
> >
> > Please keep messages on-topic and check the ITK FAQ at:
> > http://www.itk.org/Wiki/ITK_FAQ
> >
> > Follow this link to subscribe/unsubscribe:
> > http://public.kitware.com/mailman/listinfo/insight-users
> >
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/community/attachments/20150204/9e917fb3/attachment.html>
-------------- next part --------------
_____________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at
http://www.kitware.com/opensource/opensource.html

Kitware offers ITK Training Courses, for more information visit:
http://www.kitware.com/products/protraining.php

Please keep messages on-topic and check the ITK FAQ at:
http://www.itk.org/Wiki/ITK_FAQ

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/insight-users


More information about the Community mailing list