[Insight-users] ConfidenceConnectedImageFilter???

Waltraud Henrich henrich@ira.uka.de
Thu, 30 Jan 2003 12:11:32 +0100


Hello,

I work with ConfidenceConnectedImageFilter in order to get the binary image.
I try the example with my pic files in 3D but it did not go, I get the
following mistake 
m_Description	{0x05a43f69 "itk::ERROR: ImageFileWriter(05A273B8): No
ImageIO set, or none could be created."}

so that I try the example in Examples/Segmentation/ConfidenceConnected.cxx.
It's almost completely the example, except the market(**) lines. I get the
following mistake: " Access Violation."in the following line
writer->Update();
Why?



void RegionGrowingModel::ConfidenceConnected()
{	
	const     unsigned int    Dimension = 2;
	typedef itk::Image<float, Dimension> InternalImageType;
	
	
 	 typedef itk::Image<unsigned char, Dimension> ImageTypeUCHAR;
 	 typedef unsigned char OutputPixelType;
  	typedef itk::Image< OutputPixelType, Dimension > OutputImageType;

  	typedef itk::CastImageFilter< 
                        InternalImageType, 
                        OutputImageType    >    CastingFilterType;
  
  	CastingFilterType::Pointer caster = CastingFilterType::New();
                        
  //
  // We instantiate reader and writer types
  //
  
 	 typedef  itk::ImageFileReader< InternalImageType > ReaderType;
 	 typedef  itk::ImageFileWriter<  OutputImageType  > WriterType;

  	ReaderType::Pointer reader = ReaderType::New();
 	 WriterType::Pointer writer = WriterType::New();

  	**	 const char*
filename="D:/user/henrich/pngDaten/BrainProtonDensitySlice.png";n
  	** 	reader->SetFileName(filename );  
  
  
 	** 	 writer->SetFileName("ConfidenceGrowing" );


 	 typedef   itk::CurvatureFlowImageFilter< 
                               InternalImageType, 
                               InternalImageType >
CurvatureFlowImageFilterType;

  	CurvatureFlowImageFilterType::Pointer smoothing = 
                         CurvatureFlowImageFilterType::New();
  
  
  	typedef  itk::ConfidenceConnectedImageFilter< 
                                    InternalImageType, 
                                    InternalImageType > ConnectedFilterType;
 
 	 ConnectedFilterType::Pointer confidenceConnected =
ConnectedFilterType::New();
  

	smoothing->SetInput( reader->GetOutput() );

  	confidenceConnected->SetInput( smoothing->GetOutput() );

  	caster->SetInput( confidenceConnected->GetOutput() );

  	writer->SetInput( caster->GetOutput() );
  
  	smoothing->SetNumberOfIterations( 5 );

  	smoothing->SetTimeStep( 0.25 );
  
  	confidenceConnected->SetMultiplier( 2.5 );
  
  	confidenceConnected->SetNumberOfIterations( 5 );
  
 	 confidenceConnected->SetReplaceValue( 255 );
 

 	 InternalImageType::IndexType  index;


	**	 index[0] =  60;
	**	 index[1] =  116;

  
  
	  confidenceConnected->SetSeed( index );
  
 	 confidenceConnected->SetInitialNeighborhoodRadius( 2 );
  
  
	  try
   	 {
   	 writer->Update();
    	}
	  catch( itk::ExceptionObject & excep )
   	 {
    	std::cerr << "Exception caught !" << std::endl;
  	  std::cerr << excep << std::endl;
   	 }
  
 
}



Thanks in advance.

Waltraut