本文整理汇总了C++中proportionaltimegeometry::Pointer::SetFirstTimePoint方法的典型用法代码示例。如果您正苦于以下问题:C++ Pointer::SetFirstTimePoint方法的具体用法?C++ Pointer::SetFirstTimePoint怎么用?C++ Pointer::SetFirstTimePoint使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类proportionaltimegeometry::Pointer
的用法示例。
在下文中一共展示了Pointer::SetFirstTimePoint方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: itkDebugMacro
void mitk::ProbeFilter::GenerateOutputInformation()
{
mitk::Surface::ConstPointer input = this->GetInput();
mitk::Image::ConstPointer source = this->GetSource();
mitk::Surface::Pointer output = this->GetOutput();
if(input.IsNull()) return;
if(source.IsNull()) return;
if(input->GetGeometry()==NULL) return;
if(source->GetGeometry()==NULL) return;
if( (input->GetTimeGeometry()->CountTimeSteps()==1) && (source->GetTimeGeometry()->CountTimeSteps()>1) )
{
Geometry3D::Pointer geo3D = Geometry3D::New();
BaseGeometry::Pointer geometry3D = dynamic_cast<BaseGeometry*>(geo3D.GetPointer());
geometry3D->Initialize();
geometry3D->SetBounds(source->GetTimeGeometry()->GetBoundsInWorld());
ProportionalTimeGeometry::Pointer outputTimeGeometry = ProportionalTimeGeometry::New();
outputTimeGeometry->Initialize(geometry3D, source->GetTimeGeometry()->CountTimeSteps());
outputTimeGeometry->SetFirstTimePoint(source->GetTimeGeometry()->GetMinimumTimePoint());
TimePointType stepDuration = source->GetTimeGeometry()->GetMaximumTimePoint(0) - source->GetTimeGeometry()->GetMinimumTimePoint(0);
outputTimeGeometry->SetStepDuration(stepDuration);
output->Expand(outputTimeGeometry->CountTimeSteps());
output->SetTimeGeometry( outputTimeGeometry );
}
else
output->SetGeometry( static_cast<BaseGeometry*>(input->GetGeometry()->Clone().GetPointer()) );
itkDebugMacro(<<"GenerateOutputInformation()");
}
示例2: 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++);
}
//.........这里部分代码省略.........