<div dir="ltr"><br><br><div class="gmail_quote">---------- Forwarded message ----------<br>From: <b class="gmail_sendername">qt.itk.vtk.help</b> <span dir="ltr"><<a href="mailto:qt.itk.vtk.help@gmail.com">qt.itk.vtk.help@gmail.com</a>></span><br>
Date: Fri, May 31, 2013 at 11:56 AM<br>Subject: Need help in 3D volume segmentation<br>To: Luis Ibanez <<a href="mailto:luis.ibanez@kitware.com">luis.ibanez@kitware.com</a>>, <a href="mailto:Insight-user@itk.org">Insight-user@itk.org</a><br>
<br><br><div dir="ltr">Hi,<div><br></div><div>I am working on connected threshold Segmentation for 3D volume .</div><div># 2D segmentation works fine for me as I have understood the example given by ITK for 2D Image. </div>
<div><br></div><div># Then i tried to convert image reader to Sequence reader that also work fine as I have tested it by saving CurvatureFlowImageFilter result in analyse file.</div><div><br></div><div>
# But when i pass output of CurvatureFlowImageFilter to ConnectedThresholdImageFilter with same <b>seed point and threshold value</b> it give me black output means nothing is segmented.</div><div><br></div><div>
# <b>This is my Code </b></div><div><div><br></div><div>#include "itkConnectedThresholdImageFilter.h"</div><div>#include "itkImage.h"</div><div>#include "itkCastImageFilter.h"</div><div>
#include "itkNumericSeriesFileNames.h"</div><div>#include "itkJPEGImageIO.h"</div><div>#include "itkCurvatureFlowImageFilter.h"</div><div>#include "itkImageSeriesReader.h"</div><div>
#include "itkImageFileReader.h"</div><div>#include "itkImageFileWriter.h"</div><div><br></div><div><br></div><div>int main( int argc, char *argv[])</div><div>{</div><div> </div><div> typedef float InternalPixelType;</div>
<div> const unsigned int Dimension = 3;</div><div> typedef itk::Image< InternalPixelType, Dimension > InternalImageType;</div><div> </div><div><br></div><div><br></div><div> typedef unsigned char OutputPixelType;</div>
<div> typedef itk::Image< OutputPixelType, Dimension > OutputImageType;</div><div> </div><div> typedef itk::CastImageFilter< InternalImageType, OutputImageType >CastingFilterType;</div><div> CastingFilterType::Pointer caster = CastingFilterType::New();</div>
<div><br></div><div> </div><div> typedef itk::ImageSeriesReader< InternalImageType > ReaderType;</div><div> typedef itk::ImageFileWriter< OutputImageType > WriterType;</div><div><br></div><div> ReaderType::Pointer reader = ReaderType::New();</div>
<div> WriterType::Pointer writer = WriterType::New();</div><div><br></div><div> typedef itk::NumericSeriesFileNames NameGeneratorType;</div><div> NameGeneratorType::Pointer nameGenerator = NameGeneratorType::New();</div>
<div><br></div><div> nameGenerator->SetSeriesFormat( "D:/testing_Dataset/WIP/jpg/New_folder/pelvis%04d.jpg" );</div><div> nameGenerator->SetStartIndex( 0000 );</div><div> nameGenerator->SetEndIndex( 0023 );</div>
<div> nameGenerator->SetIncrementIndex( 1 );</div><div><br></div><div> reader->SetImageIO( itk::JPEGImageIO::New() );</div><div> reader->SetFileNames( nameGenerator->GetFileNames() );</div><div> itk::Indent indent;</div>
<div> nameGenerator->Print(std::cout,indent);</div><div> </div><div> writer->SetFileName( "D:\\out.img" );</div><div><br></div><div> typedef itk::CurvatureFlowImageFilter< InternalImageType, InternalImageType >CurvatureFlowImageFilterType;</div>
<div> CurvatureFlowImageFilterType::Pointer smoothing = CurvatureFlowImageFilterType::New();</div><div><br></div><div> typedef itk::ConnectedThresholdImageFilter< InternalImageType, InternalImageType > ConnectedFilterType;</div>
<div> ConnectedFilterType::Pointer connectedThreshold = ConnectedFilterType::New();</div><div> </div><div> </div><div> smoothing->SetInput( reader->GetOutput() );</div><div> connectedThreshold->SetInput( smoothing->GetOutput() );</div>
<div> caster->SetInput( connectedThreshold->GetOutput() );</div><div> writer->SetInput( caster->GetOutput() );</div><div> </div><div> smoothing->SetNumberOfIterations( 5 );</div><div> smoothing->SetTimeStep( 0.125 );</div>
<div> </div><div><br></div><div> const InternalPixelType lowerThreshold = 200;</div><div> const InternalPixelType upperThreshold = 270;</div><div><br></div><div> </div><div> connectedThreshold->SetLower( lowerThreshold );</div>
<div> connectedThreshold->SetUpper( upperThreshold );</div><div> </div><div> connectedThreshold->SetReplaceValue( 255 );</div><div> </div><div> InternalImageType::IndexType index;</div><div><br></div><div> index[0] = 258 ;</div>
<div> index[1] = 226;</div><div><br></div><div><br></div><div> </div><div> connectedThreshold->SetSeed( index );</div><div> </div><div> try</div><div> {</div><div> writer->Update();</div><div> }</div><div>
catch( itk::ExceptionObject & excep )</div><div> {</div><div> std::cerr << "Exception caught !" << std::endl;</div><div> std::cerr << excep << std::endl;</div><div> }</div>
<div> </div><div><br></div><div><br></div><div> return 0;</div><div>}</div><div><br></div><div>Do i need to give more seed points.</div><div>Any help is appreciated.</div><div><br></div><div><br>
</div><div>Thank you,</div><div>Shilpa Dogra </div></div><div><br></div></div>
</div><br></div>