<div>Hi itk users,<br></div>
<div>I’ve tried HybridSegmentationFuzzyVoronoi with 2D images and its working fine. When I try to do the segmentation using the same filter with 3D image I get the error:</div>
<div> </div>
<div>Unhandled exception at 0x7c812afb in best_segmentation.exe: Microsoft C++ exception: itk::ImageFileReaderException at memory location 0x0142faa4</div>
<div> </div>
<div>I past my code bellow. (I use step debug and find the error is caused by the sentence between ==================)<br></div>
<div>Thank you</div>
<div><br>Qiang</div>
<div> </div>
<div>// HybridSegmentationFuzzyVoronoi 3D image<br>#include "itkSimpleFuzzyConnectednessScalarImageFilter.h"<br>#include "itkVoronoiSegmentationImageFilter.h"<br>#include "itkImage.h"<br>#include "itkImageFileReader.h"<br>
#include "itkImageFileWriter.h"<br>#include "itkRescaleIntensityImageFilter.h"<br> <br>int main( void)<br>{<br>typedef float InputPixelType;<br>typedef unsigned char BinaryPixelType;<br>typedef unsigned char OutputPixelType; <br>
const unsigned int Dimension = 3;<br>typedef itk::Image< InputPixelType, Dimension > InputImageType; <br>typedef itk::Image< BinaryPixelType, Dimension > BinaryImageType;<br>typedef itk::Image< OutputPixelType, Dimension > OutputImageType;<br>
<br>typedef itk::SimpleFuzzyConnectednessScalarImageFilter<InputImageType,BinaryImageType> FuzzySegmentationFilterType;<br>typedef itk::VoronoiSegmentationImageFilter<InputImageType, OutputImageType,BinaryImageType> VoronoiSegmentationFilterType;<br>
typedef itk::ImageFileReader< InputImageType > ReaderType;<br>typedef itk::ImageFileWriter< OutputImageType > WriterType;<br>FuzzySegmentationFilterType::Pointer fuzzysegmenter =FuzzySegmentationFilterType::New();<br>
VoronoiSegmentationFilterType::Pointer voronoisegmenter = VoronoiSegmentationFilterType::New();<br>ReaderType::Pointer reader = ReaderType::New();<br>WriterType::Pointer writer = WriterType::New();<br>reader-SetFileName("brainMRI.mha" );<br>
writer->SetFileName("brainMRISeg.mha");<br><br>InputImageType::IndexType index;<br>index[0] = 123;<br>index[1] = 138;<br>index[2] = 15;<br>const float mean = 140;<br>const float variance = 30;<br>const float meanTolerance = 0.2;<br>
const float stdTolerance = 2.0;<br> <br>fuzzysegmenter->SetInput( reader->GetOutput() ); <br>fuzzysegmenter->SetObjectSeed( index );<br>fuzzysegmenter->SetMean( mean );<br>fuzzysegmenter->SetVariance( variance );<br>
fuzzysegmenter->SetThreshold( 0.5 ); <br>fuzzysegmenter->Update();<br></div>
<div>=======================================================<br>voronoisegmenter->SetInput( reader->GetOutput() );<br>=======================================================</div>
<div> </div>
<div>voronoisegmenter->TakeAPrior( fuzzysegmenter->GetOutput() ); <br>voronoisegmenter->SetMeanPercentError( meanTolerance );<br>voronoisegmenter->SetSTDPercentError( stdTolerance ); <br>voronoisegmenter->SetMinRegion( 5); <br>
voronoisegmenter->Update();<br><br>typedef itk::RescaleIntensityImageFilter< OutputImageType,OutputImageType > ScalerFilterType;<br>ScalerFilterType::Pointer scaler = ScalerFilterType::New();<br>scaler->SetOutputMinimum( 0 );<br>
scaler->SetOutputMaximum( 255 );<br>scaler->SetInput( voronoisegmenter->GetOutput() ); <br>writer->SetInput( scaler->GetOutput() );<br>writer->Update();<br><br>return 0;<br>}<br><br><br></div>