17 #include "mapRegistration.h"
23 #include "mapPointSetMappingTask.h"
27 if (! mitkSet) mapDefaultExceptionStaticMacro(<<
"Error, cannot convert point set. Passed mitk point set is null.");
32 mapSet->SetPoints(mapContainer);
33 mapSet->SetPointData(mapDataContainer);
35 unsigned int pointCount = mitkSet->GetNumberOfPoints();
37 for (
unsigned int pointId = 0; pointId < pointCount; ++pointId)
39 mapSet->SetPoint(pointId, mitkSet->GetPoint(pointId));
42 if (mitkSet->GetPointData(pointId,&data))
44 mapSet->SetPointData(pointId,data.
id);
53 bool throwOnMappingError, const ::mitk::PointSet::PointDataType& errorPointValue)
57 mitkThrow() <<
"Cannot map point set. Passed registration wrapper pointer is NULL.";
61 mitkThrow() <<
"Cannot map point set. Passed point set pointer is NULL.";
63 if (input->GetTimeSteps()<=timeStep && timeStep>=0)
65 mitkThrow() <<
"Cannot set point set. Selected time step is larger then mitk point set. MITK time step count: "<<input->GetTimeSteps()<<
"; selected time step: "<<timeStep;
70 typedef ::map::core::continuous::Elements<3>::InternalPointSetType MAPPointSetType;
71 typedef ::map::core::Registration<3,3> ConcreteRegistrationType;
72 const ConcreteRegistrationType* castedReg =
dynamic_cast<const ConcreteRegistrationType*
>(registration);
75 mitkThrow() <<
"Moving and/or fixed dimension of the registration is not 3. Cannot map point 3D set.";
78 typedef ::map::core::PointSetMappingTask<ConcreteRegistrationType, MAPPointSetType, MAPPointSetType> MappingTaskType;
79 MappingTaskType::ErrorPointValueType internalErrorValue = itk::NumericTraits<MappingTaskType::ErrorPointValueType>::NonpositiveMin();
81 spTask->setRegistration(castedReg);
82 spTask->setThrowOnMappingError(throwOnMappingError);
83 spTask->setErrorPointValue(internalErrorValue);
85 unsigned int timePos = timeStep;
86 unsigned int timeEndPos = timeStep+1;
90 timeEndPos = input->GetTimeSteps();
93 while (timePos<timeEndPos)
96 spTask->setInputPointSet(inputTempSet);
101 unsigned int pointCount = input->GetSize(timePos);
103 for (
unsigned int pointId = 0; pointId < pointCount; ++pointId)
105 result->SetPoint(pointId, mappedSet->GetPoint(pointId), timePos);
108 if (mappedSet->GetPointData(pointId,&mappedData))
110 invalid = mappedData == internalErrorValue;
115 result->GetPointSet(timePos)->GetPointData()->SetElement(pointId,errorPointValue);
119 result->GetPointSet(timePos)->GetPointData()->SetElement(pointId,input->GetPointSet(timePos)->GetPointData()->GetElement(pointId));
131 bool throwOnMappingError, const ::mitk::PointSet::PointDataType& errorPointValue)
135 mitkThrow() <<
"Cannot map point set. Passed registration wrapper pointer is NULL.";
139 mitkThrow() <<
"Cannot map point set. Passed registration wrapper containes no registration.";
143 mitkThrow() <<
"Cannot map point set. Passed point set pointer is NULL.";
itk::SmartPointer< Self > Pointer
struct for data of a point
MAPRegistrationWrapper Wrapper class to allow the handling of MatchPoint registration objects as mitk...
MITKMATCHPOINTREGISTRATION_EXPORT::mitk::PointSet::Pointer map(const ::mitk::PointSet *input, const RegistrationType *registration, int timeStep=-1, bool throwOnMappingError=true, const ::mitk::PointSet::PointDataType &errorPointValue=::mitk::PointSet::PointDataType())
map::core::RegistrationBase * GetRegistration()
MITKMATCHPOINTREGISTRATION_EXPORT::map::core::continuous::Elements< 3 >::InternalPointSetType::Pointer ConvertPointSetMITKtoMAP(const mitk::PointSet::DataType *mitkSet)
::map::core::RegistrationBase RegistrationType
MITKMATCHPOINTREGISTRATION_EXPORT ResultImageType::Pointer map(const InputImageType *input, const RegistrationType *registration, bool throwOnOutOfInputAreaError=false, const double &paddingValue=0, const ResultImageGeometryType *resultGeometry=NULL, bool throwOnMappingError=true, const double &errorValue=0, mitk::ImageMappingInterpolator::Type interpolatorType=mitk::ImageMappingInterpolator::Linear)
static itkEventMacro(BoundingShapeInteractionEvent, itk::AnyEvent) class MITKBOUNDINGSHAPE_EXPORT BoundingShapeInteractor Pointer New()
Basic interaction methods for mitk::GeometryData.