本文整理汇总了C++中readertype::Pointer::AddObserver方法的典型用法代码示例。如果您正苦于以下问题:C++ Pointer::AddObserver方法的具体用法?C++ Pointer::AddObserver怎么用?C++ Pointer::AddObserver使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类readertype::Pointer
的用法示例。
在下文中一共展示了Pointer::AddObserver方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: retrieveITKImage
//read CT image
void CTImageTreeItem::retrieveITKImage(QProgressDialog *progress, int progressScale, int progressBase) {
//define and create file reader
typedef ReaderProgress::ReaderType ReaderType;
ReaderType::Pointer imageReader = ReaderType::New();
ReaderType::FileNamesContainer fc;
//assign filenames
fc.assign(m_fnList.begin(), m_fnList.end());
//set ImageIO and filenames
itk::GDCMImageIO::Pointer gdcmImageIO = itk::GDCMImageIO::New();
imageReader->SetImageIO( gdcmImageIO );
imageReader->SetFileNames(fc);
//create reader progress
ReaderProgress::Pointer progressor = ReaderProgress::New();
if (progress)
{
progressor->setDialog( progress, progressScale, progressBase );
imageReader->AddObserver(itk::AnyEvent(), progressor);
}
//try to read the images
try {
imageReader->Update();
}catch( itk::ExceptionObject & excep ) {
std::cerr << "Exception caught !" << std::endl;
std::cerr << excep << std::endl;
}
//assign the reader output to an image pointer
ImageType::Pointer imagePtr = imageReader->GetOutput();
setITKImage(imagePtr, 1);
//emit signal, that data has changed
m_model->dataChanged(m_model->createIndex(childNumber(),0,parent()),m_model->createIndex(childNumber(),columnCount()-1,parent()));
}