• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ filtertype::Pointer类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中filtertype::Pointer的典型用法代码示例。如果您正苦于以下问题:C++ Pointer类的具体用法?C++ Pointer怎么用?C++ Pointer使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了Pointer类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: ComputeMaskedIsophotesInRegion

void ComputeMaskedIsophotesInRegion(const FloatScalarImageType* const image, const Mask* const mask, const itk::ImageRegion<2>& region,
                                    FloatVector2ImageType* const outputIsophotes)
{
  //Helpers::WriteImageConditional<FloatScalarImageType>(image, "Debug/ComputeMaskedIsophotes.luminance.mha", this->DebugImages);

  FloatVector2ImageType::Pointer gradient = FloatVector2ImageType::New();
  ITKHelpers::InitializeImage<FloatVector2ImageType>(gradient, image->GetLargestPossibleRegion());
  Derivatives::MaskedGradientInRegion<FloatScalarImageType>(image, mask, region, gradient);

  //Helpers::DebugWriteImageConditional<FloatVector2ImageType>(gradient, "Debug/ComputeMaskedIsophotes.gradient.mha", this->DebugImages);
  //Helpers::Write2DVectorImage(gradient, "Debug/ComputeMaskedIsophotes.gradient.mha");

  // Rotate the gradient 90 degrees to obtain isophotes from gradient
  typedef itk::UnaryFunctorImageFilter<FloatVector2ImageType, FloatVector2ImageType,
  RotateVectors<FloatVector2ImageType::PixelType,
                FloatVector2ImageType::PixelType> > FilterType;

  FilterType::Pointer rotateFilter = FilterType::New();
  rotateFilter->SetInput(gradient);
  rotateFilter->Update();

  //Helpers::DebugWriteImageConditional<FloatVector2ImageType>(rotateFilter->GetOutput(), "Debug/ComputeMaskedIsophotes.Isophotes.mha", this->DebugImages);
  //Helpers::Write2DVectorImage(rotateFilter->GetOutput(), "Debug/ComputeMaskedIsophotes.Isophotes.mha");

  ITKHelpers::CopyRegion<FloatVector2ImageType>(rotateFilter->GetOutput(), outputIsophotes, region, region);
}
开发者ID:daviddoria,项目名称:TempRepo,代码行数:26,代码来源:Isophotes.cpp


示例2: 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;
}
开发者ID:FubuFabian,项目名称:PruebasITK,代码行数:29,代码来源:FractalAnalysis.cpp


示例3: MedianHoleFilling

void Preprocess::MedianHoleFilling(int radiusX, int radiusY, int radiusZ)
{
	int size3 = myImg->GetLargestPossibleRegion().GetSize()[2];
	if(size3==1)
		radiusZ = 0;

	ImageType3D::SizeType radius;
	radius[0] = radiusX; 
	radius[1] = radiusY;
    radius[2] = radiusZ;

	typedef itk::BinaryMedianImageFilter< ImageType3D, ImageType3D > FilterType;
	FilterType::Pointer filter = FilterType::New();
	filter->SetRadius(radius);
	filter->SetInput(myImg);
    try
	{
		filter->Update();
	}
	catch( itk::ExceptionObject & err )
	{
		std::cerr << "ITK FILTER ERROR: " << err << std::endl ;
		return;
	}
	
	myImg = filter->GetOutput();
}
开发者ID:Pandolph,项目名称:farsight,代码行数:27,代码来源:ftkPreprocess2.cpp


示例4:

