Data structure which stores a set of points. Superclass of mitk::Mesh. More...
#include <mitkPointSet.h>
Classes | |
struct | CellDataType |
struct | PointDataType |
struct for data of a point More... | |
Public Types | |
typedef PointSet | Self |
typedef BaseData | Superclass |
typedef itk::SmartPointer< Self > | Pointer |
typedef itk::SmartPointer < const Self > | ConstPointer |
typedef mitk::ScalarType | CoordinateType |
typedef mitk::ScalarType | InterpolationWeightType |
typedef std::vector< unsigned int > | SelectedLinesType |
cellDataType, that stores all indexes of the lines, that are selected e.g.: points A,B and C.Between A and B there is a line with index 0. If vector of cellData contains 1 and 2, then the lines between B and C and C and A is selected. | |
typedef SelectedLinesType::iterator | SelectedLinesIter |
typedef itk::DefaultDynamicMeshTraits < PointDataType, PointDimension, MaxTopologicalDimension, CoordinateType, InterpolationWeightType, CellDataType > | MeshTraits |
typedef itk::Mesh < PointDataType, PointDimension, MeshTraits > | MeshType |
typedef MeshType | DataType |
typedef DataType::PointType | PointType |
typedef DataType::PointIdentifier | PointIdentifier |
typedef DataType::PointsContainer | PointsContainer |
typedef DataType::PointsContainerIterator | PointsIterator |
typedef DataType::PointsContainer::ConstIterator | PointsConstIterator |
typedef DataType::PointDataContainer | PointDataContainer |
typedef DataType::PointDataContainerIterator | PointDataIterator |
Public Member Functions | |
virtual const char * | GetClassName () const |
virtual void | Expand (unsigned int timeSteps) |
Expands the TimeSlicedGeometry to a number of TimeSteps. | |
virtual void | ExecuteOperation (Operation *operation) |
executes the given Operation | |
virtual int | GetSize (unsigned int t=0) const |
returns the current size of the point-list | |
virtual unsigned int | GetPointSetSeriesSize () const |
virtual DataType::Pointer | GetPointSet (int t=0) const |
returns the pointset | |
PointType | GetPoint (PointIdentifier id, int t=0) const |
Get the point with ID id in world coordinates. | |
bool | GetPointIfExists (PointIdentifier id, PointType *point, int t=0) const |
Get the point with ID id in world coordinates. | |
void | SetPoint (PointIdentifier id, PointType point, int t=0) |
Set the given point in world coordinate system into the itkPointSet. | |
void | SetPoint (PointIdentifier id, PointType point, PointSpecificationType spec, int t=0) |
Set the given point in world coordinate system with the given PointSpecificationType. | |
void | InsertPoint (PointIdentifier id, PointType point, int t=0) |
Set the given point in world coordinate system into the itkPointSet. | |
void | InsertPoint (PointIdentifier id, PointType point, PointSpecificationType spec, int t) |
Set the given point in world coordinate system with given PointSpecificationType. | |
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 point (moveUpwards=false). If upper or lower index does not exist false is returned, if swap was successful true. | |
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 | |
virtual bool | IndexExists (int position, int t=0) const |
returns true if a point exists at this position | |
virtual bool | GetSelectInfo (int position, int t=0) const |
to get the state selected/unselected of the point on the position | |
virtual void | SetSelectInfo (int position, bool selected, int t=0) |
virtual PointSpecificationType | GetSpecificationTypeInfo (int position, int t) const |
to get the type of the point at the position and the moment | |
virtual int | GetNumberOfSelected (int t=0) const |
returns the number of selected points | |
int | SearchPoint (Point3D point, float distance, int t=0) const |
searches a point in the list == point +/- distance | |
virtual bool | IsEmpty (unsigned int t) const |
Check whether object contains data (at a specified time), e.g., a set of points may be empty. | |
virtual void | UpdateOutputInformation () |
Update the information for this BaseData (the geometry in particular) so that it can be used as an output of a BaseProcess. | |
virtual void | SetRequestedRegionToLargestPossibleRegion () |
Set the RequestedRegion to the LargestPossibleRegion. | |
virtual bool | RequestedRegionIsOutsideOfTheBufferedRegion () |
Determine whether the RequestedRegion is outside of the BufferedRegion. | |
virtual bool | VerifyRequestedRegion () |
Verify that the RequestedRegion is within the LargestPossibleRegion. | |
virtual void | SetRequestedRegion (itk::DataObject *data) |
Set the requested region from this data object to match the requested region of the data object passed in as a parameter. | |
virtual void | OnPointSetChange () |
Static Public Member Functions | |
static Pointer | New () |
Static Public Attributes | |
static const unsigned int | PointDimension = 3 |
static const unsigned int | MaxTopologicalDimension = 3 |
Protected Types | |
typedef std::vector < DataType::Pointer > | PointSetSeries |
Protected Member Functions | |
PointSet () | |
virtual | ~PointSet () |
virtual void | PrintSelf (std::ostream &os, itk::Indent indent) const |
print content of the object to os | |
virtual void | ClearData () |
reset to non-initialized state, release memory | |
virtual void | InitializeEmpty () |
Pure virtual; Must be used in subclasses to get a data object to a valid state. Should at least create one empty object and call Superclass::InitializeTimeSlicedGeometry() to ensure an existing valid geometry. | |
bool | SwapPointContents (PointIdentifier id1, PointIdentifier id2, int t=0) |
swaps point coordinates and point data of the points with identifiers id1 and id2 | |
Protected Attributes | |
PointSetSeries | m_PointSetSeries |
bool | m_CalculateBoundingBox |
flag to indicate the right time to call SetBounds |
Data structure which stores a set of points. Superclass of mitk::Mesh.
3D points are grouped within a point set; for time resolved usage, one point set is created and maintained per time step. A point entry consists of the point coordinates and point data.
The point data includes a point ID (unique identifier to address this point within the point set), the selection state of the point and the type of the point.
For further information about different point types see mitk::PointSpecificationType in mitkVector.h.
Inserting a point is accompanied by an event, containing an index. The new point is inserted into the list at the specified position. At the same time an internal ID is generated and stored for the point. Points at specific time steps are accessed by specifying the time step number (which defaults to 0).
The points of itk::PointSet stores the points in a pointContainer (MapContainer). The points are best accessed by using a ConstIterator (as defined in MapContainer); avoid access via index.
The class internally uses an itk::Mesh for each time step, because mitk::Mesh is derived from mitk::PointSet and needs the itk::Mesh structure which is also derived from itk::PointSet. Thus several typedefs which seem to be in wrong place, are declared here (for example SelectedLinesType).
The default mappers for this data structure are mitk::PointSetGLMapper2D and mitk::PointSetVtkMapper3D. See these classes for display options which can can be set via properties.
PointSet issues the following events, for which observers can register (the below events are grouped into a class hierarchy as indicated by identation level; e.g. PointSetSizeChangeEvent comprises PointSetAddEvent and PointSetRemoveEvent):
PointSetEvent subsumes all PointSet events PointSetMoveEvent issued when a point of the PointSet is moved PointSetSizeChangeEvent subsumes add and remove events PointSetAddEvent issued when a point is added to the PointSet PointSetRemoveEvent issued when a point is removed from the PointSet
Definition at line 82 of file mitkPointSet.h.
typedef itk::SmartPointer<const Self> mitk::PointSet::ConstPointer |
Reimplemented from mitk::BaseData.
Reimplemented in mitk::Mesh.
Definition at line 85 of file mitkPointSet.h.
typedef mitk::ScalarType mitk::PointSet::CoordinateType |
Definition at line 87 of file mitkPointSet.h.
typedef MeshType mitk::PointSet::DataType |
Definition at line 131 of file mitkPointSet.h.
typedef mitk::ScalarType mitk::PointSet::InterpolationWeightType |
Definition at line 91 of file mitkPointSet.h.
typedef itk::DefaultDynamicMeshTraits< PointDataType, PointDimension, MaxTopologicalDimension, CoordinateType, InterpolationWeightType, CellDataType > mitk::PointSet::MeshTraits |
Definition at line 128 of file mitkPointSet.h.
typedef itk::Mesh<PointDataType, PointDimension, MeshTraits> mitk::PointSet::MeshType |
Definition at line 129 of file mitkPointSet.h.
typedef DataType::PointDataContainer mitk::PointSet::PointDataContainer |
Definition at line 137 of file mitkPointSet.h.
typedef DataType::PointDataContainerIterator mitk::PointSet::PointDataIterator |
Definition at line 138 of file mitkPointSet.h.
typedef itk::SmartPointer<Self> mitk::PointSet::Pointer |
Reimplemented from mitk::BaseData.
Reimplemented in mitk::Mesh.
Definition at line 85 of file mitkPointSet.h.
typedef DataType::PointIdentifier mitk::PointSet::PointIdentifier |
Definition at line 133 of file mitkPointSet.h.
typedef DataType::PointsContainer::ConstIterator mitk::PointSet::PointsConstIterator |
Definition at line 136 of file mitkPointSet.h.
typedef DataType::PointsContainer mitk::PointSet::PointsContainer |
Definition at line 134 of file mitkPointSet.h.
typedef std::vector< DataType::Pointer > mitk::PointSet::PointSetSeries [protected] |
Definition at line 253 of file mitkPointSet.h.
typedef DataType::PointsContainerIterator mitk::PointSet::PointsIterator |
Definition at line 135 of file mitkPointSet.h.
typedef DataType::PointType mitk::PointSet::PointType |
Definition at line 132 of file mitkPointSet.h.
typedef SelectedLinesType::iterator mitk::PointSet::SelectedLinesIter |
Definition at line 113 of file mitkPointSet.h.
typedef std::vector<unsigned int> mitk::PointSet::SelectedLinesType |
cellDataType, that stores all indexes of the lines, that are selected e.g.: points A,B and C.Between A and B there is a line with index 0. If vector of cellData contains 1 and 2, then the lines between B and C and C and A is selected.
Definition at line 112 of file mitkPointSet.h.
typedef PointSet mitk::PointSet::Self |
Reimplemented from mitk::BaseData.
Reimplemented in mitk::Mesh.
Definition at line 85 of file mitkPointSet.h.
typedef BaseData mitk::PointSet::Superclass |
Reimplemented from mitk::BaseData.
Reimplemented in mitk::Mesh.
Definition at line 85 of file mitkPointSet.h.
mitk::PointSet::PointSet | ( | ) | [protected] |
Definition at line 26 of file mitkPointSet.cpp.
References InitializeEmpty().
{ this->InitializeEmpty(); }
mitk::PointSet::~PointSet | ( | ) | [protected, virtual] |
Definition at line 31 of file mitkPointSet.cpp.
{ this->ClearData(); }
void mitk::PointSet::ClearData | ( | ) | [protected, virtual] |
reset to non-initialized state, release memory
Reimplemented from mitk::BaseData.
Definition at line 36 of file mitkPointSet.cpp.
{ m_PointSetSeries.clear(); Superclass::ClearData(); }
void mitk::PointSet::ExecuteOperation | ( | Operation * | operation ) | [virtual] |
executes the given Operation
Reimplemented from mitk::BaseData.
Reimplemented in mitk::Mesh.
Definition at line 457 of file mitkPointSet.cpp.
References mitk::Operation::GetOperationType(), MITK_ERROR, MITK_INFO, mitkCheckOperationTypeMacro, mitk::OpDESELECTPOINT, mitk::OpINSERT, mitk::OpMOVE, mitk::OpMOVEPOINTDOWN, mitk::OpMOVEPOINTUP, mitk::OpNOTHING, mitk::OpREMOVE, mitk::OpSELECTPOINT, mitk::OpSETPOINTTYPE, mitk::PointSet::PointDataType::pointSpec, mitk::PointSet::PointDataType::selected, and mitk::Geometry3D::WorldToIndex().
Referenced by mitk::PointSetInteractor::Clear(), mitk::PointSelectorInteractor::DeselectAllPoints(), mitk::PointInteractor::DeselectAllPoints(), mitk::PointSetInteractor::ExecuteAction(), mitk::PointSelectorInteractor::ExecuteAction(), mitk::PointInteractor::ExecuteAction(), mitk::PointSetInteractor::SelectPoint(), mitk::PointSelectorInteractor::SelectPoint(), mitk::PointInteractor::SelectPoint(), mitkPointSetTestClass::TestCreateHoleInThePointIDs(), mitkPointSetTestClass::TestCreateOperationAndAddPoint(), mitkPointSetTestClass::TestOpDeselectPoint(), mitkPointSetTestClass::TestOpMovePointDown(), mitkPointSetTestClass::TestOpMovePointUp(), mitkPointSetTestClass::TestOpMovePointUpOnFirstPoint(), mitkPointSetTestClass::TestPointOperationOpMove(), mitkPointSetTestClass::TestPointOperationOpRemove(), mitkPointSetTestClass::TestPointOperationOpSelectPoint(), and mitk::PointSetInteractor::UnselectAll().
{ int timeStep = -1; mitkCheckOperationTypeMacro(PointOperation, operation, pointOp); if ( pointOp ) { timeStep = this->GetTimeSlicedGeometry() ->MSToTimeStep( pointOp->GetTimeInMS() ); } if ( timeStep < 0 ) { MITK_ERROR << "Time step (" << timeStep << ") outside of PointSet time bounds" << std::endl; return; } switch (operation->GetOperationType()) { case OpNOTHING: break; case OpINSERT://inserts the point at the given position and selects it. { int position = pointOp->GetIndex(); PointType pt; pt.CastFrom(pointOp->GetPoint()); //transfer from world to index coordinates mitk::Geometry3D* geometry = this->GetGeometry( timeStep ); if (geometry == NULL) { MITK_INFO<<"GetGeometry returned NULL!\n"; return; } geometry->WorldToIndex(pt, pt); m_PointSetSeries[timeStep]->GetPoints()->InsertElement(position, pt); PointDataType pointData = { pointOp->GetIndex(), pointOp->GetSelected(), pointOp->GetPointType() }; m_PointSetSeries[timeStep]->GetPointData() ->InsertElement(position, pointData); this->Modified(); //boundingbox has to be computed m_CalculateBoundingBox = true; this->InvokeEvent( PointSetAddEvent() ); this->OnPointSetChange(); } break; case OpMOVE://moves the point given by index { PointType pt; pt.CastFrom(pointOp->GetPoint()); //transfer from world to index coordinates this->GetGeometry( timeStep )->WorldToIndex(pt, pt); // Copy new point into container m_PointSetSeries[timeStep]->SetPoint(pointOp->GetIndex(), pt); // Insert a default point data object to keep the containers in sync // (if no point data object exists yet) PointDataType pointData; if ( !m_PointSetSeries[timeStep]->GetPointData( pointOp->GetIndex(), &pointData ) ) { m_PointSetSeries[timeStep]->SetPointData( pointOp->GetIndex(), pointData ); } this->OnPointSetChange(); this->Modified(); //boundingbox has to be computed anyway m_CalculateBoundingBox = true; this->InvokeEvent( PointSetMoveEvent() ); } break; case OpREMOVE://removes the point at given by position { m_PointSetSeries[timeStep]->GetPoints()->DeleteIndex((unsigned)pointOp->GetIndex()); m_PointSetSeries[timeStep]->GetPointData()->DeleteIndex((unsigned)pointOp->GetIndex()); this->OnPointSetChange(); this->Modified(); //boundingbox has to be computed anyway m_CalculateBoundingBox = true; this->InvokeEvent( PointSetRemoveEvent() ); } break; case OpSELECTPOINT://select the given point { PointDataType pointData = {0, false, PTUNDEFINED}; m_PointSetSeries[timeStep]->GetPointData(pointOp->GetIndex(), &pointData); pointData.selected = true; m_PointSetSeries[timeStep]->SetPointData(pointOp->GetIndex(), pointData); this->Modified(); } break; case OpDESELECTPOINT://unselect the given point { PointDataType pointData = {0, false, PTUNDEFINED}; m_PointSetSeries[timeStep]->GetPointData(pointOp->GetIndex(), &pointData); pointData.selected = false; m_PointSetSeries[timeStep]->SetPointData(pointOp->GetIndex(), pointData); this->Modified(); } break; case OpSETPOINTTYPE: { PointDataType pointData = {0, false, PTUNDEFINED}; m_PointSetSeries[timeStep]->GetPointData(pointOp->GetIndex(), &pointData); pointData.pointSpec = pointOp->GetPointType(); m_PointSetSeries[timeStep]->SetPointData(pointOp->GetIndex(), pointData); this->Modified(); } break; case OpMOVEPOINTUP: // swap content of point with ID pointOp->GetIndex() with the point preceding it in the container // move point position within the pointset { PointIdentifier currentID = pointOp->GetIndex(); /* search for point with this id and point that precedes this one in the data container */ PointsContainer::STLContainerType points = m_PointSetSeries[timeStep]->GetPoints()->CastToSTLContainer(); PointsContainer::STLContainerType::iterator it = points.find(currentID); if (it == points.end()) // ID not found break; if (it == points.begin()) // we are at the first element, there is no previous element break; /* get and cache current point & pointdata and previous point & pointdata */ --it; PointIdentifier prevID = it->first; if (this->SwapPointContents(prevID, currentID, timeStep) == true) this->Modified(); } break; case OpMOVEPOINTDOWN: // move point position within the pointset { PointIdentifier currentID = pointOp->GetIndex(); /* search for point with this id and point that succeeds this one in the data container */ PointsContainer::STLContainerType points = m_PointSetSeries[timeStep]->GetPoints()->CastToSTLContainer(); PointsContainer::STLContainerType::iterator it = points.find(currentID); if (it == points.end()) // ID not found break; ++it; if (it == points.end()) // ID is already the last element, there is no succeeding element break; /* get and cache current point & pointdata and previous point & pointdata */ PointIdentifier nextID = it->first; if (this->SwapPointContents(nextID, currentID, timeStep) == true) this->Modified(); } break; default: itkWarningMacro("mitkPointSet could not understrand the operation. Please check!"); break; } //to tell the mappers, that the data is modified and has to be updated //only call modified if anything is done, so call in cases //this->Modified(); mitk::OperationEndEvent endevent(operation); ((const itk::Object*)this)->InvokeEvent(endevent); //*todo has to be done here, cause of update-pipeline not working yet // As discussed lately, don't mess with the rendering from inside data structures //mitk::RenderingManager::GetInstance()->RequestUpdateAll(); }
void mitk::PointSet::Expand | ( | unsigned int | timeSteps ) | [virtual] |
Expands the TimeSlicedGeometry to a number of TimeSteps.
The method expands the TimeSlicedGeometry to the given number of TimeSteps, filling newly created elements with empty geometries. Sub-classes should override this method to handle the elongation of their data vectors, too. Note that a shrinking is neither possible nor intended.
Reimplemented from mitk::BaseData.
Definition at line 60 of file mitkPointSet.cpp.
{ // Check if the vector is long enough to contain the new element // at the given position. If not, expand it with sufficient pre-initialized // elements. // // NOTE: This method will never REDUCE the vector size; it should only // be used to make sure that the vector has enough elements to include the // specified time step. unsigned int oldSize = m_PointSetSeries.size(); if ( timeSteps > oldSize ) { Superclass::Expand( timeSteps ); m_PointSetSeries.resize( timeSteps ); for ( unsigned int i = oldSize; i < timeSteps; ++i ) { m_PointSetSeries[i] = DataType::New(); PointDataContainer::Pointer pointData = PointDataContainer::New(); m_PointSetSeries[i]->SetPointData( pointData ); } //if the size changes, then compute the bounding box m_CalculateBoundingBox = true; this->InvokeEvent( PointSetExtendTimeRangeEvent() ); } }
virtual const char* mitk::PointSet::GetClassName | ( | ) | const [virtual] |
Reimplemented from mitk::BaseData.
Reimplemented in mitk::Mesh.
int mitk::PointSet::GetNumberOfSelected | ( | int | t = 0 ) |
const [virtual] |
returns the number of selected points
Definition at line 414 of file mitkPointSet.cpp.
References QuadProgPP::t().
Referenced by mitk::PointSetInteractor::ExecuteAction(), QmitkPointListView::OnPointSetSelectionChanged(), mitkPointSetTestClass::TestGetNumberOfSelected(), and mitkPointSetTestClass::TestOpDeselectPoint().
{ if ( (unsigned int) t >= m_PointSetSeries.size() ) { return 0; } int numberOfSelected = 0; PointDataIterator it; for ( it = m_PointSetSeries[t]->GetPointData()->Begin(); it != m_PointSetSeries[t]->GetPointData()->End(); it++ ) { if (it->Value().selected == true) { ++numberOfSelected; } } return numberOfSelected; }
mitk::PointSet::PointType mitk::PointSet::GetPoint | ( | PointIdentifier | id, |
int | t = 0 |
||
) | const |
Get the point with ID id in world coordinates.
check if the ID exists. If it doesn't exist, then return 0,0,0
Definition at line 184 of file mitkPointSet.cpp.
References QuadProgPP::t().
Referenced by mitk::InterpolateLinesFilter::BuildPointAndVectorList(), mitk::PointSetInteractor::Clear(), mitk::PointSetInteractor::ExecuteAction(), mitk::PointSelectorInteractor::ExecuteAction(), mitk::PointInteractor::ExecuteAction(), mitk::ConnectPointsInteractor::ExecuteAction(), mitk::NavigationDataToPointSetFilter::GenerateDataMode3DMean(), QmitkPointListView::OnListViewSelectionChanged(), QmitkEditPointDialog::OnOkButtonClicked(), QmitkEditPointDialog::SetPoint(), mitkPointSetTestClass::TestAddSecondPoint(), mitkPointSetTestClass::TestCreateHoleInThePointIDs(), mitkPointSetTestClass::TestCreateOperationAndAddPoint(), mitkPointSetTestClass::TestInsertPointWithPointSpecification(), mitkPointSetTestClass::TestOpMovePointDown(), mitkPointSetTestClass::TestOpMovePointUp(), mitkPointSetTestClass::TestOpMovePointUpOnFirstPoint(), mitkPointSetTestClass::TestPointOperationOpMove(), mitkPointSetTestClass::TestPointOperationOpRemove(), mitkPointSetTestClass::TestSwapPointPositionDownwards(), and mitkPointSetTestClass::TestSwapPointPositionUpwards().
{ PointType out; out.Fill(0); if ( (unsigned int) t >= m_PointSetSeries.size() ) { return out; } if ( m_PointSetSeries[t]->GetPoints()->IndexExists(id) ) { m_PointSetSeries[t]->GetPoint( id, &out ); this->GetGeometry(t)->IndexToWorld( out, out ); return out; } else { return out; } }
bool mitk::PointSet::GetPointIfExists | ( | PointIdentifier | id, |
PointType * | point, | ||
int | t = 0 |
||
) | const |
Get the point with ID id in world coordinates.
If a point exists for the ID id, the point is returned in the parameter point and the method returns true. If the ID does not exist, the method returns false
Definition at line 209 of file mitkPointSet.cpp.
Referenced by mitkPointSetTestClass::TestGetPointIfExists().
{ if ( (unsigned int) t >= m_PointSetSeries.size() ) { return false; } if ( m_PointSetSeries[t]->GetPoints()->GetElementIfIndexExists(id, point) ) { this->GetGeometry( t )->IndexToWorld( *point, *point ); return true; } else { return false; } }
mitk::PointSet::DataType::Pointer mitk::PointSet::GetPointSet | ( | int | t = 0 ) |
const [virtual] |
returns the pointset
Definition at line 110 of file mitkPointSet.cpp.
References QuadProgPP::t().
Referenced by mitk::EnhancedPointSetVtkMapper3D::ApplyProperties(), mitk::PointSelectorInteractor::CanHandleEvent(), mitk::PointInteractor::CanHandleEvent(), mitk::ConnectPointsInteractor::CanHandleEvent(), mitk::PointSetInteractor::Clear(), QmitkPointListView::ClearPointList(), mitk::PointSelectorInteractor::DeselectAllPoints(), mitk::PointInteractor::DeselectAllPoints(), mitk::PositionTracker::ExecuteAction(), mitk::PointSetInteractor::ExecuteAction(), mitk::PointInteractor::ExecuteAction(), QmitkPointListView::OnListViewSelectionChanged(), mitk::PointLocator::SetPoints(), mitkPointSetTestClass::TestAddSecondPoint(), mitkPointSetTestClass::TestGetITKPointSet(), mitkPointSetTestClass::TestPointContainerPointDataContainer(), mitk::PointSetInteractor::UnselectAll(), mitk::EnhancedPointSetVtkMapper3D::UpdateVtkObjects(), and mitk::PointSetWriter::WriteXML().
{ if ( t < (int)m_PointSetSeries.size() ) { return m_PointSetSeries[t]; } else { return NULL; } }
unsigned int mitk::PointSet::GetPointSetSeriesSize | ( | ) | const [virtual] |
Definition at line 92 of file mitkPointSet.cpp.
Referenced by mitk::PlaneFit::SetInput().
{ return m_PointSetSeries.size(); }
bool mitk::PointSet::GetSelectInfo | ( | int | position, |
int | t = 0 |
||
) | const [virtual] |
to get the state selected/unselected of the point on the position
Definition at line 361 of file mitkPointSet.cpp.
References mitk::PointSet::PointDataType::selected, and QuadProgPP::t().
Referenced by mitk::PointSetInteractor::ExecuteAction(), mitkPointSetTestClass::TestOpDeselectPoint(), mitkPointSetTestClass::TestPointOperationOpSelectPoint(), and mitkPointSetTestClass::TestSetSelectInfo().
{ if ( this->IndexExists( position, t ) ) { PointDataType pointData = { 0, false, PTUNDEFINED }; m_PointSetSeries[t]->GetPointData( position, &pointData ); return pointData.selected; } else { return false; } }
int mitk::PointSet::GetSize | ( | unsigned int | t = 0 ) |
const [virtual] |
returns the current size of the point-list
Definition at line 98 of file mitkPointSet.cpp.
References QuadProgPP::t().
Referenced by mitk::PointSetInteractor::CanHandleEvent(), mitk::PointSetInteractor::Clear(), mitk::PointSetInteractor::ExecuteAction(), mitk::PointSelectorInteractor::ExecuteAction(), mitk::PointInteractor::ExecuteAction(), mitk::ConnectPointsInteractor::ExecuteAction(), mitk::NavigationDataToPointSetFilter::GenerateDataMode3D(), mitkPlaneFitTest(), QmitkPointListWidget::MoveSelectedPointDown(), QmitkPointListWidget::MoveSelectedPointUp(), QmitkPointListWidget::RemoveSelectedPoint(), mitk::PointSetInteractor::SelectPoint(), mitk::PointSelectorInteractor::SelectPoint(), mitk::PointInteractor::SelectPoint(), mitk::PointLocator::SetPoints(), mitkPointSetTestClass::TestAddSecondPoint(), mitkPointSetTestClass::TestCreateOperationAndAddPoint(), mitkPointSetTestClass::TestGetSizeIsZero(), and mitk::SplineVtkMapper3D::UpdateSpline().
{ if ( t < m_PointSetSeries.size() ) { return m_PointSetSeries[t]->GetNumberOfPoints(); } else { return 0; } }
mitk::PointSpecificationType mitk::PointSet::GetSpecificationTypeInfo | ( | int | position, |
int | t | ||
) | const [virtual] |
to get the type of the point at the position and the moment
Definition at line 400 of file mitkPointSet.cpp.
References mitk::PointSet::PointDataType::pointSpec, and QuadProgPP::t().
Referenced by mitk::PointSetWriter::WriteXML().
{ if ( this->IndexExists( position, t ) ) { PointDataType pointData = { 0, false, PTUNDEFINED }; m_PointSetSeries[t]->GetPointData( position, &pointData ); return pointData.pointSpec; } else { return PTUNDEFINED; } }
bool mitk::PointSet::IndexExists | ( | int | position, |
int | t = 0 |
||
) | const [virtual] |
returns true if a point exists at this position
Definition at line 349 of file mitkPointSet.cpp.
References QuadProgPP::t().
Referenced by mitkPointSetTestClass::TestAddSecondPoint(), mitkPointSetTestClass::TestCreateHoleInThePointIDs(), mitkPointSetTestClass::TestCreateOperationAndAddPoint(), and mitkPointSetTestClass::TestPointOperationOpRemove().
{ if ( (unsigned int) t < m_PointSetSeries.size() ) { return m_PointSetSeries[t]->GetPoints()->IndexExists( position ); } else { return false; } }
void mitk::PointSet::InitializeEmpty | ( | ) | [protected, virtual] |
Pure virtual; Must be used in subclasses to get a data object to a valid state. Should at least create one empty object and call Superclass::InitializeTimeSlicedGeometry() to ensure an existing valid geometry.
Reimplemented from mitk::BaseData.
Definition at line 42 of file mitkPointSet.cpp.
Referenced by PointSet().
{ m_PointSetSeries.resize( 1 ); m_PointSetSeries[0] = DataType::New(); PointDataContainer::Pointer pointData = PointDataContainer::New(); m_PointSetSeries[0]->SetPointData( pointData ); m_CalculateBoundingBox = false; Superclass::InitializeTimeSlicedGeometry(1); m_Initialized = true; }
void mitk::PointSet::InsertPoint | ( | PointIdentifier | id, |
PointType | point, | ||
int | t = 0 |
||
) |
Set the given point in world coordinate system into the itkPointSet.
Definition at line 267 of file mitkPointSet.cpp.
References mitk::PointSet::PointDataType::id, MITK_INFO, mitk::PointSet::PointDataType::pointSpec, mitk::PointSet::PointDataType::selected, QuadProgPP::t(), and mitk::Geometry3D::WorldToIndex().
Referenced by mitk::NavigationDataToPointSetFilter::GenerateDataMode3D(), mitk::NavigationDataToPointSetFilter::GenerateDataMode3DMean(), and mitkPointSetTestClass::TestCreateHoleInThePointIDs().
{ if ( (unsigned int) t < m_PointSetSeries.size() ) { mitk::Point3D indexPoint; mitk::Geometry3D* tempGeometry = this->GetGeometry( t ); if (tempGeometry == NULL) { MITK_INFO<< __FILE__ << ", l." << __LINE__ << ": GetGeometry of "<< t <<" returned NULL!" << std::endl; return; } tempGeometry->WorldToIndex( point, indexPoint ); m_PointSetSeries[t]->GetPoints()->InsertElement( id, indexPoint ); PointDataType defaultPointData; defaultPointData.id = id; defaultPointData.selected = false; defaultPointData.pointSpec = mitk::PTUNDEFINED; m_PointSetSeries[t]->GetPointData()->InsertElement(id, defaultPointData); //boundingbox has to be computed anyway m_CalculateBoundingBox = true; this->Modified(); } }
void mitk::PointSet::InsertPoint | ( | PointIdentifier | id, |
PointType | point, | ||
PointSpecificationType | spec, | ||
int | t | ||
) |
Set the given point in world coordinate system with given PointSpecificationType.
Definition at line 293 of file mitkPointSet.cpp.
References mitk::PointSet::PointDataType::id, MITK_INFO, mitk::PointSet::PointDataType::pointSpec, mitk::PointSet::PointDataType::selected, QuadProgPP::t(), and mitk::Geometry3D::WorldToIndex().
{ if ( (unsigned int) t < m_PointSetSeries.size() ) { mitk::Point3D indexPoint; mitk::Geometry3D* tempGeometry = this->GetGeometry( t ); if (tempGeometry == NULL) { MITK_INFO<< __FILE__ << ", l." << __LINE__ << ": GetGeometry of "<< t <<" returned NULL!" << std::endl; return; } tempGeometry->WorldToIndex( point, indexPoint ); m_PointSetSeries[t]->GetPoints()->InsertElement( id, indexPoint ); PointDataType defaultPointData; defaultPointData.id = id; defaultPointData.selected = false; defaultPointData.pointSpec = spec; m_PointSetSeries[t]->GetPointData()->InsertElement(id, defaultPointData); //boundingbox has to be computed anyway m_CalculateBoundingBox = true; this->Modified(); } }
bool mitk::PointSet::IsEmpty | ( | unsigned int | t ) | const [virtual] |
Check whether object contains data (at a specified time), e.g., a set of points may be empty.
Reimplemented from mitk::BaseData.
Definition at line 55 of file mitkPointSet.cpp.
Referenced by mitkPointSetTestClass::TestIsEmpty(), and mitkPointSetTestClass::TestIsNotEmpty().
{ return IsInitialized() && (GetSize(t) == 0); }
static Pointer mitk::PointSet::New | ( | ) | [static] |
Reimplemented in mitk::Mesh.
Referenced by QmitkSimpleMeasurement::AddAngleSimpleMeasurement(), QmitkSimpleMeasurement::AddDistanceSimpleMeasurement(), QmitkSimpleMeasurement::AddPathSimpleMeasurement(), SceneIOTestClass::CreatePointSet(), QmitkRegionGrowingView::CreateQtPartControl(), mitkPointSetFileIOTestClass::CreateTestPointSet(), QmitkPointBasedRegistrationView::FixedSelected(), mitk::PointSetReader::GenerateData(), Step6::Initialize(), QmitkStdMultiWidget::InitPositionTracking(), main(), mitkNavigationDataLandmarkTransformFilterTest(), mitkNavigationDataReferenceTransformFilterTest(), mitkPlaneFitTest(), mitkPointLocatorTest(), mitkPointSetInteractorTest(), mitkPointSetLocaleTest(), mitkPointSetTest(), mitkPointSetWriterTest(), mitkPropertySerializationTest(), QmitkPointBasedRegistrationView::MovingSelected(), QmitkPointSetInteractionView::OnAddPointSetClicked(), mitk::PointSetWriter::PointSetWriter(), mitk::PointSetWriter::ResizeInputs(), mitkDataNodeTestClass::TestDataSetting(), mitkDataNodeTestClass::TestGetMTime(), mitkPointSetInteractorTestClass::TestOnlyMovePointSetInteractor(), mitkPointSetTestClass::TestSwapPointPositionDownwardsNotPossible(), and WriterLocaleTest().
virtual void mitk::PointSet::OnPointSetChange | ( | ) | [inline, virtual] |
Definition at line 238 of file mitkPointSet.h.
{};
void mitk::PointSet::PrintSelf | ( | std::ostream & | os, |
itk::Indent | indent | ||
) | const [protected, virtual] |
print content of the object to os
Reimplemented from mitk::BaseData.
Definition at line 724 of file mitkPointSet.cpp.
{ Superclass::PrintSelf(os, indent); os << indent << "Number timesteps: " << m_PointSetSeries.size() << "\n"; unsigned int i = 0; for (PointSetSeries::const_iterator it = m_PointSetSeries.begin(); it != m_PointSetSeries.end(); ++it) { os << indent << "Timestep " << i++ << ": \n"; MeshType::Pointer ps = *it; itk::Indent nextIndent = indent.GetNextIndent(); ps->Print(os, nextIndent); MeshType::PointsContainer* points = ps->GetPoints(); MeshType::PointDataContainer* datas = ps->GetPointData(); MeshType::PointDataContainer::Iterator dataIterator = datas->Begin(); for (MeshType::PointsContainer::Iterator pointIterator = points->Begin(); pointIterator != points->End(); ++pointIterator, ++dataIterator) { os << nextIndent << "Point " << pointIterator->Index() << ": ["; os << pointIterator->Value().GetElement(0); for (unsigned int i = 1; i < PointType::GetPointDimension(); ++i) { os << ", " << pointIterator->Value().GetElement(i); } os << "]"; os << ", selected: " << dataIterator->Value().selected << ", point spec: " << dataIterator->Value().pointSpec << "\n"; } } }
bool mitk::PointSet::RequestedRegionIsOutsideOfTheBufferedRegion | ( | ) | [virtual] |
Determine whether the RequestedRegion is outside of the BufferedRegion.
This method returns true if the RequestedRegion is outside the BufferedRegion (true if at least one pixel is outside). This is used by the pipeline mechanism to determine whether a filter needs to re-execute in order to satisfy the current request. If the current RequestedRegion is already inside the BufferedRegion from the previous execution (and the current filter is up to date), then a given filter does not need to re-execute
Implements mitk::BaseData.
Definition at line 709 of file mitkPointSet.cpp.
{ return false; }
int mitk::PointSet::SearchPoint | ( | Point3D | point, |
float | distance, | ||
int | t = 0 |
||
) | const |
searches a point in the list == point +/- distance
point | is in world coordinates. |
distance | is in mm. returns -1 if no point is found or the position in the list of the first match |
Definition at line 122 of file mitkPointSet.cpp.
References QuadProgPP::dist(), QuadProgPP::distance(), and QuadProgPP::t().
Referenced by mitk::PointSetInteractor::CanHandleEvent(), mitk::PointSelectorInteractor::CanHandleEvent(), mitk::PointInteractor::CanHandleEvent(), mitk::ConnectPointsInteractor::CanHandleEvent(), mitk::PointSetInteractor::ExecuteAction(), mitk::PointSelectorInteractor::ExecuteAction(), mitk::PointInteractor::ExecuteAction(), and mitk::ConnectPointsInteractor::ExecuteAction().
{ if ( t >= (int)m_PointSetSeries.size() ) { return -1; } // Out is the point which is checked to be the searched point PointType out; out.Fill( 0 ); PointType indexPoint; this->GetGeometry( t )->WorldToIndex(point, indexPoint); // Searching the first point in the Set, that is +- distance far away fro // the given point unsigned int i; PointsContainer::Iterator it, end; end = m_PointSetSeries[t]->GetPoints()->End(); int bestIndex = -1; distance = distance * distance; // To correct errors from converting index to world and world to index if (distance == 0.0) { distance = 0.000001; } ScalarType bestDist = distance; ScalarType dist, tmp; for ( it = m_PointSetSeries[t]->GetPoints()->Begin(), i = 0; it != end; ++it, ++i ) { bool ok = m_PointSetSeries[t]->GetPoints() ->GetElementIfIndexExists( it->Index(), &out ); if ( !ok ) { return -1; } else if ( indexPoint == out ) //if totally equal { return it->Index(); } //distance calculation tmp = out[0] - indexPoint[0]; dist = tmp * tmp; tmp = out[1] - indexPoint[1]; dist += tmp * tmp; tmp = out[2] - indexPoint[2]; dist += tmp * tmp; if ( dist < bestDist ) { bestIndex = it->Index(); bestDist = dist; } } return bestIndex; }
int mitk::PointSet::SearchSelectedPoint | ( | int | t = 0 ) |
const [virtual] |
searches a selected point and returns the id of that point. If no point is found, then -1 is returned
Definition at line 437 of file mitkPointSet.cpp.
References QuadProgPP::t().
Referenced by mitk::PointInteractor::ExecuteAction(), QmitkPointListView::OnPointSetSelectionChanged(), and mitkPointSetTestClass::TestSearchSelectedPoint().
{ if ( (unsigned int) t >= m_PointSetSeries.size() ) { return -1; } PointDataIterator it; for ( it = m_PointSetSeries[t]->GetPointData()->Begin(); it != m_PointSetSeries[t]->GetPointData()->End(); it++ ) { if ( it->Value().selected == true ) { return it->Index(); } } return -1; }
void mitk::PointSet::SetPoint | ( | PointIdentifier | id, |
PointType | point, | ||
int | t = 0 |
||
) |
Set the given point in world coordinate system into the itkPointSet.
Definition at line 228 of file mitkPointSet.cpp.
References mitk::PointSet::PointDataType::id, mitk::PointSet::PointDataType::pointSpec, mitk::PointSet::PointDataType::selected, and QuadProgPP::t().
Referenced by mitk::NavigationDataToPointSetFilter::GenerateDataMode3DMean(), mitk::NavigationDataToPointSetFilter::GenerateDataMode4D(), QmitkEditPointDialog::OnOkButtonClicked(), and mitkPointSetTestClass::TestInsertPointWithPointSpecification().
{ // Adapt the size of the data vector if necessary this->Expand( t+1 ); mitk::Point3D indexPoint; this->GetGeometry( t )->WorldToIndex( point, indexPoint ); m_PointSetSeries[t]->SetPoint( id, indexPoint ); PointDataType defaultPointData; defaultPointData.id = id; defaultPointData.selected = false; defaultPointData.pointSpec = mitk::PTUNDEFINED; m_PointSetSeries[t]->SetPointData( id, defaultPointData ); //boundingbox has to be computed anyway m_CalculateBoundingBox = true; this->Modified(); }
void mitk::PointSet::SetPoint | ( | PointIdentifier | id, |
PointType | point, | ||
PointSpecificationType | spec, | ||
int | t = 0 |
||
) |
Set the given point in world coordinate system with the given PointSpecificationType.
Definition at line 248 of file mitkPointSet.cpp.
References mitk::PointSet::PointDataType::id, mitk::PointSet::PointDataType::pointSpec, mitk::PointSet::PointDataType::selected, and QuadProgPP::t().
{ // Adapt the size of the data vector if necessary this->Expand( t+1 ); mitk::Point3D indexPoint; this->GetGeometry( t )->WorldToIndex( point, indexPoint ); m_PointSetSeries[t]->SetPoint( id, indexPoint ); PointDataType defaultPointData; defaultPointData.id = id; defaultPointData.selected = false; defaultPointData.pointSpec = spec; m_PointSetSeries[t]->SetPointData( id, defaultPointData ); //boundingbox has to be computed anyway m_CalculateBoundingBox = true; this->Modified(); }
void mitk::PointSet::SetRequestedRegion | ( | itk::DataObject * | data ) | [virtual] |
Set the requested region from this data object to match the requested region of the data object passed in as a parameter.
This method is implemented in the concrete subclasses of BaseData.
Implements mitk::BaseData.
Definition at line 719 of file mitkPointSet.cpp.
{ }
void mitk::PointSet::SetRequestedRegionToLargestPossibleRegion | ( | ) | [virtual] |
Set the RequestedRegion to the LargestPossibleRegion.
This forces a filter to produce all of the output in one execution (i.e. not streaming) on the next call to Update().
Implements mitk::BaseData.
Definition at line 705 of file mitkPointSet.cpp.
{ }
void mitk::PointSet::SetSelectInfo | ( | int | position, |
bool | selected, | ||
int | t = 0 |
||
) | [virtual] |
Definition at line 376 of file mitkPointSet.cpp.
References mitk::OpDESELECTPOINT, and mitk::OpSELECTPOINT.
Referenced by QmitkPointListView::OnListViewSelectionChanged(), and mitkPointSetTestClass::TestSetSelectInfo().
{ if ( this->IndexExists( position, t ) ) { // timeStep to ms ScalarType timeInMS = this->GetTimeSlicedGeometry()->TimeStepToMS( t ); // point Point3D point = this->GetPoint( position, t ); PointOperation* op; if (selected) { op = new mitk::PointOperation(OpSELECTPOINT, timeInMS, point, position ); } else { op = new mitk::PointOperation(OpDESELECTPOINT, timeInMS, point, position ); } this->ExecuteOperation( op ); } }
bool mitk::PointSet::SwapPointContents | ( | PointIdentifier | id1, |
PointIdentifier | id2, | ||
int | t = 0 |
||
) | [protected] |
swaps point coordinates and point data of the points with identifiers id1 and id2
Definition at line 755 of file mitkPointSet.cpp.
{ /* search and cache contents */ PointType p1; if (m_PointSetSeries[timeStep]->GetPoint(id1, &p1) == false) return false; PointDataType data1; if (m_PointSetSeries[timeStep]->GetPointData(id1, &data1) == false) return false; PointType p2; if (m_PointSetSeries[timeStep]->GetPoint(id2, &p2) == false) return false; PointDataType data2; if (m_PointSetSeries[timeStep]->GetPointData(id2, &data2) == false) return false; /* now swap contents */ m_PointSetSeries[timeStep]->SetPoint(id1, p2); m_PointSetSeries[timeStep]->SetPointData(id1, data2); m_PointSetSeries[timeStep]->SetPoint(id2, p1); m_PointSetSeries[timeStep]->SetPointData(id2, data1); return true; }
bool mitk::PointSet::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 point (moveUpwards=false). If upper or lower index does not exist false is returned, if swap was successful true.
Definition at line 319 of file mitkPointSet.cpp.
Referenced by mitkPointSetTestClass::TestSwapPointPositionDownwards(), mitkPointSetTestClass::TestSwapPointPositionUpwards(), and mitkPointSetTestClass::TestSwapPointPositionUpwardsNotPossible().
{ if(IndexExists(id, t) ) { PointType point = GetPoint(id,t); if(moveUpwards) {//up if(IndexExists(id-1,t)) { InsertPoint(id, GetPoint(id - 1, t), t); InsertPoint(id-1,point,t); this->Modified(); return true; } } else {//down if(IndexExists(id+1,t)) { InsertPoint(id, GetPoint(id + 1, t), t); InsertPoint(id+1,point,t); this->Modified(); return true; } } } return false; }
void mitk::PointSet::UpdateOutputInformation | ( | ) | [virtual] |
Update the information for this BaseData (the geometry in particular) so that it can be used as an output of a BaseProcess.
This method is used in the pipeline mechanism to propagate information and initialize the meta data associated with a BaseData. Any implementation of this method in a derived class is assumed to call its source's BaseProcess::UpdateOutputInformation() which determines modified times, LargestPossibleRegions, and any extra meta data like spacing, origin, etc. Default implementation simply call's it's source's UpdateOutputInformation().
Reimplemented from mitk::BaseData.
Definition at line 648 of file mitkPointSet.cpp.
References mitk::TimeSlicedGeometry::GetTimeSteps().
{ if ( this->GetSource( ) ) { this->GetSource( )->UpdateOutputInformation( ); } // // first make sure, that the associated time sliced geometry has // the same number of geometry 3d's as PointSets are present // mitk::TimeSlicedGeometry* timeGeometry = GetTimeSlicedGeometry(); if ( timeGeometry->GetTimeSteps() != m_PointSetSeries.size() ) { itkExceptionMacro(<<"timeGeometry->GetTimeSteps() != m_PointSetSeries.size() -- use Initialize(timeSteps) with correct number of timeSteps!"); } // This is needed to detect zero objects mitk::ScalarType nullpoint[]={0,0,0,0,0,0}; BoundingBox::BoundsArrayType itkBoundsNull(nullpoint); // // Iterate over the PointSets and update the Geometry // information of each of the items. // if (m_CalculateBoundingBox) { for ( unsigned int i = 0 ; i < m_PointSetSeries.size() ; ++i ) { const DataType::BoundingBoxType *bb = m_PointSetSeries[i]->GetBoundingBox(); BoundingBox::BoundsArrayType itkBounds = bb->GetBounds(); if ( m_PointSetSeries[i].IsNull() || (m_PointSetSeries[i]->GetNumberOfPoints() == 0) || (itkBounds == itkBoundsNull) ) { itkBounds = itkBoundsNull; continue; } // Ensure minimal bounds of 1.0 in each dimension for ( unsigned int j = 0; j < 3; ++j ) { if ( itkBounds[j*2+1] - itkBounds[j*2] < 1.0 ) { BoundingBox::CoordRepType center = (itkBounds[j*2] + itkBounds[j*2+1]) / 2.0; itkBounds[j*2] = center - 0.5; itkBounds[j*2+1] = center + 0.5; } } this->GetGeometry(i)->SetBounds(itkBounds); } m_CalculateBoundingBox = false; } this->GetTimeSlicedGeometry()->UpdateInformation(); }
bool mitk::PointSet::VerifyRequestedRegion | ( | ) | [virtual] |
Verify that the RequestedRegion is within the LargestPossibleRegion.
If the RequestedRegion is not within the LargestPossibleRegion, then the filter cannot possibly satisfy the request. This method returns true if the request can be satisfied (even if it will be necessary to process the entire LargestPossibleRegion) and returns false otherwise. This method is used by PropagateRequestedRegion(). PropagateRequestedRegion() throws a InvalidRequestedRegionError exception if the requested region is not within the LargestPossibleRegion.
Implements mitk::BaseData.
Definition at line 714 of file mitkPointSet.cpp.
{ return true; }
bool mitk::PointSet::m_CalculateBoundingBox [protected] |
flag to indicate the right time to call SetBounds
Definition at line 260 of file mitkPointSet.h.
PointSetSeries mitk::PointSet::m_PointSetSeries [protected] |
Definition at line 255 of file mitkPointSet.h.
const unsigned int mitk::PointSet::MaxTopologicalDimension = 3 [static] |
Definition at line 94 of file mitkPointSet.h.
const unsigned int mitk::PointSet::PointDimension = 3 [static] |
Definition at line 93 of file mitkPointSet.h.