本文整理汇总了C++中readertype::Pointer::GetOutput方法的典型用法代码示例。如果您正苦于以下问题:C++ Pointer::GetOutput方法的具体用法?C++ Pointer::GetOutput怎么用?C++ Pointer::GetOutput使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类readertype::Pointer
的用法示例。
在下文中一共展示了Pointer::GetOutput方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main(int argc, char *argv[])
{
std::string inputFileName = argv[1];
std::string outputPrefix = argv[2];
std::cout << "Input: " << inputFileName << std::endl;
std::cout << "Output prefix: " << outputPrefix << std::endl;
typedef itk::ImageFileReader<FloatVectorImageType> ReaderType;
ReaderType::Pointer reader = ReaderType::New();
reader->SetFileName(inputFileName);
reader->Update();
HelpersOutput::WriteVectorImageAsRGB(reader->GetOutput(), outputPrefix + "/Image.mha");
WriteImagePixelsToRGBSpace(reader->GetOutput(), outputPrefix + "/ImageColors.vtp");
WriteClusteredPixelsInRGBSpace(reader->GetOutput(), 20, outputPrefix + "/ImageColorsClustered.vtp");
FloatVectorImageType::Pointer blurred = FloatVectorImageType::New();
//float blurVariance = 2.0f; // almost no visible blurring
//float blurVariance = 10.0f; // slight blurring of concrete
float blurVariance = 30.0f;
Helpers::AnisotropicBlurAllChannels<FloatVectorImageType>(reader->GetOutput(), blurred, blurVariance);
HelpersOutput::WriteVectorImageAsRGB(blurred, outputPrefix + "/BlurredImage.mha");
WriteImagePixelsToRGBSpace(blurred, outputPrefix + "/BlurredImageColors.vtp");
WriteClusteredPixelsInRGBSpace(blurred, 20, outputPrefix + "/BlurredImageColorsClustered.vtp");
return EXIT_SUCCESS;
}
示例2: LoadOverlay
void MriWatcherGUI::LoadOverlay(const QString& filename2)
{
ReaderType::Pointer reader = ReaderType::New();
QString filename = filename2;
filename.replace( QRegExp("\\"), "/" );
reader->SetFileName( filename.toLatin1().constData() );
try
{
reader->Update();
}
catch( itk::ExceptionObject & e )
{
// std::cerr << "Exception in file reader " << std::endl;
// std::cerr << e << std::endl;
QMessageBox::information( this, "MriWatcher", "Unable to load file:\n" + filename);
return;
}
for( unsigned int i = 0; i < m_imageframelist.size(); i++ )
{
m_imageframelist[i]->g_imageframe->SetInputOverlay(reader->GetOutput() );
m_originalimage = reader->GetOutput();
if( m_originalimage.IsNotNull() )
{
m_imagemanager.SetSourceOverlay(m_originalimage);
g_slice_slider->setEnabled(true);
g_overlay_alpha_slider->setEnabled(true);
}
g_loadimg->setDown(false);
g_loadoverlay->setDown(false);
}
}
示例3: LoadImage
// ------------------------------------------------------------------------
void LoadImage(const std::string &filename, ImageType::Pointer &image)
{
typedef itk::Image<unsigned short, 4> InImageType;
typedef itk::ImageFileReader<InImageType> ReaderType;
ReaderType::Pointer reader = ReaderType::New();
reader->SetFileName(filename);
reader->SetImageIO(itk::NrrdImageIO::New());
reader->Update();
typedef itk::ExtractImageFilter<InImageType, ImageType> ExtractorType;
ExtractorType::Pointer extractor = ExtractorType::New();
extractor->SetInput(reader->GetOutput());
InImageType::RegionType exRegion = reader->GetOutput()->GetLargestPossibleRegion();
InImageType::SizeType exSize = exRegion.GetSize();
InImageType::IndexType exIndex = exRegion.GetIndex();
exSize[3] = 0;
exIndex[3] = 0;
exRegion.SetSize(exSize);
exRegion.SetIndex(exIndex);
extractor->SetExtractionRegion(exRegion);
extractor->SetDirectionCollapseToSubmatrix();
extractor->Update();
image = extractor->GetOutput();
}
示例4: writeSeries
// ------------------------------------------------------------------------
void DicomParser::writeSeries(const DicomSeries &series, const QString &outputFolder)
{
// create the series name
QString name = QString::fromStdString(series.description);
name.replace(" ","_");
name += "_" + QString::number(series.images.front().seriesNumber);
name += ".nrrd";
QDir path(outputFolder);
QString fullPath = path.absoluteFilePath(name);
std::vector<DicomImage> images = series.images;
std::sort(images.begin(), images.end());
// write and build the output images
typedef itk::Image<unsigned short, 3> ImageType;
typedef itk::Image<unsigned short, 4> OutputImageType;
typedef itk::ImageFileReader<ImageType> ReaderType;
typedef itk::JoinSeriesImageFilter<ImageType, OutputImageType> JoinerType;
JoinerType::Pointer joiner = JoinerType::New();
ImageType::Pointer orig;
for(unsigned int i = 0; i < images.size(); i++)
{
ReaderType::Pointer reader = ReaderType::New();
reader->SetFileName(images[i].filename);
std::cout << images[i].filename << std::endl;
reader->SetImageIO(itk::GDCMImageIO::New());
reader->Update();
ImageType::Pointer im = reader->GetOutput();
if(i == 0) orig = im;
im->SetOrigin(orig->GetOrigin());
im->SetDirection(orig->GetDirection());
im->SetSpacing(orig->GetSpacing());
joiner->SetInput(i, reader->GetOutput());
}
std::cout << joiner->GetOutput()->GetDirection() << std::endl;
typedef itk::ImageFileWriter<OutputImageType> WriterType;
WriterType::Pointer writer = WriterType::New();
writer->SetInput(joiner->GetOutput());
writer->SetFileName(fullPath.toStdString());
writer->SetImageIO(itk::NrrdImageIO::New());
writer->Update();
}
示例5: main
int main(int argc,char ** argv){
typedef itk::Image<float,3> ImageType;
typedef itk::Image<float,2> SliceType;
typedef itk::ImageFileReader<ImageType> ReaderType;
typedef itk::ImageFileWriter<SliceType> WriterType;
typedef itk::BoundedReciprocalImageFilter<ImageType,ImageType> BoundedReciprocalType;
BoundedReciprocalType::Pointer boundedReciprocal = BoundedReciprocalType::New();
typedef ttt::AdvectiveDiffusion2DIterationImageFilter<SliceType,SliceType> AdvectionDiffusion2DIterationType;
ReaderType::Pointer reader = ReaderType::New();
reader->SetFileName(argv[1]);
reader->UpdateOutputInformation();
typedef itk::ExtractImageFilter<ImageType,SliceType> ExtractorType;
ExtractorType::Pointer extractor = ExtractorType::New();
ImageType::RegionType extractionRegion = reader->GetOutput()->GetLargestPossibleRegion();
extractionRegion.SetSize(2,0);
boundedReciprocal->SetInput(reader->GetOutput());
extractor->SetInput(boundedReciprocal->GetOutput());
extractor->SetExtractionRegion(extractionRegion);
extractor->SetDirectionCollapseToIdentity();
AdvectionDiffusion2DIterationType::Pointer advectionDiffusionIteration =AdvectionDiffusion2DIterationType::New();
advectionDiffusionIteration->SetInput(extractor->GetOutput());
advectionDiffusionIteration->SetNumberOfThreads(1.0);
WriterType::Pointer sliceWriter = WriterType::New();
sliceWriter->SetInput(extractor->GetOutput());
sliceWriter->SetFileName(argv[2]);
sliceWriter->Update();
WriterType::Pointer writer = WriterType::New();
writer->SetFileName(argv[3]);
writer->SetInput(advectionDiffusionIteration->GetOutput());
writer->Update();
}
示例6: main
int main( int argc, char** argv )
{
if( argc < 2 )
{
std::cerr << "Usage: " << argv[0] << " inputImage" << std::endl;
return 1;
}
const unsigned int Dimension = 3;
typedef float PixelType;
typedef itk::Image< PixelType, Dimension > ImageType;
typedef itk::ImageFileReader< ImageType > ReaderType;
ReaderType::Pointer reader = ReaderType::New();
reader->SetFileName( argv[1] );
try
{
reader->Update();
}
catch( itk::ExceptionObject& e )
{
std::cerr << "Error: " << e << std::endl;
return 1;
}
ImageType::ConstPointer output = reader->GetOutput();
typedef itk::BoxMeanImageFilter< ImageType, ImageType > FilterType;
FilterType::Pointer filter = FilterType::New();
filter->SetInput( reader->GetOutput() );
FilterType::RadiusType radius;
radius.Fill( 3 );
filter->SetRadius( radius );
try
{
filter->Update();
}
catch( itk::ExceptionObject& e )
{
std::cerr << "Error: " << e << std::endl;
return 1;
}
return 0;
}
示例7: tr
void MriWatcherGUI::LoadImg2()
{
QString filename = QFileDialog::getOpenFileName(
this,
tr("Select one image files to open"),
QDir::currentPath(),
tr("*.jpg *.gipl* *.raw* *.hdr *.mha *.mhd* *.nhdr* *nrrd* *nii*") );
if( filename != NULL )
{
ReaderType::Pointer reader = ReaderType::New();
reader->SetFileName( filename.toLatin1().constData() );
try
{
reader->Update();
}
catch( itk::ExceptionObject & e )
{
QMessageBox::information( this, "MriWatcher", "Unable to load file:\n" + filename.toLatin1() );
return;
}
m_originalimage = reader->GetOutput();
if( m_originalimage.IsNotNull() )
{
m_imagemanager.SetTargetImage(m_originalimage);
g_alpha->setValue(50);
// g_overlay_alpha_slider->setEnabled(true);
}
g_loadimg2->setDown(false);
}
}
示例8: loadImageSeries
// ------------------------------------------------------------------------
void loadImageSeries(SeriesTransform &series,
const unsigned int &instanceNumbers)
{
// resize the image vector
series.images.resize(series.imageFilenames.size());
typedef itk::GDCMImageIO IOType;
typedef itk::ImageFileReader<ImageType> ReaderType;
for(unsigned int i = 0; i < instanceNumbers; i++)
{
ReaderType::Pointer reader = ReaderType::New();
reader->SetImageIO(IOType::New());
reader->SetFileName(series.imageFilenames[i]);
try
{
reader->Update();
}
catch(itk::ExceptionObject &e)
{
std::cout << e << std::endl;
exit(1);
}
series.images[i] = reader->GetOutput();
}
}
示例9: on_actionReplaceDepthImage_activated
void PTXViewerWidget::on_actionReplaceDepthImage_activated()
{
QString fileName = QFileDialog::getOpenFileName(this, "Open Depth Image", "", "Image Files (*.mha)");
if(fileName.toStdString().empty())
{
std::cout << "Filename was empty." << std::endl;
return;
}
typedef itk::ImageFileReader<PTXImage::FloatImageType> ReaderType;
ReaderType::Pointer reader = ReaderType::New();
reader->SetFileName(fileName.toStdString());
reader->Update();
//this->PTX.ReplaceDepth(reader->GetOutput());
QFuture<void> readerFuture = QtConcurrent::run(&PTX, &PTXImage::ReplaceDepth, reader->GetOutput());
this->FutureWatcher.setFuture(readerFuture);
this->ProgressDialog->setLabelText("Opening depth image...");
this->ProgressDialog->exec();
Display();
this->statusBar()->showMessage("Replaced depth image.");
}
示例10: main
int main (int argc, char *argv[])
{
if(argc != 4)
{
std::cout << "Required arguments: InputFilename(ptx) MaskFilename(png) OutputFilePrefix" << std::endl;
return EXIT_FAILURE;
}
std::string inputFilename = argv[1];
std::string maskFilename = argv[2];
std::string outputFilePrefix = argv[3];
typedef itk::ImageFileReader<itk::Image<unsigned char, 2> > ReaderType;
ReaderType::Pointer maskReader = ReaderType::New();
maskReader->SetFileName(maskFilename);
maskReader->Update();
PTXImage ptxImage = PTXReader::Read(inputFilename);
ptxImage.ApplyMask(maskReader->GetOutput());
ptxImage.WriteRGBImage(outputFilePrefix);
std::stringstream pointsss;
pointsss << outputFilePrefix << ".vtp";
ptxImage.WritePointCloud(pointsss.str());
return EXIT_SUCCESS;
}
示例11: main
int main(int argc, char* argv[])
{
typedef itk::Image<float, 3> ImageType;
typedef itk::ImageFileReader<ImageType> ReaderType;
const char* filenamereader = "/Users/Fabian/Documents/Pruebas/Prueba ITK/Archivo Binary/m1.mhd";
ReaderType::Pointer reader = ReaderType::New();
reader->SetFileName(filenamereader);
reader->Update();
typedef itk::ScalarToFractalImageFilter<ImageType,ImageType> FilterType;
FilterType::Pointer filter = FilterType::New();
filter->SetInput(reader->GetOutput());
FilterType::RadiusType radius;
radius.Fill(3);
filter->SetNeighborhoodRadius(radius);
filter->Update();
// typedef itk::ImageFileWriter<ImageType> WriterType;
// const char* filenamewriter = "xy14_filter.bmp";
// WriterType::Pointer writer = WriterType::New();
// writer->SetFileName(filenamewriter);
// writer->SetInput(filter->GetOutput());
// writer->Update();
return 0;
}
示例12: 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()));
}
示例13: on_btnOpen_clicked
void Form::on_btnOpen_clicked()
{
QString fileName = QFileDialog::getOpenFileName(this, "Open File", ".", "Image Files (*.jpg *.jpeg *.bmp *.png)");
std::cout << "Got filename: " << fileName.toStdString() << std::endl;
if(fileName.toStdString().empty())
{
std::cout << "Filename was empty." << std::endl;
return;
}
/*
typedef itk::RGBPixel<unsigned char> RGBPixelType;
typedef itk::Image<RGBPixelType> RGBImageType;
typedef itk::ImageFileReader<RGBImageType> ReaderType;
ReaderType::Pointer reader = ReaderType::New();
reader->SetFileName(fileName.toStdString());
reader->Update();
RGBImageType::Pointer itkimage = reader->GetOutput();
*/
//typedef itk::VectorImage<unsigned char, 2> ImageType;
typedef itk::VectorImage<char, 2> ImageType;
typedef itk::ImageFileReader<ImageType> ReaderType;
ReaderType::Pointer reader = ReaderType::New();
reader->SetFileName(fileName.toStdString());
reader->Update();
ImageType::Pointer itkimage = reader->GetOutput();
QImage image(itkimage->GetLargestPossibleRegion().GetSize()[0], itkimage->GetLargestPossibleRegion().GetSize()[1], QImage::Format_RGB32);
itk::ImageRegionIterator<ImageType> imageIterator(itkimage, itkimage->GetLargestPossibleRegion());
QColor black(0,0,0);
while(!imageIterator.IsAtEnd())
{
ImageType::PixelType pixel = imageIterator.Get();
//QRgb qtPixel(pixel[0], pixel[1], pixel[2]);
//image.setPixel(imageIterator.GetIndex()[0], imageIterator.GetIndex()[1], QColor(pixel[0], pixel[1], pixel[2]).rgb());
image.setPixel(imageIterator.GetIndex()[0], imageIterator.GetIndex()[1], black.rgb());
++imageIterator;
}
//QPixmap image;
//image.loadFromData(itkimage->GetBufferPointer());
QGraphicsScene* scene = new QGraphicsScene();
//scene->addPixmap(image);
scene->addPixmap(QPixmap::fromImage(image));
this->graphicsView->setScene(scene);
}
示例14: main
int main(int argc, char *argv[])
{
if(argc < 3)
{
std::cerr << "Required: inputFilename outputFilename" << std::endl;
return EXIT_FAILURE;
}
std::string inputFilename = argv[1];
std::string outputFilename = argv[2];
std::cout << "inputFilename " << inputFilename << std::endl;
std::cout << "outputFilename " << outputFilename << std::endl;
typedef itk::ImageFileReader<ImageType> ReaderType;
ReaderType::Pointer reader = ReaderType::New();
reader->SetFileName(inputFilename);
reader->Update();
typedef itk::DerivativeImageFilter<ImageType, ImageType> DerivativeImageFilterType;
DerivativeImageFilterType::Pointer xDerivativeFilter = DerivativeImageFilterType::New();
xDerivativeFilter->SetDirection(0);
xDerivativeFilter->SetOrder(1);
xDerivativeFilter->SetInput(reader->GetOutput());
xDerivativeFilter->Update();
DerivativeImageFilterType::Pointer yDerivativeFilter = DerivativeImageFilterType::New();
yDerivativeFilter->SetOrder(1);
yDerivativeFilter->SetDirection(1);
yDerivativeFilter->SetInput(reader->GetOutput());
yDerivativeFilter->Update();
typedef itk::ComposeImageFilter<ImageType, GradientImageType> ComposeImageFilterType;
ComposeImageFilterType::Pointer composeFilter = ComposeImageFilterType::New();
composeFilter->SetInput1(xDerivativeFilter->GetOutput());
composeFilter->SetInput2(yDerivativeFilter->GetOutput());
composeFilter->Update();
typedef itk::ImageFileWriter<GradientImageType> WriterType;
WriterType::Pointer xWriter = WriterType::New();
xWriter->SetFileName(outputFilename);
xWriter->SetInput(composeFilter->GetOutput());
xWriter->Update();
return EXIT_SUCCESS;
}
示例15: SetUp
virtual void SetUp() {
m_KernelReader = ReaderType::New();
m_InputReader = ReaderType::New();
m_Rescaler = Rescaler01FilterType::New();
m_Rescaler->SetInput(m_InputReader->GetOutput());
m_Rescaler->SetOutputMinimum(0);
m_Rescaler->SetOutputMaximum(1);
m_Deconvoluter = DeconvolutionFilterType::New();
m_Deconvoluter->SetKernelImage( m_KernelReader->GetOutput() );
m_Deconvoluter->SetInput( m_Rescaler->GetOutput() );
m_Writer = WriterType::New();
m_Writer->SetInput( m_Deconvoluter->GetOutput() );
}