VolumeVisualizationImagePreprocessor::BinImage::Pointer VolumeVisualizationImagePreprocessor::Crop(VolumeVisualizationImagePreprocessor::BinImage::Pointer src )
{
  VVP_INFO << "Cropping 8bit...";

  typedef itk::RegionOfInterestImageFilter<BinImage,BinImage> FilterType;
  
  FilterType::Pointer cropFilter = FilterType::New();

  cropFilter->SetInput( src );
  
  BinImage::RegionType region;
  BinImage::SizeType        size;
  BinImage::IndexType    index;

  index.SetElement(0,m_MinX);
  index.SetElement(1,m_MinY);
  index.SetElement(2,m_MinZ);
     
  size.SetElement(0,m_MaxX-m_MinX+1);
  size.SetElement(1,m_MaxY-m_MinY+1);
  size.SetElement(2,m_MaxZ-m_MinZ+1);
  
  region.SetIndex(index);
  region.SetSize(size);
  
  cropFilter->SetRegionOfInterest(region);
    cropFilter->Update();

  BinImage::Pointer dst = cropFilter->GetOutput(); 
  dst->DisconnectPipeline();

  return dst;
}
开发者ID:david-guerrero,项目名称:MITK,代码行数:33,代码来源:mitkVolumeVisualizationImagePreprocessor.cpp


示例5: TensorsToQbi

void QmitkTensorReconstructionView::TensorsToQbi()
{
    for (int i=0; i<m_TensorImages->size(); i++)
    {
        mitk::DataNode::Pointer tensorImageNode = m_TensorImages->at(i);
        MITK_INFO << "starting Q-Ball estimation";

        typedef float                                       TTensorPixelType;
        typedef itk::DiffusionTensor3D< TTensorPixelType >  TensorPixelType;
        typedef itk::Image< TensorPixelType, 3 >            TensorImageType;

        TensorImageType::Pointer itkvol = TensorImageType::New();
        mitk::CastToItkImage<TensorImageType>(dynamic_cast<mitk::TensorImage*>(tensorImageNode->GetData()), itkvol);

        typedef itk::TensorImageToQBallImageFilter< TTensorPixelType, TTensorPixelType > FilterType;
        FilterType::Pointer filter = FilterType::New();
        filter->SetInput( itkvol );
        filter->Update();

        typedef itk::Vector<TTensorPixelType,QBALL_ODFSIZE>  OutputPixelType;
        typedef itk::Image<OutputPixelType,3>                OutputImageType;

        mitk::QBallImage::Pointer image = mitk::QBallImage::New();
        OutputImageType::Pointer outimg = filter->GetOutput();
        image->InitializeByItk( outimg.GetPointer() );
        image->SetVolume( outimg->GetBufferPointer() );
        mitk::DataNode::Pointer node = mitk::DataNode::New();
        node->SetData( image );
        QString newname;
        newname = newname.append(tensorImageNode->GetName().c_str());
        newname = newname.append("_qbi");
        node->SetName(newname.toAscii());
        GetDefaultDataStorage()->Add(node);
    }
}
开发者ID:beneon,项目名称:MITK,代码行数:35,代码来源:QmitkTensorReconstructionView.cpp


示例6: MedianFilter

void Preprocess::MedianFilter( int radiusX, int radiusY, int radiusZ)
{
	int size3 = myImg->GetLargestPossibleRegion().GetSize()[2];
	if(size3==1)
		radiusZ = 0;

	ImageType3D::SizeType radius; 
	radius[0] = radiusX; // radius along x 
	radius[1] = radiusY; // radius along y 
	radius[2] = radiusZ; // radius along y 

	typedef itk::MedianImageFilter<ImageType3D,ImageType3D> FilterType;
	FilterType::Pointer filter = FilterType::New();
	filter->SetRadius( radius );  
	filter->SetInput(myImg);

	try
    {
		filter->Update();
    }
	catch( itk::ExceptionObject & err )
    {
		std::cerr << "Exception caught: " << err << std::endl;
    }

	myImg = filter->GetOutput();
}
开发者ID:Pandolph,项目名称:farsight,代码行数:27,代码来源:ftkPreprocess2.cpp


示例7: ConvertPeaksFromMrtrix

