38 if (otherPts->GetPointData(i.Index(), &pointData))
62 PointDataContainer::Pointer pointData = PointDataContainer::New();
89 if (timeSteps > oldSize)
94 for (
unsigned int i = oldSize; i < timeSteps; ++i)
97 PointDataContainer::Pointer pointData = PointDataContainer::New();
104 this->InvokeEvent(PointSetExtendTimeRangeEvent());
200 PointsContainer::Iterator it, end;
203 distance = distance * distance;
216 bool ok =
m_PointSetSeries[t]->GetPoints()->GetElementIfIndexExists(it->Index(), &out);
222 else if (indexPoint == out)
228 tmp = out[0] - indexPoint[0];
230 tmp = out[1] - indexPoint[1];
232 tmp = out[2] - indexPoint[2];
237 bestIndex = it->Index();
293 defaultPointData.
id = id;
312 defaultPointData.
id = id;
332 if (tempGeometry ==
nullptr)
334 MITK_INFO << __FILE__ <<
", l." << __LINE__ <<
": GetGeometry of " << t <<
" returned nullptr!" << std::endl;
340 defaultPointData.
id = id;
368 defaultPointData.
id = id;
389 bool exists = points->IndexExists(
id);
392 points->DeleteIndex(
id);
393 pdata->DeleteIndex(
id);
414 PointsContainer::ElementIdentifier
id = (--eit).Index();
415 points->DeleteIndex(
id);
416 pdata->DeleteIndex(
id);
494 std::unique_ptr<PointOperation> op;
529 int numberOfSelected = 0;
533 if (it->Value().selected ==
true)
539 return numberOfSelected;
552 if (it->Value().selected ==
true)
573 MITK_ERROR <<
"Time step (" << timeStep <<
") outside of PointSet time bounds" << std::endl;
584 int position = pointOp->GetIndex();
587 pt.CastFrom(pointOp->GetPoint());
590 this->
Expand(timeStep + 1);
594 if (geometry ==
nullptr)
596 MITK_INFO <<
"GetGeometry returned nullptr!\n";
604 static_cast<unsigned int>(pointOp->GetIndex()), pointOp->GetSelected(), pointOp->GetPointType()};
606 m_PointSetSeries[timeStep]->GetPointData()->InsertElement(position, pointData);
613 this->InvokeEvent(PointSetAddEvent());
621 pt.CastFrom(pointOp->GetPoint());
632 if (!
m_PointSetSeries[timeStep]->GetPointData(pointOp->GetIndex(), &pointData))
644 this->InvokeEvent(PointSetMoveEvent());
650 m_PointSetSeries[timeStep]->GetPoints()->DeleteIndex((
unsigned)pointOp->GetIndex());
651 m_PointSetSeries[timeStep]->GetPointData()->DeleteIndex((
unsigned)pointOp->GetIndex());
659 this->InvokeEvent(PointSetRemoveEvent());
687 pointData.
pointSpec = pointOp->GetPointType();
698 PointsContainer::STLContainerType points =
m_PointSetSeries[timeStep]->GetPoints()->CastToSTLContainer();
699 auto it = points.find(currentID);
700 if (it == points.end())
702 if (it == points.begin())
716 PointsContainer::STLContainerType points =
m_PointSetSeries[timeStep]->GetPoints()->CastToSTLContainer();
717 auto it = points.find(currentID);
718 if (it == points.end())
721 if (it == points.end())
732 itkWarningMacro(
"mitkPointSet could not understrand the operation. Please check!");
741 ((
const itk::Object *)
this)->InvokeEvent(endevent);
752 this->
GetSource()->UpdateOutputInformation();
762 itkExceptionMacro(<<
"timeGeometry->CountTimeSteps() != m_PointSetSeries.size() -- use Initialize(timeSteps) with " 763 "correct number of timeSteps!");
782 (itkBounds == itkBoundsNull))
784 itkBounds = itkBoundsNull;
789 for (
unsigned int j = 0; j < 3; ++j)
791 if (itkBounds[j * 2 + 1] - itkBounds[j * 2] < 1.0)
793 BoundingBox::CoordRepType center = (itkBounds[j * 2] + itkBounds[j * 2 + 1]) / 2.0;
794 itkBounds[j * 2] = center - 0.5;
795 itkBounds[j * 2 + 1] = center + 0.5;
831 os << indent <<
"Timestep " << i++ <<
": \n";
832 MeshType::Pointer ps = *it;
833 itk::Indent nextIndent = indent.GetNextIndent();
834 ps->Print(os, nextIndent);
835 MeshType::PointsContainer *points = ps->GetPoints();
836 MeshType::PointDataContainer *datas = ps->GetPointData();
837 MeshType::PointDataContainer::Iterator dataIterator = datas->Begin();
838 for (MeshType::PointsContainer::Iterator pointIterator = points->Begin(); pointIterator != points->End();
839 ++pointIterator, ++dataIterator)
841 os << nextIndent <<
"Point " << pointIterator->Index() <<
": [";
842 os << pointIterator->Value().GetElement(0);
843 for (
unsigned int i = 1; i < PointType::GetPointDimension(); ++i)
845 os <<
", " << pointIterator->Value().GetElement(i);
848 os <<
", selected: " << dataIterator->Value().selected <<
", point spec: " << dataIterator->Value().pointSpec
888 if ((leftHandSide ==
nullptr) || (rightHandSide ==
nullptr))
890 MITK_ERROR <<
"mitk::Equal( const mitk::PointSet* leftHandSide, const mitk::PointSet* rightHandSide, " 891 "mitk::ScalarType eps, bool verbose ) does not work with nullptr pointer input.";
894 return Equal(*leftHandSide, *rightHandSide, eps, verbose, checkGeometry);
912 MITK_INFO <<
"[( PointSet )] Geometries differ.";
920 MITK_INFO <<
"[( PointSet )] Number of points differ.";
929 int numberOfIncorrectPoints = 0;
934 pointSetIteratorRight = rightHandSide.
Begin();
935 pointSetIteratorLeft != end;
936 ++pointSetIteratorLeft, ++pointSetIteratorRight)
938 pointLeftHandSide = pointSetIteratorLeft.Value();
939 pointRightHandSide = pointSetIteratorRight.Value();
940 if (!
mitk::Equal(pointLeftHandSide, pointRightHandSide, eps, verbose))
943 MITK_INFO <<
"[( PointSet )] Point values are different.";
945 numberOfIncorrectPoints++;
949 if ((numberOfIncorrectPoints > 0) && verbose)
951 MITK_INFO << numberOfIncorrectPoints <<
" of a total of " << leftHandSide.
GetSize() <<
" points are different.";
DataType::PointsContainerIterator PointsIterator
PointsIterator GetMaxId(int t=0)
Get an iterator to the max ID element if existent. Return End() otherwise.
itk::SmartPointer< mitk::BaseDataSource > GetSource() const
Get the process object that generated this data object.
virtual void ClearData()
reset to non-initialized state, release memory
void IndexToWorld(const mitk::Vector3D &vec_units, mitk::Vector3D &vec_mm) const
Convert (continuous or discrete) index coordinates of a vector vec_units to world coordinates (in mm)...
void PrintSelf(std::ostream &os, itk::Indent indent) const override
virtual TimeStepType CountTimeSteps() const =0
Returns the number of time steps.
void PrintSelf(std::ostream &os, itk::Indent indent) const override
print content of the object to os
void Expand(unsigned int timeSteps) override
Expands the TimeGeometry to a number of TimeSteps.
DataType::PointDataContainer PointDataContainer
int SearchPoint(Point3D point, ScalarType distance, int t=0) const
searches a point in the list == point +/- distance
Base of all data objects.
virtual PointSpecificationType GetSpecificationTypeInfo(int position, int t) const
to get the type of the point at the position and the moment
Base class of all Operation-classes.
virtual unsigned int GetPointSetSeriesSize() const
void SetRequestedRegionToLargestPossibleRegion() override
Set the RequestedRegion to the LargestPossibleRegion.
void ExecuteOperation(Operation *operation) override
executes the given Operation
bool m_CalculateBoundingBox
flag to indicate the right time to call SetBounds
bool SwapPointContents(PointIdentifier id1, PointIdentifier id2, int t=0)
swaps point coordinates and point data of the points with identifiers id1 and id2 ...
#define mitkCheckOperationTypeMacro(OperationType, operation, newOperationName)
struct for data of a point
virtual void OnPointSetChange()
virtual int SearchSelectedPoint(int t=0) const
searches a selected point and returns the id of that point. If no point is found, then -1 is returned...
mitk::PointSpecificationType pointSpec
Constants for most interaction classes, due to the generic StateMachines.
void ClearData() override
reset to non-initialized state, release memory
DataType::PointsContainer::ConstIterator PointsConstIterator
virtual bool IndexExists(int position, int t=0) const
returns true if a point exists at this position
bool GetPointIfExists(PointIdentifier id, PointType *point, int t=0) const
Get the point with ID id in world coordinates.
void InitializeEmpty() override
Pure virtual; Must be used in subclasses to get a data object to a valid state. Should at least creat...
bool SwapPointPosition(PointIdentifier id, bool moveUpwards, int t=0)
Swap a point at the given position (id) with the upper point (moveUpwards=true) or with the lower poi...
PointSetSeries m_PointSetSeries
virtual void SetSelectInfo(int position, bool selected, int t=0)
bool RequestedRegionIsOutsideOfTheBufferedRegion() override
Determine whether the RequestedRegion is outside of the BufferedRegion.
DataType::PointIdentifier PointIdentifier
bool RemovePointIfExists(PointIdentifier id, int t=0)
Remove point with given id at timestep t, if existent.
virtual int GetSize(unsigned int t=0) const
returns the current size of the point-list
const mitk::TimeGeometry * GetTimeGeometry() const
Return the TimeGeometry of the data as const pointer.
Data structure which stores a set of points. Superclass of mitk::Mesh.
virtual int GetNumberOfSelected(int t=0) const
returns the number of selected points
virtual TimeStepType TimePointToTimeStep(TimePointType timePoint) const =0
Converts a time point to the corresponding time step.
itk::BoundingBox< unsigned long, 3, mitk::ScalarType > BoundingBoxType
virtual bool GetSelectInfo(int position, int t=0) const
to get the state selected/unselected of the point on the position
virtual DataType::Pointer GetPointSet(int t=0) const
returns the pointset
virtual TimePointType TimeStepToTimePoint(TimeStepType timeStep) const =0
Converts a time step to a time point.
Operation that handles all actions on one Point.
void InsertPoint(PointIdentifier id, PointType point, int t=0)
Set the given point in world coordinate system into the itkPointSet.
mitk::ScalarType TimePointType
void WorldToIndex(const mitk::Point3D &pt_mm, mitk::Point3D &pt_units) const
Convert world coordinates (in mm) of a point to (continuous!) index coordinates.
PointsIterator RemovePointAtEnd(int t=0)
Remove max id point at timestep t and return iterator to precedent point.
DataType::PointsContainer PointsContainer
void SetPoint(PointIdentifier id, PointType point, int t=0)
Set the given point in world coordinate system into the itkPointSet.
MITKNEWMODULE_EXPORT bool Equal(mitk::ExampleDataStructure *leftHandSide, mitk::ExampleDataStructure *rightHandSide, mitk::ScalarType eps, bool verbose)
Returns true if the example data structures are considered equal.
void SetBounds(const BoundsArrayType &bounds)
Set the bounding box (in index/unit coordinates)
virtual bool IsInitialized() const
Check whether the data has been initialized, i.e., at least the Geometry and other header data has be...
DataType::PointsContainer::Pointer m_EmptyPointsContainer
bool VerifyRequestedRegion() override
Verify that the RequestedRegion is within the LargestPossibleRegion.
MITKCORE_EXPORT const ScalarType eps
unsigned int GetTimeSteps() const
Get the number of time steps from the TimeGeometry As the base data has not a data vector given by it...
PointsIterator Begin(int t=0)
bool IsEmptyTimeStep(unsigned int t) const override
Check whether object contains data (at a specified time), e.g., a set of points may be empty...
PointType GetPoint(PointIdentifier id, int t=0) const
Get the point with ID id in world coordinates.
DataType::PointDataContainerIterator PointDataIterator
OperationType GetOperationType()
void UpdateOutputInformation() override
void Update()
Updates the geometry.
mitk::BaseGeometry * GetGeometry(int t=0) const
Return the geometry, which is a TimeGeometry, of the data as non-const pointer.
virtual void Expand(unsigned int timeSteps)
Expands the TimeGeometry to a number of TimeSteps.
PointSpecificationType
enumeration of the type a point can be
PointsIterator End(int t=0)
virtual void InitializeTimeGeometry(unsigned int timeSteps=1)
Initialize the TimeGeometry for a number of time steps. The TimeGeometry is initialized empty and eve...
BaseGeometry Describes the geometry of a data object.
bool operator==(const PointDataType &other) const
BoundingBoxType::BoundsArrayType BoundsArrayType
void SetRequestedRegion(const itk::DataObject *data) override
Set the requested region from this data object to match the requested region of the data object passe...