本文整理汇总了C++中imagereadertype::Pointer::SetFileName方法的典型用法代码示例。如果您正苦于以下问题:C++ Pointer::SetFileName方法的具体用法?C++ Pointer::SetFileName怎么用?C++ Pointer::SetFileName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类imagereadertype::Pointer
的用法示例。
在下文中一共展示了Pointer::SetFileName方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main (int argc, char *argv[])
{
if(argc != 4)
{
std::cout << "Required arguments: InputFilename(ptx) NewRGB(mhd) OutputFilename(ptx)" << std::endl;
return EXIT_FAILURE;
}
std::string inputFilename = argv[1];
std::string newDepthImageFilename = argv[2];
std::string outputFilename = argv[3];
PTXImage ptxImage = PTXReader::Read(inputFilename);
typedef itk::ImageFileReader<PTXImage::RGBVectorImageType> ImageReaderType;
ImageReaderType::Pointer reader = ImageReaderType::New();
reader->SetFileName(newDepthImageFilename);
reader->Update();
if(reader->GetOutput()->GetLargestPossibleRegion().GetSize() != ptxImage.GetSize())
{
std::cerr << "RGB image must be the same size as PTX image!" << std::endl;
exit(-1);
}
ptxImage.ReplaceRGB(reader->GetOutput());
ptxImage.WritePTX(outputFilename);
return EXIT_SUCCESS;
}
示例2: ReadFromImage
void Mask::ReadFromImage(const std::string& filename,
const HolePixelValueWrapper<TPixel>& holeValue,
const ValidPixelValueWrapper<TPixel>& validValue)
{
std::cout << "Reading mask from image: " << filename << std::endl;
// Ensure the input image can be interpreted as a mask.
unsigned int numberOfComponents = GetNumberOfComponentsPerPixelInFile( filename );
if(!(numberOfComponents == 1 || numberOfComponents == 3))
{
std::stringstream ss;
ss << "Number of components for a mask must be 1 or 3! (" << filename
<< " is " << numberOfComponents << ")";
throw std::runtime_error(ss.str());
}
// Read the image
typedef int ReadPixelType;
typedef itk::Image<ReadPixelType, 2> ImageType;
typedef itk::ImageFileReader<ImageType> ImageReaderType;
ImageReaderType::Pointer imageReader = ImageReaderType::New();
imageReader->SetFileName(filename);
imageReader->Update();
this->SetRegions(imageReader->GetOutput()->GetLargestPossibleRegion());
this->Allocate();
CreateHolesFromValue(imageReader->GetOutput(),
static_cast<ReadPixelType>(holeValue.Value));
CreateValidPixelsFromValue(imageReader->GetOutput(),
static_cast<ReadPixelType>(validValue.Value));
}
示例3: main
// Run with: image.png image.mask 15 filled.png
int main(int argc, char *argv[])
{
// Verify arguments
if(argc != 5)
{
std::cerr << "Required arguments: image.png image.mask patchHalfWidth output.png" << std::endl;
std::cerr << "Input arguments: ";
for(int i = 1; i < argc; ++i)
{
std::cerr << argv[i] << " ";
}
return EXIT_FAILURE;
}
// Parse arguments
std::string imageFilename = argv[1];
std::string maskFilename = argv[2];
std::stringstream ssPatchRadius;
ssPatchRadius << argv[3];
unsigned int patchHalfWidth = 0;
ssPatchRadius >> patchHalfWidth;
std::string outputFilename = argv[4];
// Output arguments
std::cout << "Reading image: " << imageFilename << std::endl;
std::cout << "Reading mask: " << maskFilename << std::endl;
std::cout << "Patch half width: " << patchHalfWidth << std::endl;
std::cout << "Output: " << outputFilename << std::endl;
typedef itk::Image<itk::CovariantVector<float, 3>, 2> ImageType;
typedef itk::ImageFileReader<ImageType> ImageReaderType;
ImageReaderType::Pointer imageReader = ImageReaderType::New();
imageReader->SetFileName(imageFilename);
imageReader->Update();
ImageType::Pointer image = ImageType::New();
ITKHelpers::DeepCopy(imageReader->GetOutput(), image.GetPointer());
Mask::Pointer mask = Mask::New();
mask->Read(maskFilename);
std::cout << "Mask size: " << mask->GetLargestPossibleRegion().GetSize() << std::endl;
std::cout << "hole pixels: " << mask->CountHolePixels() << std::endl;
std::cout << "valid pixels: " << mask->CountValidPixels() << std::endl;
// Setup the GUI system
QApplication app( argc, argv );
// Without this, after we close the first dialog
// (after the first iteration that is not accepted automatically), the event loop quits.
app.setQuitOnLastWindowClosed(false);
DummyPatchesDriver(image, mask, patchHalfWidth);
return app.exec();
}
示例4: ApplyDeformationField
void QmitkDeformableRegistrationView::ApplyDeformationField()
{
ImageReaderType::Pointer reader = ImageReaderType::New();
reader->SetFileName( m_Controls.m_QmitkBSplineRegistrationViewControls->m_Controls.m_DeformationField->text().toStdString() );
reader->Update();
DeformationFieldType::Pointer deformationField = reader->GetOutput();
mitk::Image * mimage = dynamic_cast<mitk::Image*> (m_MovingNode->GetData());
mitk::Image * fimage = dynamic_cast<mitk::Image*> (m_FixedNode->GetData());
typedef itk::Image<float, 3> FloatImageType;
FloatImageType::Pointer itkMovingImage = FloatImageType::New();
FloatImageType::Pointer itkFixedImage = FloatImageType::New();
mitk::CastToItkImage(mimage, itkMovingImage);
mitk::CastToItkImage(fimage, itkFixedImage);
typedef itk::WarpImageFilter<
FloatImageType,
FloatImageType,
DeformationFieldType > WarperType;
typedef itk::LinearInterpolateImageFunction<
FloatImageType,
double > InterpolatorType;
WarperType::Pointer warper = WarperType::New();
InterpolatorType::Pointer interpolator = InterpolatorType::New();
warper->SetInput( itkMovingImage );
warper->SetInterpolator( interpolator );
warper->SetOutputSpacing( itkFixedImage->GetSpacing() );
warper->SetOutputOrigin( itkFixedImage->GetOrigin() );
warper->SetOutputDirection (itkFixedImage->GetDirection() );
warper->SetDisplacementField( deformationField );
warper->Update();
FloatImageType::Pointer outputImage = warper->GetOutput();
mitk::Image::Pointer result = mitk::Image::New();
mitk::CastToMitkImage(outputImage, result);
// Create new DataNode
mitk::DataNode::Pointer newNode = mitk::DataNode::New();
newNode->SetData( result );
newNode->SetProperty( "name", mitk::StringProperty::New("warped image") );
// add the new datatree node to the datatree
this->GetDefaultDataStorage()->Add(newNode);
mitk::RenderingManager::GetInstance()->RequestUpdateAll();
//Image::Pointer outputImage = this->GetOutput();
//mitk::CastToMitkImage( warper->GetOutput(), outputImage );
}
示例5: runtime_error
void ForegroundBackgroundSegmentMask::
ReadFromImage(const std::string& filename,
const ForegroundPixelValueWrapper<TPixel>& foregroundValue,
const BackgroundPixelValueWrapper<TPixel>& backgroundValue)
{
std::cout << "Reading mask from image: " << filename << std::endl;
// Ensure the input image can be interpreted as a mask.
unsigned int numberOfComponents =
ITKHelpers::GetNumberOfComponentsPerPixelInFile(filename);
if(!(numberOfComponents == 1 || numberOfComponents == 3))
{
std::stringstream ss;
ss << "Number of components for a mask must be 1 or 3! (" << filename
<< " is " << numberOfComponents << ")";
throw std::runtime_error(ss.str());
}
// Read the image
typedef int ReadPixelType;
typedef itk::Image<ReadPixelType, 2> ImageType;
typedef itk::ImageFileReader<ImageType> ImageReaderType;
ImageReaderType::Pointer imageReader = ImageReaderType::New();
imageReader->SetFileName(filename);
imageReader->Update();
this->SetRegions(imageReader->GetOutput()->GetLargestPossibleRegion());
this->Allocate();
itk::ImageRegionConstIteratorWithIndex<ImageType>
imageIterator(imageReader->GetOutput(),
imageReader->GetOutput()->GetLargestPossibleRegion());
while(!imageIterator.IsAtEnd())
{
if(imageIterator.Get() == foregroundValue.Value)
{
this->SetPixel(imageIterator.GetIndex(),
ForegroundBackgroundSegmentMaskPixelTypeEnum::FOREGROUND);
}
else if(imageIterator.Get() == backgroundValue.Value)
{
this->SetPixel(imageIterator.GetIndex(),
ForegroundBackgroundSegmentMaskPixelTypeEnum::BACKGROUND);
}
else
{
std::cerr << "Warning: Pixels with value " << imageIterator.Get()
<< " found and is being ignored." << std::endl;
// std::cerr << "Warning: Pixels with values other than the specified foreground "
// "and background values exist in the image and are being ignored." << std::endl;
}
++imageIterator;
}
}
示例6: main
int main(int argc, char*argv[])
{
if(argc < 4)
{
std::cerr << "Required arguments: image mask output" << std::endl;
return EXIT_FAILURE;
}
std::string imageFilename = argv[1];
std::string maskFilename = argv[2];
std::string outputFilename = argv[3];
std::cout << "imageFilename: " << imageFilename << std::endl;
std::cout << "maskFilename: " << maskFilename << std::endl;
std::cout << "outputFilename: " << outputFilename << std::endl;
typedef itk::ImageFileReader<ImageType> ImageReaderType;
ImageReaderType::Pointer imageReader = ImageReaderType::New();
imageReader->SetFileName(imageFilename);
imageReader->Update();
Mask::Pointer sourceMask = Mask::New();
sourceMask->Read(maskFilename);
Mask::Pointer targetMask = Mask::New();
targetMask->SetRegions(sourceMask->GetLargestPossibleRegion());
targetMask->Allocate();
ITKHelpers::SetImageToConstant(targetMask.GetPointer(), HoleMaskPixelTypeEnum::VALID);
typedef SSD<ImageType> DistanceFunctorType;
DistanceFunctorType* patchDistanceFunctor = new DistanceFunctorType;
patchDistanceFunctor->SetImage(imageReader->GetOutput());
typedef Propagator<DistanceFunctorType> PropagatorType;
PropagatorType* propagationFunctor = new PropagatorType;
typedef RandomSearch<ImageType, DistanceFunctorType> RandomSearchType;
RandomSearchType* randomSearchFunctor = new RandomSearchType;
typedef PatchMatch<ImageType, PropagatorType, RandomSearchType> PatchMatchType;
PatchMatchType patchMatch;
patchMatch.SetImage(imageReader->GetOutput());
patchMatch.SetPatchRadius(3);
patchMatch.SetPropagationFunctor(propagationFunctor);
patchMatch.SetRandomSearchFunctor(randomSearchFunctor);
patchMatch.Compute();
NNFieldType::Pointer output = patchMatch.GetNNField();
PatchMatchHelpers::WriteNNField(output.GetPointer(), "nnfield.mha");
return EXIT_SUCCESS;
}
示例7: main
int main(int argc, char*argv[])
{
if(argc != 4)
{
std::cerr << "Required arguments: image mask output" << std::endl;
return EXIT_FAILURE;
}
std::string imageFilename = argv[1];
std::string maskFilename = argv[2];
std::string outputFilename = argv[3];
std::cout << "Reading image: " << imageFilename << std::endl;
std::cout << "Reading mask: " << maskFilename << std::endl;
std::cout << "Output: " << outputFilename << std::endl;
//typedef itk::Image<float, 2> ImageType;
//typedef itk::Image<itk::CovariantVector<unsigned char, 3>, 2> ImageType;
// ImageType::PixelType color;
// color[0] = 0;
// color[1] = 255;
// color[2] = 0;
typedef itk::VectorImage<float, 2> ImageType;
// ImageType::PixelType color;
// color.SetRed(0);
// color.SetGreen(255);
// color.SetBlue(0);
typedef itk::ImageFileReader<ImageType> ImageReaderType;
ImageReaderType::Pointer imageReader = ImageReaderType::New();
imageReader->SetFileName(imageFilename.c_str());
imageReader->Update();
ImageType::PixelType value(imageReader->GetOutput()->GetNumberOfComponentsPerPixel());
value.Fill(0);
Mask::Pointer mask = Mask::New();
mask->Read(maskFilename.c_str());
mask->ApplyToImage(imageReader->GetOutput(), value);
OutputHelpers::WriteImage(imageReader->GetOutput(), outputFilename);
return EXIT_SUCCESS;
}
示例8: OpenImage
void SuperPixelSegmentationGUI::OpenImage(const std::string& imageFileName)
{
// Load and display image
typedef itk::ImageFileReader<ImageType> ImageReaderType;
ImageReaderType::Pointer imageReader = ImageReaderType::New();
imageReader->SetFileName(imageFileName);
imageReader->Update();
Helpers::DeepCopy<ImageType>(imageReader->GetOutput(), this->Image);
QImage qimageImage = HelpersQt::GetQImageRGBA<ImageType>(this->Image);
this->ImagePixmapItem = this->Scene->addPixmap(QPixmap::fromImage(qimageImage));
this->graphicsView->fitInView(this->ImagePixmapItem);
Refresh();
}
示例9: runtime_error
void StrokeMask::
ReadFromImage(const std::string& filename,
const TPixel& strokeValue)
{
std::cout << "Reading stroke mask from image: " << filename << std::endl;
// Ensure the input image can be interpreted as a mask.
unsigned int numberOfComponents =
ITKHelpers::GetNumberOfComponentsPerPixelInFile(filename);
if(!(numberOfComponents == 1 || numberOfComponents == 3))
{
std::stringstream ss;
ss << "Number of components for a mask must be 1 or 3! (" << filename
<< " is " << numberOfComponents << ")";
throw std::runtime_error(ss.str());
}
// Read the image
typedef int ReadPixelType;
typedef itk::Image<ReadPixelType, 2> ImageType;
typedef itk::ImageFileReader<ImageType> ImageReaderType;
ImageReaderType::Pointer imageReader = ImageReaderType::New();
imageReader->SetFileName(filename);
imageReader->Update();
this->SetRegions(imageReader->GetOutput()->GetLargestPossibleRegion());
this->Allocate();
itk::ImageRegionConstIteratorWithIndex<ImageType>
imageIterator(imageReader->GetOutput(),
imageReader->GetOutput()->GetLargestPossibleRegion());
while(!imageIterator.IsAtEnd())
{
if(imageIterator.Get() == strokeValue)
{
this->SetPixel(imageIterator.GetIndex(),
StrokeMaskPixelTypeEnum::STROKE);
}
else
{
this->SetPixel(imageIterator.GetIndex(),
StrokeMaskPixelTypeEnum::NOTSTROKE);
}
++imageIterator;
}
}
示例10: main
int main(int argc, char *argv[])
{
// Verify arguments
if(argc != 5)
{
std::cerr << "Required arguments: image imageMask patchRadius output" << std::endl;
return EXIT_FAILURE;
}
// Parse arguments
std::string imageFilename = argv[1];
std::string maskFilename = argv[2];
std::stringstream ssPatchRadius;
ssPatchRadius << argv[3];
int patchRadius = 0;
ssPatchRadius >> patchRadius;
std::string outputFilename = argv[4];
// Output arguments
std::cout << "Reading image: " << imageFilename << std::endl;
std::cout << "Reading mask: " << maskFilename << std::endl;
std::cout << "Patch radius: " << patchRadius << std::endl;
std::cout << "Output: " << outputFilename << std::endl;
typedef itk::ImageFileReader< FloatVectorImageType > ImageReaderType;
ImageReaderType::Pointer imageReader = ImageReaderType::New();
imageReader->SetFileName(imageFilename.c_str());
imageReader->Update();
typedef itk::ImageFileReader< Mask > MaskReaderType;
MaskReaderType::Pointer maskReader = MaskReaderType::New();
maskReader->SetFileName(maskFilename.c_str());
maskReader->Update();
CriminisiInpainting Inpainting;
Inpainting.SetPatchRadius(patchRadius);
Inpainting.SetDebug(false);
Inpainting.SetImage(imageReader->GetOutput());
Inpainting.SetMask(maskReader->GetOutput());
Inpainting.Inpaint();
Helpers::WriteImage<FloatVectorImageType>(Inpainting.GetResult(), outputFilename);
return EXIT_SUCCESS;
}
示例11: main
int main(int argc, char *argv[])
{
if(argc != 3)
{
std::cerr << "Required arguments: image mask" << std::endl;
return EXIT_FAILURE;
}
std::string imageFilename = argv[1];
std::string maskFilename = argv[2];
std::cout << "Reading image: " << imageFilename << std::endl;
std::cout << "Reading mask: " << maskFilename << std::endl;
typedef itk::ImageFileReader<FloatVectorImageType> ImageReaderType;
ImageReaderType::Pointer imageReader = ImageReaderType::New();
imageReader->SetFileName(imageFilename.c_str());
imageReader->Update();
typedef itk::ImageFileReader<Mask> MaskReaderType;
MaskReaderType::Pointer maskReader = MaskReaderType::New();
maskReader->SetFileName(maskFilename.c_str());
maskReader->Update();
std::shared_ptr<SelfPatchCompare> patchCompare(new SelfPatchCompare);
patchCompare->SetNumberOfComponentsPerPixel(imageReader->GetOutput()->GetNumberOfComponentsPerPixel());
//patchCompare->FunctionsToCompute.push_back(boost::bind(&SelfPatchCompare::SetPatchAverageAbsoluteSourceDifference,patchCompare,_1));
//patchCompare->FunctionsToCompute.push_back(boost::bind(&SelfPatchCompare::SetPatchColorDifference,patchCompare,_1));
patchCompare->FunctionsToCompute.push_back(boost::bind(&SelfPatchCompare::SetPatchDepthDifference,patchCompare.get(),_1));
//patchCompare->SetImage(imageReader->GetOutput());
//patchCompare->SetMask(maskReader->GetOutput());
PatchBasedInpainting inpainting;
inpainting.SetMask(maskReader->GetOutput());
inpainting.SetImage(imageReader->GetOutput());
//inpainting.PatchSortFunction = &SortByDepthDifference;
//inpainting.SetPatchCompare(patchCompare);
inpainting.Initialize();
inpainting.Iterate();
CandidatePairs candidatePairs = inpainting.GetPotentialCandidatePairs()[0];
//patchCompare->SetPairs(&candidatePairs);
//patchCompare->ComputeAllSourceDifferences();
WriteImageOfScores(candidatePairs, imageReader->GetOutput()->GetLargestPossibleRegion(), "ScoreImage_TargetPatch.mha");
return EXIT_SUCCESS;
}
示例12: readBinaryImage
BinaryImageType::Pointer readBinaryImage(const std::string& filename) {
ImageReaderType::Pointer reader = ImageReaderType::New();
reader->SetFileName(filename.c_str());
reader->Update();
// we make sure that the image really has value 0 and 1
typedef itk::BinaryThresholdImageFilter<BinaryImageType, BinaryImageType> ThresholdFilterType;
ThresholdFilterType::Pointer thresholdFilter = ThresholdFilterType::New();
thresholdFilter->SetInsideValue(1);
thresholdFilter->SetOutsideValue(0);
thresholdFilter->SetLowerThreshold(1);
thresholdFilter->SetUpperThreshold(255);
thresholdFilter->SetInput(reader->GetOutput());
thresholdFilter->Update();
BinaryImageType::Pointer img = thresholdFilter->GetOutput();
img->DisconnectPipeline();
return img;
}
示例13: PrintDeformationField
void QmitkBSplineRegistrationView::PrintDeformationField()
{
ImageReaderType::Pointer reader = ImageReaderType::New();
reader->SetFileName( m_Controls.m_DeformationField->text().toStdString() );
reader->Update();
DeformationFieldType::Pointer deformationField = reader->GetOutput();
typedef itk::ImageRegionIterator<DeformationFieldType> IteratorType;
IteratorType deformIter(deformationField, deformationField->GetRequestedRegion());
for(deformIter.GoToBegin(); !deformIter.IsAtEnd(); ++deformIter)
{
std::cout << deformIter.Get() << std::endl;
}
}
示例14: main
int main(int argc, char*argv[])
{
if(argc != 5)
{
std::cerr << "Required arguments: image mask kernelRadius output" << std::endl;
return EXIT_FAILURE;
}
std::string imageFilename = argv[1];
std::string maskFilename = argv[2];
std::stringstream ssRadius;
ssRadius << argv[3];
unsigned int kernelRadius = 0;
ssRadius >> kernelRadius;
std::string outputFilename = argv[4];
std::cout << "Reading image: " << imageFilename << std::endl;
std::cout << "Reading mask: " << maskFilename << std::endl;
std::cout << "Kernel radius: " << kernelRadius << std::endl;
std::cout << "Output: " << outputFilename << std::endl;
typedef itk::Image<float, 2> ImageType;
typedef itk::ImageFileReader<ImageType> ImageReaderType;
ImageReaderType::Pointer imageReader = ImageReaderType::New();
imageReader->SetFileName(imageFilename.c_str());
imageReader->Update();
Mask::Pointer mask = Mask::New();
mask->Read(maskFilename.c_str());
MaskOperations::MedianFilterInHole(imageReader->GetOutput(), mask, kernelRadius);
OutputHelpers::WriteImage(imageReader->GetOutput(), outputFilename);
return EXIT_SUCCESS;
}
示例15: main
// Run with: Data/trashcan.mha Data/trashcan_mask.mha 15 filled.mha
int main(int argc, char *argv[])
{
// Verify arguments
if(argc != 6)
{
std::cerr << "Required arguments: image.mha imageMask.mha patchHalfWidth neighborhoodRadius output.mha" << std::endl;
std::cerr << "Input arguments: ";
for(int i = 1; i < argc; ++i)
{
std::cerr << argv[i] << " ";
}
return EXIT_FAILURE;
}
// Parse arguments
std::string imageFileName = argv[1];
std::string maskFileName = argv[2];
std::stringstream ssPatchRadius;
ssPatchRadius << argv[3];
unsigned int patchHalfWidth = 0;
ssPatchRadius >> patchHalfWidth;
// The percent of the image size to use as the neighborhood (0 - 1)
std::stringstream ssNeighborhoodPercent;
ssNeighborhoodPercent << argv[4];
float neighborhoodPercent = 0;
ssNeighborhoodPercent >> neighborhoodPercent;
std::string outputFileName = argv[5];
// Output arguments
std::cout << "Reading image: " << imageFileName << std::endl;
std::cout << "Reading mask: " << maskFileName << std::endl;
std::cout << "Patch half width: " << patchHalfWidth << std::endl;
std::cout << "Neighborhood percent: " << neighborhoodPercent << std::endl;
std::cout << "Output: " << outputFileName << std::endl;
typedef itk::Image<itk::CovariantVector<int, 3>, 2> ImageType;
typedef itk::ImageFileReader<ImageType> ImageReaderType;
ImageReaderType::Pointer imageReader = ImageReaderType::New();
imageReader->SetFileName(imageFileName);
imageReader->Update();
ImageType::Pointer image = ImageType::New();
ITKHelpers::DeepCopy(imageReader->GetOutput(), image.GetPointer());
Mask::Pointer mask = Mask::New();
mask->Read(maskFileName);
std::cout << "hole pixels: " << mask->CountHolePixels() << std::endl;
std::cout << "valid pixels: " << mask->CountValidPixels() << std::endl;
typedef ImagePatchPixelDescriptor<ImageType> ImagePatchPixelDescriptorType;
// Create the graph
typedef boost::grid_graph<2> VertexListGraphType;
boost::array<std::size_t, 2> graphSideLengths = { { imageReader->GetOutput()->GetLargestPossibleRegion().GetSize()[0],
imageReader->GetOutput()->GetLargestPossibleRegion().GetSize()[1] } };
// VertexListGraphType graph(graphSideLengths);
std::shared_ptr<VertexListGraphType> graph(new VertexListGraphType(graphSideLengths));
typedef boost::graph_traits<VertexListGraphType>::vertex_descriptor VertexDescriptorType;
//ImagePatchDescriptorMapType smallImagePatchDescriptorMap(num_vertices(graph), indexMap);
// Create the patch inpainter. The inpainter needs to know the status of each pixel to determine if they should be inpainted.
typedef PatchInpainter<ImageType> ImageInpainterType;
std::shared_ptr<ImageInpainterType> imagePatchInpainter(new
ImageInpainterType(patchHalfWidth, image, mask));
// Create the priority function
typedef PriorityRandom PriorityType;
std::shared_ptr<PriorityType> priorityFunction(new PriorityType);
// typedef PriorityCriminisi<ImageType> PriorityType;
// std::shared_ptr<PriorityType> priorityFunction(new PriorityType(image, mask, patchHalfWidth));
typedef IndirectPriorityQueue<VertexListGraphType> BoundaryNodeQueueType;
std::shared_ptr<BoundaryNodeQueueType> boundaryNodeQueue(new BoundaryNodeQueueType(*graph));
// Create the descriptor map. This is where the data for each pixel is stored.
typedef boost::vector_property_map<ImagePatchPixelDescriptorType, BoundaryNodeQueueType::IndexMapType> ImagePatchDescriptorMapType;
// ImagePatchDescriptorMapType imagePatchDescriptorMap(num_vertices(graph), indexMap);
std::shared_ptr<ImagePatchDescriptorMapType> imagePatchDescriptorMap(new
ImagePatchDescriptorMapType(num_vertices(*graph), *(boundaryNodeQueue->GetIndexMap())));
// Create the descriptor visitor
typedef ImagePatchDescriptorVisitor<VertexListGraphType, ImageType, ImagePatchDescriptorMapType>
ImagePatchDescriptorVisitorType;
// ImagePatchDescriptorVisitorType imagePatchDescriptorVisitor(image, mask, imagePatchDescriptorMap, patchHalfWidth);
std::shared_ptr<ImagePatchDescriptorVisitorType> imagePatchDescriptorVisitor(new
ImagePatchDescriptorVisitorType(image.GetPointer(), mask,
imagePatchDescriptorMap, patchHalfWidth));
/* ImagePatchDescriptorVisitor(TImage* const in_image, Mask* const in_mask,
std::shared_ptr<TDescriptorMap> in_descriptorMap,
const unsigned int in_half_width) : */
typedef ImagePatchDifference<ImagePatchPixelDescriptorType, SumAbsolutePixelDifference<ImageType::PixelType> >
//.........这里部分代码省略.........