void QmitkOdfMaximaExtractionView::ConvertPeaksFromMrtrix()
{
    if (m_ImageNodes.empty())
        return;

    typedef itk::Image< float, 4 > ItkImageType;
    typedef itk::MrtrixPeakImageConverter< float > FilterType;
    FilterType::Pointer filter = FilterType::New();

    // cast to itk
    mitk::Image::Pointer mitkImg = dynamic_cast<mitk::Image*>(m_ImageNodes.at(0)->GetData());
    mitk::Geometry3D::Pointer geom = mitkImg->GetGeometry();
    typedef mitk::ImageToItk< FilterType::InputImageType > CasterType;
    CasterType::Pointer caster = CasterType::New();
    caster->SetInput(mitkImg);
    caster->Update();
    FilterType::InputImageType::Pointer itkImg = caster->GetOutput();

    filter->SetInputImage(itkImg);
    filter->GenerateData();

    mitk::Vector3D outImageSpacing = geom->GetSpacing();
    float maxSpacing = 1;
    if(outImageSpacing[0]>outImageSpacing[1] && outImageSpacing[0]>outImageSpacing[2])
        maxSpacing = outImageSpacing[0];
    else if (outImageSpacing[1] > outImageSpacing[2])
        maxSpacing = outImageSpacing[1];
    else
        maxSpacing = outImageSpacing[2];

    mitk::FiberBundleX::Pointer directions = filter->GetOutputFiberBundle();
    directions->SetGeometry(geom);
    DataNode::Pointer node = DataNode::New();
    node->SetData(directions);
    QString name(m_ImageNodes.at(0)->GetName().c_str());
    name += "_VectorField";
    node->SetName(name.toStdString().c_str());
    node->SetProperty("Fiber2DSliceThickness", mitk::FloatProperty::New(maxSpacing));
    node->SetProperty("Fiber2DfadeEFX", mitk::BoolProperty::New(false));
    GetDataStorage()->Add(node);

    typedef FilterType::DirectionImageContainerType DirectionImageContainerType;
    DirectionImageContainerType::Pointer container = filter->GetDirectionImageContainer();
    for (int i=0; i<container->Size(); i++)
    {
        ItkDirectionImage3DType::Pointer itkImg = container->GetElement(i);
        mitk::Image::Pointer img = mitk::Image::New();
        img->InitializeByItk( itkImg.GetPointer() );
        img->SetVolume( itkImg->GetBufferPointer() );
        DataNode::Pointer node = DataNode::New();
        node->SetData(img);
        QString name(m_ImageNodes.at(0)->GetName().c_str());
        name += "_Direction";
        name += QString::number(i+1);
        node->SetName(name.toStdString().c_str());
        GetDataStorage()->Add(node);
    }
}
开发者ID:,项目名称:,代码行数:58,代码来源:


示例8: CallMultishellToSingleShellFilter

