[Insight-users] Generating Imag from Histogram using Intensity
Function
Lars Nygard
lnygard at yahoo.com
Tue Aug 14 06:46:39 EDT 2007
Hi all,
Im trying to make an applet where I scroll through an image and
where I can see the histogram of every slice. However Im getting
an error from windows when I try to update the HistogramToIntensityImageFilter.
Im first trying with a 2D png image.
Ive tried to catch the error but windows is giving an error and I don't know what's
wrong. The code is bellow. Anybody got an idea what's wrong??
thanks,
Lars Nygard
//Declare input Image
typedef unsigned char PixelType;
const unsigned int Dimension = 2;
typedef unsigned char MeasurementType ;
typedef itk::Image< PixelType, Dimension > ImageType;
typedef itk::Image< unsigned char, 2> BinImageType;
//reader
typedef itk::ImageFileReader< ImageType > ReaderType;
ReaderType::Pointer reader = ReaderType::New();
reader->SetFileName( "BrainSliceT1.png" );
//code for generating the histogram
typedef itk::Statistics::ScalarImageToHistogramGenerator< ImageType > HistogramGenType;
typedef HistogramGenType::HistogramType HistogramType;
HistogramGenType::Pointer genhistogram = HistogramGenType::New();
genhistogram->SetNumberOfBins( 256 );
//code for converting histogram to image
typedef itk::HistogramToIntensityImageFilter< HistogramType > HistogramToImageType;
HistogramToImageType::Pointer histToImage = HistogramToImageType::New();
//pipeline
genhistogram->SetInput( reader->GetOutput() );
histToImage->SetInput( genhistogram->GetOutput() );
reader->Update();
//here windows gives an error and the program aborts
try
{
histToImage->Update();
}
catch( itk::ExceptionObject & excp )
{
std::cerr << "Exception thrown while reading image" << excp << std::endl;
}
_________________________________________________________
Alt i én. Få Yahoo! Mail med adressekartotek, kalender og
notisblokk. http://no.mail.yahoo.com
More information about the Insight-users
mailing list