本文整理汇总了C++中proportionaltimegeometry::Pointer::SetTimeStepGeometry方法的典型用法代码示例。如果您正苦于以下问题:C++ Pointer::SetTimeStepGeometry方法的具体用法?C++ Pointer::SetTimeStepGeometry怎么用?C++ Pointer::SetTimeStepGeometry使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类proportionaltimegeometry::Pointer
的用法示例。
在下文中一共展示了Pointer::SetTimeStepGeometry方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetGeometryForTimeStep
itk::LightObject::Pointer mitk::ProportionalTimeGeometry::InternalClone() const
{
itk::LightObject::Pointer parent = Superclass::InternalClone();
ProportionalTimeGeometry::Pointer newTimeGeometry =
dynamic_cast<ProportionalTimeGeometry * > (parent.GetPointer());
newTimeGeometry->m_FirstTimePoint = this->m_FirstTimePoint;
newTimeGeometry->m_StepDuration = this->m_StepDuration;
newTimeGeometry->m_GeometryVector.clear();
newTimeGeometry->Expand(this->CountTimeSteps());
for (TimeStepType i =0; i < CountTimeSteps(); ++i)
{
BaseGeometry::Pointer tempGeometry = GetGeometryForTimeStep(i)->Clone();
newTimeGeometry->SetTimeStepGeometry(tempGeometry, i);
}
return parent;
}
示例2: itkDebugMacro
void mitk::PlaneFit::GenerateOutputInformation()
{
mitk::PointSet::ConstPointer input = this->GetInput();
mitk::GeometryData::Pointer output = this->GetOutput();
itkDebugMacro(<<"GenerateOutputInformation()");
if (input.IsNull()) return;
if ( m_PointSet == NULL )
{
return;
}
bool update = false;
if ( output->GetGeometry() == NULL || output->GetTimeGeometry() == NULL )
update = true;
if ( ( ! update ) && ( output->GetTimeGeometry()->CountTimeSteps() != input->GetTimeGeometry()->CountTimeSteps() ) )
update = true;
if ( update )
{
mitk::PlaneGeometry::Pointer planeGeometry = mitk::PlaneGeometry::New();
ProportionalTimeGeometry::Pointer timeGeometry = dynamic_cast<ProportionalTimeGeometry *>(m_TimeGeometry.GetPointer());
timeGeometry->Initialize(planeGeometry, m_PointSet->GetPointSetSeriesSize());
//m_TimeGeometry->InitializeEvenlyTimed(
// planeGeometry, m_PointSet->GetPointSetSeriesSize() );
TimeStepType timeStep;
for ( timeStep = 0;
(timeStep < m_PointSet->GetPointSetSeriesSize())
&& (timeStep < m_Planes.size());
++timeStep )
{
timeGeometry->SetTimeStepGeometry( m_Planes[timeStep], timeStep );
}
output->SetTimeGeometry( m_TimeGeometry );
}
}
示例3: indexForUnlabeledTimeStep
mitk::ProportionalTimeGeometry::Pointer mitk::ProportionalTimeGeometryToXML::FromXML(TiXmlElement *timeGeometryElement)
{
if (!timeGeometryElement)
{
MITK_ERROR << "Cannot deserialize ProportionalTimeGeometry from nullptr.";
return nullptr;
}
int numberOfTimeSteps = 0;
if (TIXML_SUCCESS != timeGeometryElement->QueryIntAttribute("NumberOfTimeSteps", &numberOfTimeSteps))
{
MITK_WARN << "<ProportionalTimeGeometry> found without NumberOfTimeSteps attribute. Counting...";
}
// might be missing!
TimePointType firstTimePoint;
std::string firstTimePoint_s;
TimePointType stepDuration;
std::string stepDuration_s;
try
{
if (TIXML_SUCCESS == timeGeometryElement->QueryStringAttribute("FirstTimePoint", &firstTimePoint_s))
{
firstTimePoint = boost::lexical_cast<double>(firstTimePoint_s);
}
else
{
firstTimePoint = -std::numeric_limits<TimePointType>::max();
}
if (TIXML_SUCCESS == timeGeometryElement->QueryStringAttribute("StepDuration", &stepDuration_s))
{
stepDuration = boost::lexical_cast<double>(stepDuration_s);
}
else
{
stepDuration = std::numeric_limits<TimePointType>::infinity();
}
}
catch (boost::bad_lexical_cast &e)
{
MITK_ERROR << "Could not parse string as number: " << e.what();
return nullptr;
}
// list of all geometries with their time steps
std::multimap<TimeStepType, BaseGeometry::Pointer> allReadGeometries;
int indexForUnlabeledTimeStep(-1);
for (TiXmlElement *currentElement = timeGeometryElement->FirstChildElement(); currentElement != nullptr;
currentElement = currentElement->NextSiblingElement())
{
// different geometries could have been inside a ProportionalTimeGeometry.
// By now, we only support Geometry3D
std::string tagName = currentElement->Value();
if (tagName == "Geometry3D")
{
Geometry3D::Pointer restoredGeometry = Geometry3DToXML::FromXML(currentElement);
if (restoredGeometry.IsNotNull())
{
int timeStep(-1);
if (TIXML_SUCCESS != currentElement->QueryIntAttribute("TimeStep", &timeStep))
{
timeStep = indexForUnlabeledTimeStep--; // decrement index for next one
MITK_WARN << "Found <Geometry3D> without 'TimeStep' attribute in <ProportionalTimeGeometry>. No guarantees "
"on order anymore.";
}
if (allReadGeometries.count(static_cast<TimeStepType>(timeStep)) > 0)
{
MITK_WARN << "Found <Geometry3D> tags with identical 'TimeStep' attribute in <ProportionalTimeGeometry>. No "
"guarantees on order anymore.";
}
allReadGeometries.insert(std::make_pair(static_cast<TimeStepType>(timeStep), restoredGeometry.GetPointer()));
}
}
else
{
MITK_WARN << "Found unsupported tag <" << tagName << "> inside <ProportionalTimeGeometry>. Ignoring.";
}
}
// now add all BaseGeometries that were read to a new instance
// of ProportionalTimeGeometry
ProportionalTimeGeometry::Pointer newTimeGeometry = ProportionalTimeGeometry::New();
newTimeGeometry->SetFirstTimePoint(firstTimePoint);
newTimeGeometry->SetStepDuration(stepDuration);
newTimeGeometry->ReserveSpaceForGeometries(allReadGeometries.size());
TimeStepType t(0);
for (auto entry : allReadGeometries)
{
// We add items with newly assigned time steps.
// This avoids great confusion when a file contains
// bogus numbers.
newTimeGeometry->SetTimeStepGeometry(entry.second, t++);
}
//.........这里部分代码省略.........