void QmitkPreprocessingView::CallMultishellToSingleShellFilter(itk::DWIVoxelFunctor * functor, mitk::DiffusionImage<DiffusionPixelType>::Pointer ImPtr, QString imageName)
{
  typedef itk::RadialMultishellToSingleshellImageFilter<DiffusionPixelType, DiffusionPixelType> FilterType;

  // filter input parameter
  const mitk::DiffusionImage<DiffusionPixelType>::BValueMap
      &originalShellMap  = ImPtr->GetBValueMap();

  const mitk::DiffusionImage<DiffusionPixelType>::ImageType
      *vectorImage       = ImPtr->GetVectorImage();

  const mitk::DiffusionImage<DiffusionPixelType>::GradientDirectionContainerType::Pointer
      gradientContainer = ImPtr->GetDirections();

  const unsigned int
      &bValue            = ImPtr->GetReferenceBValue();

  mitk::DataNode::Pointer imageNode = 0;

  // filter call
  FilterType::Pointer filter = FilterType::New();
  filter->SetInput(vectorImage);
  filter->SetOriginalGradientDirections(gradientContainer);
  filter->SetOriginalBValueMap(originalShellMap);
  filter->SetOriginalBValue(bValue);
  filter->SetFunctor(functor);
  filter->Update();

  // create new DWI image
  mitk::DiffusionImage<DiffusionPixelType>::Pointer outImage = mitk::DiffusionImage<DiffusionPixelType>::New();
  outImage->SetVectorImage( filter->GetOutput() );
  outImage->SetReferenceBValue( m_Controls->m_targetBValueSpinBox->value() );
  outImage->SetDirections( filter->GetTargetGradientDirections() );
  outImage->InitializeFromVectorImage();

  imageNode = mitk::DataNode::New();
  imageNode->SetData( outImage );
  imageNode->SetName(imageName.toStdString().c_str());
  GetDefaultDataStorage()->Add(imageNode);

  if(m_Controls->m_OutputRMSErrorImage->isChecked()){
    // create new Error image
    FilterType::ErrorImageType::Pointer errImage = filter->GetErrorImage();
    mitk::Image::Pointer mitkErrImage = mitk::Image::New();
    mitkErrImage->InitializeByItk<FilterType::ErrorImageType>(errImage);
    mitkErrImage->SetVolume(errImage->GetBufferPointer());

    imageNode = mitk::DataNode::New();
    imageNode->SetData( mitkErrImage );
    imageNode->SetName((imageName+"_Error").toStdString().c_str());
    GetDefaultDataStorage()->Add(imageNode);
  }
}
开发者ID:SaschaD-DKFZ,项目名称:MITK,代码行数:53,代码来源:QmitkPreprocessingView.cpp


示例9:

void mitk::OtsuTool3D::UpdateBinaryPreview(int regionID)
{
  m_MultiLabelResultNode->SetVisibility(false);
  //pixel with regionID -> binary image
  const unsigned short dim = 3;
  typedef unsigned char PixelType;

  typedef itk::Image< PixelType, dim > InputImageType;
  typedef itk::Image< PixelType, dim > OutputImageType;

  typedef itk::BinaryThresholdImageFilter< InputImageType, OutputImageType > FilterType;

  FilterType::Pointer filter = FilterType::New();

  InputImageType::Pointer itkImage;

  mitk::Image::Pointer multiLabelSegmentation = dynamic_cast<mitk::Image*>(m_MultiLabelResultNode->GetData());
  mitk::CastToItkImage(multiLabelSegmentation, itkImage);

  filter->SetInput(itkImage);
  filter->SetLowerThreshold(regionID);
  filter->SetUpperThreshold(regionID);
  filter->SetInsideValue(1);
  filter->SetOutsideValue(0);
  filter->Update();
  mitk::Image::Pointer binarySegmentation;
  mitk::CastToMitkImage( filter->GetOutput(), binarySegmentation);
  m_BinaryPreviewNode->SetData(binarySegmentation);
  m_BinaryPreviewNode->SetVisibility(true);
  m_BinaryPreviewNode->SetProperty("outline binary", mitk::BoolProperty::New(false));

  mitk::RenderingManager::GetInstance()->RequestUpdateAll();
}
开发者ID:SaschaD-DKFZ,项目名称:MITK,代码行数:33,代码来源:mitkOtsuTool3D.cpp


示例10:

void mitk::TensorImage::ConstructRgbImage()
{
    typedef itk::Image<itk::DiffusionTensor3D<float>,3> ImageType;
    typedef itk::TensorToRgbImageFilter<ImageType> FilterType;
    FilterType::Pointer filter = FilterType::New();

    ImageType::Pointer itkvol = ImageType::New();
    mitk::CastToItkImage<ImageType>(this, itkvol);
    filter->SetInput(itkvol);
    filter->Update();

    m_RgbImage = mitk::Image::New();
    m_RgbImage->InitializeByItk( filter->GetOutput() );
    m_RgbImage->SetVolume( filter->GetOutput()->GetBufferPointer() );
}
开发者ID:GHfangxin,项目名称:MITK,代码行数:15,代码来源:mitkTensorImage.cpp


