[Insight-users] problem with adaptive histogram equalization

e_gibson at sympatico.ca e_gibson at sympatico.ca
Wed Jun 21 10:36:51 EDT 2006


i'm new to itk and having some trouble with the adaptive histogram equalization.  my image dimensions are 256x256x1, but if i set the image dimension to 2 in the code below, the program will compile and crash at runtime.  if i leave the code as is, with the image dimension set to 3, the program runs fine and produces reasonable output. with the image dimension set to 2, i can send the output of the reader directly to the writer with no problem, so the problem must be in the filtering step.  any idea what could be wrong?  
 
erin
 
 
  typedef unsigned short InputPixelType;
  static const int ImageDimension = 3;
  //static const int ImageDimension = 2; // doesn't work
 
  typedef itk::Image< InputPixelType, ImageDimension > InputImageType;
  typedef itk::ImageFileReader< InputImageType > ReaderType;
  typedef itk::AdaptiveHistogramEqualizationImageFilter< 
 	          InputImageType > FilterType;
 
  ReaderType::Pointer reader = ReaderType::New();
  reader->SetFileName( "pslice.img" );
 
  FilterType::ImageSizeType radius;
  radius.Fill( 10 );
 
  FilterType::Pointer filter = FilterType::New();
 
  filter->SetInput( reader->GetOutput() );
  filter->SetRadius(radius);
  filter->SetAlpha( 0.2 );
  filter->SetBeta( 0.2 );
 
  typedef itk::ImageFileWriter< InputImageType > WriterType;
 
  WriterType::Pointer writer = WriterType::New();
  writer->SetFileName( "pslice_eq.img" ) ;
  writer->SetInput( filter->GetOutput() );
  writer->Update();




More information about the Insight-users mailing list