本文整理汇总了C++中affinetransform3d::Pointer::SetParameters方法的典型用法代码示例。如果您正苦于以下问题:C++ Pointer::SetParameters方法的具体用法?C++ Pointer::SetParameters怎么用?C++ Pointer::SetParameters使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类affinetransform3d::Pointer
的用法示例。
在下文中一共展示了Pointer::SetParameters方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GenerateOutputInformation
void BoundingObjectCutter::GenerateOutputInformation()
{
mitk::Image::Pointer output = this->GetOutput();
if ((output->IsInitialized()) && (output->GetPipelineMTime() <= m_TimeOfHeaderInitialization.GetMTime()))
return;
mitk::Image::Pointer input = const_cast< mitk::Image * > ( this->GetInput() );
if(input.IsNull())
{
MITK_WARN << "Input is not a mitk::Image";
return;
}
itkDebugMacro(<<"GenerateOutputInformation()");
unsigned int dimension = input->GetDimension();
if (dimension < 3)
{
MITK_WARN << "ImageCropper cannot handle 1D or 2D Objects. Operation aborted.";
return;
}
if((m_BoundingObject.IsNull()) || (m_BoundingObject->GetTimeGeometry()->CountTimeSteps() == 0))
return;
mitk::BaseGeometry* boGeometry = m_BoundingObject->GetGeometry();
mitk::BaseGeometry* inputImageGeometry = input->GetSlicedGeometry();
// calculate bounding box of bounding-object relative to the geometry
// of the input image. The result is in pixel coordinates of the input
// image (because the m_IndexToWorldTransform includes the spacing).
mitk::BoundingBox::Pointer boBoxRelativeToImage = boGeometry->CalculateBoundingBoxRelativeToTransform( inputImageGeometry->GetIndexToWorldTransform() );
// PART I: initialize input requested region. We do this already here (and not
// later when GenerateInputRequestedRegion() is called), because we
// also need the information to setup the output.
// pre-initialize input-requested-region to largest-possible-region
// and correct time-region; spatial part will be cropped by
// bounding-box of bounding-object below
m_InputRequestedRegion = input->GetLargestPossibleRegion();
// build region out of bounding-box of bounding-object
mitk::SlicedData::IndexType index=m_InputRequestedRegion.GetIndex(); //init times and channels
mitk::BoundingBox::PointType min = boBoxRelativeToImage->GetMinimum();
index[0] = (mitk::SlicedData::IndexType::IndexValueType)(std::ceil(min[0]));
index[1] = (mitk::SlicedData::IndexType::IndexValueType)(std::ceil(min[1]));
index[2] = (mitk::SlicedData::IndexType::IndexValueType)(std::ceil(min[2]));
mitk::SlicedData::SizeType size = m_InputRequestedRegion.GetSize(); //init times and channels
mitk::BoundingBox::PointType max = boBoxRelativeToImage->GetMaximum();
size[0] = (mitk::SlicedData::SizeType::SizeValueType)(std::ceil(max[0])-index[0]);
size[1] = (mitk::SlicedData::SizeType::SizeValueType)(std::ceil(max[1])-index[1]);
size[2] = (mitk::SlicedData::SizeType::SizeValueType)(std::ceil(max[2])-index[2]);
mitk::SlicedData::RegionType boRegion(index, size);
if(m_UseWholeInputRegion == false)
{
// crop input-requested-region with region of bounding-object
if(m_InputRequestedRegion.Crop(boRegion)==false)
{
// crop not possible => do nothing: set time size to 0.
size.Fill(0);
m_InputRequestedRegion.SetSize(size);
boRegion.SetSize(size);
m_BoundingObject->SetRequestedRegion(&boRegion);
return;
}
}
// set input-requested-region, because we access it later in
// GenerateInputRequestedRegion (there we just set the time)
input->SetRequestedRegion(&m_InputRequestedRegion);
// PART II: initialize output image
unsigned int *dimensions = new unsigned int [dimension];
itk2vtk(m_InputRequestedRegion.GetSize(), dimensions);
if(dimension>3)
memcpy(dimensions+3, input->GetDimensions()+3, (dimension-3)*sizeof(unsigned int));
output->Initialize(mitk::PixelType(GetOutputPixelType()), dimension, dimensions);
delete [] dimensions;
// now we have everything to initialize the transform of the output
mitk::SlicedGeometry3D* slicedGeometry = output->GetSlicedGeometry();
// set the transform: use the transform of the input;
// the origin will be replaced afterwards
AffineTransform3D::Pointer indexToWorldTransform = AffineTransform3D::New();
indexToWorldTransform->SetParameters(input->GetSlicedGeometry()->GetIndexToWorldTransform()->GetParameters());
slicedGeometry->SetIndexToWorldTransform(indexToWorldTransform);
// Position the output Image to match the corresponding region of the input image
const mitk::SlicedData::IndexType& start = m_InputRequestedRegion.GetIndex();
mitk::Point3D origin;
vtk2itk(start, origin);
inputImageGeometry->IndexToWorld(origin, origin);
slicedGeometry->SetOrigin(origin);
m_TimeOfHeaderInitialization.Modified();
//.........这里部分代码省略.........