示例11:

void mitk::QBallImage::ConstructRgbImage()
{
  typedef itk::Image<itk::Vector<float,QBALL_ODFSIZE>,3> ImageType;
  typedef itk::QBallToRgbImageFilter<ImageType> FilterType;
  FilterType::Pointer filter = FilterType::New();

  ImageType::Pointer itkvol = ImageType::New();
  mitk::CastToItkImage<ImageType>(this, itkvol);
  filter->SetInput(itkvol);
  filter->Update();

  m_RgbImage = mitk::Image::New();
  m_RgbImage->InitializeByItk( filter->GetOutput() );
  m_RgbImage->SetVolume( filter->GetOutput()->GetBufferPointer() );
}
开发者ID:GHfangxin,项目名称:MITK,代码行数:15,代码来源:mitkQBallImage.cpp


示例12: 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;
}
开发者ID:SabioGuru,项目名称:QGoImageCompare,代码行数:48,代码来源:pretty-executable.cpp


示例13: CannyEdgeDetection

void Preprocess::CannyEdgeDetection(float variance, float upperThreshold, float lowerThreshold)
{
	typedef itk::CastImageFilter< ImageType3D, FloatImageType3D > CastFilterType;
	CastFilterType::Pointer cast = CastFilterType::New();
	cast->SetInput( myImg );

	typedef itk::CannyEdgeDetectionImageFilter< FloatImageType3D, FloatImageType3D > FilterType;
	FilterType::Pointer filter = FilterType::New();
	filter->SetInput( cast->GetOutput() );
	filter->SetUpperThreshold(upperThreshold);		//Threshold for detected edges = threshold
	filter->SetLowerThreshold(lowerThreshold);		//Threshold for detected edges = threshold/2
	//filter->SetThreshold(threshold);		//Lowest allowed value in the output image
	filter->SetVariance(variance);			//For Gaussian smoothing
	//filter->SetMaximumError(.01f);		//For Gaussian smoothing

	try
	{
		filter->Update();
	}
	catch( itk::ExceptionObject & err )
	{
		std::cerr << "Exception caught: " << err << std::endl;
	}

	myImg = RescaleFloatToImageType( filter->GetOutput() );
}
开发者ID:Pandolph,项目名称:farsight,代码行数:26,代码来源:ftkPreprocess2.cpp


示例14: DoAdcCalculation

void QmitkPreprocessingView::DoAdcCalculation()
{
  if (m_DiffusionImage.IsNull())
    return;

  typedef mitk::DiffusionImage< DiffusionPixelType >            DiffusionImageType;
  typedef itk::AdcImageFilter< DiffusionPixelType, double >     FilterType;


  for (unsigned int i=0; i<m_SelectedDiffusionNodes.size(); i++)
  {
    DiffusionImageType::Pointer inImage = dynamic_cast< DiffusionImageType* >(m_SelectedDiffusionNodes.at(i)->GetData());
    FilterType::Pointer filter = FilterType::New();
    filter->SetInput(inImage->GetVectorImage());
    filter->SetGradientDirections(inImage->GetDirections());
    filter->SetB_value(inImage->GetReferenceBValue());
    filter->Update();

    mitk::Image::Pointer image = mitk::Image::New();
    image->InitializeByItk( filter->GetOutput() );
    image->SetVolume( filter->GetOutput()->GetBufferPointer() );
    mitk::DataNode::Pointer imageNode = mitk::DataNode::New();
    imageNode->SetData( image );
    QString name = m_SelectedDiffusionNodes.at(i)->GetName().c_str();

    imageNode->SetName((name+"_ADC").toStdString().c_str());
    GetDefaultDataStorage()->Add(imageNode);
  }
}
开发者ID:SaschaD-DKFZ,项目名称:MITK,代码行数:29,代码来源:QmitkPreprocessingView.cpp


