[ITK-users] problem with 3d region growing

samah bouzidi samah.bouzidi at gmail.com
Wed Feb 4 13:59:46 EST 2015


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;
}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/insight-users/attachments/20150204/20c66303/attachment.html>


More information about the Insight-users mailing list