本文整理汇总了C++中mitk::image::Pointer::GetReferenceCount方法的典型用法代码示例。如果您正苦于以下问题:C++ Pointer::GetReferenceCount方法的具体用法?C++ Pointer::GetReferenceCount怎么用?C++ Pointer::GetReferenceCount使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类mitk::image::Pointer
的用法示例。
在下文中一共展示了Pointer::GetReferenceCount方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: parameters
void mitk::RegistrationWrapper::ApplyTransformationToImage(mitk::Image::Pointer img, const mitk::RegistrationWrapper::RidgidTransformType &transformation,double* offset, mitk::Image* resampleReference, bool binary)
{
typedef mitk::DiffusionImage<short> DiffusionImageType;
if (dynamic_cast<DiffusionImageType*> (img.GetPointer()) == NULL)
{
ItkImageType::Pointer itkImage = ItkImageType::New();
MITK_ERROR << "imgCopy 0 " << "/" << img->GetReferenceCount();
MITK_ERROR << "pixel type " << img->GetPixelType().GetComponentTypeAsString();
CastToItkImage(img, itkImage);
typedef itk::Euler3DTransform< double > RigidTransformType;
RigidTransformType::Pointer rtransform = RigidTransformType::New();
RigidTransformType::ParametersType parameters(RigidTransformType::ParametersDimension);
for (int i = 0; i<6;++i)
parameters[i] = transformation[i];
rtransform->SetParameters( parameters );
mitk::Point3D origin = itkImage->GetOrigin();
origin[0]-=offset[0];
origin[1]-=offset[1];
origin[2]-=offset[2];
mitk::Point3D newOrigin = rtransform->GetInverseTransform()->TransformPoint(origin);
itk::Matrix<double,3,3> dir = itkImage->GetDirection();
itk::Matrix<double,3,3> transM ( vnl_inverse(rtransform->GetMatrix().GetVnlMatrix()));
itk::Matrix<double,3,3> newDirection = transM * dir;
itkImage->SetOrigin(newOrigin);
itkImage->SetDirection(newDirection);
// Perform Resampling if reference image is provided
if (resampleReference != NULL)
{
typedef itk::ResampleImageFilter<ItkImageType, ItkImageType> ResampleFilterType;
ItkImageType::Pointer itkReference = ItkImageType::New();
CastToItkImage(resampleReference,itkReference);
typedef itk::WindowedSincInterpolateImageFunction< ItkImageType, 3> WindowedSincInterpolatorType;
WindowedSincInterpolatorType::Pointer sinc_interpolator = WindowedSincInterpolatorType::New();
typedef itk::NearestNeighborInterpolateImageFunction< ItkImageType, double > NearestNeighborInterpolatorType;
NearestNeighborInterpolatorType::Pointer nn_interpolator = NearestNeighborInterpolatorType::New();
ResampleFilterType::Pointer resampler = ResampleFilterType::New();
resampler->SetInput(itkImage);
resampler->SetReferenceImage( itkReference );
resampler->UseReferenceImageOn();
if (binary)
resampler->SetInterpolator(nn_interpolator);
else
resampler->SetInterpolator(sinc_interpolator);
resampler->Update();
GrabItkImageMemory(resampler->GetOutput(), img);
}
else
{
// !! CastToItk behaves very differently depending on the original data type
// if the target type is the same as the original, only a pointer to the data is set
// and an additional GrabItkImageMemory will cause a segfault when the image is destroyed
// GrabItkImageMemory - is not necessary in this case since we worked on the original data
// See Bug 17538.
if (img->GetPixelType().GetComponentTypeAsString() != "double")
img = GrabItkImageMemory(itkImage);
}
}
else
{
DiffusionImageType::Pointer diffImages = dynamic_cast<DiffusionImageType*>(img.GetPointer());
typedef itk::Euler3DTransform< double > RigidTransformType;
RigidTransformType::Pointer rtransform = RigidTransformType::New();
RigidTransformType::ParametersType parameters(RigidTransformType::ParametersDimension);
for (int i = 0; i<6;++i)
{
parameters[i] = transformation[i];
}
rtransform->SetParameters( parameters );
mitk::Point3D b0origin = diffImages->GetVectorImage()->GetOrigin();
b0origin[0]-=offset[0];
b0origin[1]-=offset[1];
b0origin[2]-=offset[2];
mitk::Point3D newOrigin = rtransform->GetInverseTransform()->TransformPoint(b0origin);
//.........这里部分代码省略.........