示例15: DoLengthCorrection

void QmitkPreprocessingView::DoLengthCorrection()
{
  if (m_DiffusionImage.IsNull())
    return;

  typedef mitk::DiffusionImage<DiffusionPixelType>  DiffusionImageType;
  typedef itk::DwiGradientLengthCorrectionFilter  FilterType;

  FilterType::Pointer filter = FilterType::New();
  filter->SetRoundingValue( m_Controls->m_B_ValueMap_Rounder_SpinBox->value());
  filter->SetReferenceBValue(m_DiffusionImage->GetReferenceBValue());
  filter->SetReferenceGradientDirectionContainer(m_DiffusionImage->GetDirections());
  filter->Update();

  DiffusionImageType::Pointer image = DiffusionImageType::New();
  image->SetVectorImage( m_DiffusionImage->GetVectorImage());
  image->SetReferenceBValue( filter->GetNewBValue() );
  image->SetDirections( filter->GetOutputGradientDirectionContainer());
  image->InitializeFromVectorImage();

  mitk::DataNode::Pointer imageNode = mitk::DataNode::New();
  imageNode->SetData( image );
  QString name = m_SelectedDiffusionNodes.front()->GetName().c_str();

  imageNode->SetName((name+"_rounded").toStdString().c_str());
  GetDefaultDataStorage()->Add(imageNode);
}
开发者ID:SaschaD-DKFZ,项目名称:MITK,代码行数:27,代码来源:QmitkPreprocessingView.cpp


示例16: VotingHoleFilling

void Preprocess::VotingHoleFilling(int radiusX, int radiusY, int radiusZ, int iterations)
{
	int size3 = myImg->GetLargestPossibleRegion().GetSize()[2];
	if(size3==1)
		radiusZ = 0;

	ImageType3D::SizeType radius;
	radius[0] = radiusX; 
	radius[1] = radiusY;
    radius[2] = radiusZ;

	typedef itk::VotingBinaryIterativeHoleFillingImageFilter< ImageType3D > FilterType;
	FilterType::Pointer filter = FilterType::New();
	filter->SetRadius(radius);
	filter->SetMajorityThreshold(2);
	filter->SetMaximumNumberOfIterations(iterations);
	filter->SetInput(myImg);
    try
	{
		filter->Update();
	}
	catch( itk::ExceptionObject & err )
	{
		std::cerr << "ITK FILTER ERROR: " << err << std::endl ;
		return;
	}
	
	myImg = filter->GetOutput();
}
开发者ID:Pandolph,项目名称:farsight,代码行数:29,代码来源:ftkPreprocess2.cpp


示例17: InvertIntensity

void Preprocess::InvertIntensity(void)
{
	typedef itk::InvertIntensityImageFilter< ImageType3D, ImageType3D > FilterType;
	FilterType::Pointer filter = FilterType::New();
	filter->SetInput( myImg );
	filter->InPlaceOn();

	try
	{
		filter->Update();
	}
	catch( itk::ExceptionObject & err )
	{
		std::cerr << "ITK FILTER ERROR: " << err << std::endl ;
	}

	myImg = filter->GetOutput();
	
}
开发者ID:Pandolph,项目名称:farsight,代码行数:19,代码来源:ftkPreprocess2.cpp


示例18: ClosingFilter

