[Insight-users] problem in using AdaptiveHistogramEqualizationImageFilter

rg32@njit.edu rg32 at njit . edu
Mon, 29 Sep 2003 09:36:09 -0400 (EDT)


Hi All, 
Could anyonr help me with the usage of 
AdaptiveHistogramEqualizationImageFilter.The foll. code compiles but then 
hangs after "Check point 2"
-Rashmi
=================================

void AdaptiveFilter(char * arg1 , char * arg2 )
{
  typedef unsigned char    CharPixelType;  //IO
  typedef float  RealPixelType;  //Operations

  const    unsigned int    Dimension = 2;

  typedef itk::Image<CharPixelType, Dimension>    CharImageType;
  typedef itk::Image<RealPixelType, Dimension>    RealImageType;
  
  typedef itk::ImageFileReader< RealImageType >  ReaderType;
  typedef itk::ImageFileWriter< RealImageType >  WriterType;

  typedef itk::AdaptiveHistogramEqualizationImageFilter<RealImageType> 
AHEIFilterType;


   std::cout<<"Check point 1"";
   //Setting the IO
  ReaderType::Pointer reader = ReaderType::New();
  WriterType::Pointer writer = WriterType::New();	
  
  //Setting the ITK pipeline filter
  
  AHEIFilterType::Pointer AHEIFilterPtr = AHEIFilterType::New();
  
  reader->SetFileName( arg1  );
  writer->SetFileName( arg2 );
  

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


  AHEIFilterPtr->SetAlpha(1);
  AHEIFilterPtr->SetBeta(0);
  //AHEIFilterPtr->SetRadius(1);
  
  std::cout<<"Check point 2";
  AHEIFilterPtr->Update();

  writer->SetInput(AHEIFilterPtr->GetOutput() );
  writer->Update();
 
}

int main( int argc, char * argv[] )
{
  if( argc < 5 ) 
    { 
    std::cerr << "Usage: " << std::endl;
    std::cerr << argv[0] << "  inputImageFile  outputImageFile"<< std::endl;
    return 1;
    }
  AdaptiveFilter(argv[1],argv[2]);
  return 0;
}