<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 &quot;itkSimpleFuzzyConnectednessScalarImageFilter.h&quot;<br>#include &quot;itkVoronoiSegmentationImageFilter.h&quot;<br>#include &quot;itkImage.h&quot;<br>#include &quot;itkImageFileReader.h&quot;<br>
#include &quot;itkImageFileWriter.h&quot;<br>#include &quot;itkRescaleIntensityImageFilter.h&quot;<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&lt; InputPixelType, Dimension &gt; InputImageType; <br>typedef itk::Image&lt; BinaryPixelType, Dimension &gt; BinaryImageType;<br>typedef itk::Image&lt; OutputPixelType, Dimension &gt; OutputImageType;<br>
<br>typedef itk::SimpleFuzzyConnectednessScalarImageFilter&lt;InputImageType,BinaryImageType&gt; FuzzySegmentationFilterType;<br>typedef itk::VoronoiSegmentationImageFilter&lt;InputImageType, OutputImageType,BinaryImageType&gt; VoronoiSegmentationFilterType;<br>
typedef itk::ImageFileReader&lt; InputImageType &gt; ReaderType;<br>typedef itk::ImageFileWriter&lt; OutputImageType &gt; 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(&quot;brainMRI.mha&quot; );<br>
writer-&gt;SetFileName(&quot;brainMRISeg.mha&quot;);<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-&gt;SetInput( reader-&gt;GetOutput() ); <br>fuzzysegmenter-&gt;SetObjectSeed( index );<br>fuzzysegmenter-&gt;SetMean( mean );<br>fuzzysegmenter-&gt;SetVariance( variance );<br>
fuzzysegmenter-&gt;SetThreshold( 0.5 ); <br>fuzzysegmenter-&gt;Update();<br></div>
<div>=======================================================<br>voronoisegmenter-&gt;SetInput( reader-&gt;GetOutput() );<br>=======================================================</div>
<div> </div>
<div>voronoisegmenter-&gt;TakeAPrior( fuzzysegmenter-&gt;GetOutput() ); <br>voronoisegmenter-&gt;SetMeanPercentError( meanTolerance );<br>voronoisegmenter-&gt;SetSTDPercentError( stdTolerance ); <br>voronoisegmenter-&gt;SetMinRegion( 5); <br>
voronoisegmenter-&gt;Update();<br><br>typedef itk::RescaleIntensityImageFilter&lt; OutputImageType,OutputImageType &gt; ScalerFilterType;<br>ScalerFilterType::Pointer scaler = ScalerFilterType::New();<br>scaler-&gt;SetOutputMinimum( 0 );<br>
scaler-&gt;SetOutputMaximum( 255 );<br>scaler-&gt;SetInput( voronoisegmenter-&gt;GetOutput() ); <br>writer-&gt;SetInput( scaler-&gt;GetOutput() );<br>writer-&gt;Update();<br><br>return 0;<br>}<br><br><br></div>