void Preprocess::ClosingFilter( int radius )
{
	typedef itk::BinaryBallStructuringElement<PixelType,3> StructuringElementType;
	typedef itk::GrayscaleMorphologicalClosingImageFilter<ImageType3D, ImageType3D, StructuringElementType > FilterType;
	FilterType::Pointer close = FilterType::New();
	StructuringElementType structuringElement;
	structuringElement.CreateStructuringElement();
	structuringElement.SetRadius(radius);
	close->SetKernel( structuringElement );	 
	close->SetInput(myImg);
	try
	{
		close->Update();
	}
	catch( itk::ExceptionObject & err )
	{
		std::cerr << "Exception caught: " << err << std::endl;
	}
	myImg = close->GetOutput();
}
开发者ID:Pandolph,项目名称:farsight,代码行数:20,代码来源:ftkPreprocess2.cpp


示例19: main

int main( int argc, char * argv[] )
{
  if( argc < 7 )
    {
    std::cerr << "Usage: " << std::endl;
    std::cerr << argv[0] << std::endl;
    std::cerr << " <InputImage> <OutputImage> <LowerThreshold>";
    std::cerr << " <UpperThreshold> <OutsideValue> <InsideValue>"
              << std::endl;
    return EXIT_FAILURE;
    }

  const unsigned int Dimension = 2;
  typedef  unsigned char  PixelType;

  const char * InputImage = argv[1];
  const char * OutputImage = argv[2];

  const PixelType LowerThreshold = static_cast<PixelType>(atoi( argv[3] ) );
  const PixelType UpperThreshold = static_cast<PixelType>(atoi( argv[4] ) );
  const PixelType OutsideValue = static_cast<PixelType>(atoi( argv[5] ) );
  const PixelType InsideValue = static_cast<PixelType>(atoi( argv[6] ) );

  typedef itk::Image< PixelType, Dimension >  ImageType;

  typedef itk::ImageFileReader< ImageType > ReaderType;
  ReaderType::Pointer reader = ReaderType::New();
  reader->SetFileName( InputImage );

  typedef itk::BinaryThresholdImageFilter< ImageType, ImageType >
    FilterType;
  FilterType::Pointer filter = FilterType::New();
  filter->SetInput( reader->GetOutput() );
  filter->SetLowerThreshold( LowerThreshold );
  filter->SetUpperThreshold( UpperThreshold );
  filter->SetOutsideValue( OutsideValue );
  filter->SetInsideValue( InsideValue );

  typedef itk::ImageFileWriter< ImageType >  WriterType;
  WriterType::Pointer writer = WriterType::New();
  writer->SetFileName( OutputImage );
  writer->SetInput( filter->GetOutput() );

  try
    {
    writer->Update();
    }
  catch( itk::ExceptionObject & e )
    {
    std::cerr << "Error: " << e << std::endl;
    return EXIT_FAILURE;
    }

  return EXIT_SUCCESS;
}
开发者ID:ihsanarifr,项目名称:TugasKuliah,代码行数:55,代码来源:treshhold.cpp


示例20: DiscreteGaussianFilter

void Preprocess::DiscreteGaussianFilter(float varX, float varY, float varZ, float maxError)
{
	typedef itk::DiscreteGaussianImageFilter<ImageType3D, FloatImageType3D> FilterType;
	FilterType::Pointer filter = FilterType::New();

	FilterType::ArrayType maxErr;
    maxErr.Fill(maxError);
    filter->SetMaximumError( maxErr );

	FilterType::ArrayType variance;
	variance[0] = varX;
	variance[1] = varY;
	variance[2] = varZ;
	filter->SetVariance(variance);

	filter->SetInput( myImg );

	try
	{
		filter->Update();
	}
	catch( itk::ExceptionObject & err )
	{
		std::cerr << "ITK FILTER ERROR: " << err << std::endl ;
		return;
	}

	myImg = RescaleFloatToImageType( filter->GetOutput() );
   
}
开发者ID:Pandolph,项目名称:farsight,代码行数:30,代码来源:ftkPreprocess2.cpp



注:本文中的filtertype::Pointer类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ firebird::GlobalPtr类代码示例发布时间:2022-05-31
下一篇:
C++ filterparameter::Pointer类代码示例发布时间:2022-05-31
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap