template<typename TOutputMesh>
class itk::AutomaticTopologyMeshSource< TOutputMesh >
Convenience class for generating meshes.
This generates an N-dimensional mesh consisting of some combination of vertices, line segments, triangles, quadrilaterals, tetrahedra, and hexahedra. Identifiers for the cells are automatically added, and topological connectivity is automatically computed. When a cell is added, all of its boundary features are determined and added as well.
The main methods are of the form AddThing, where Thing can be Point, Vertex, Triangle, Quadrilateral, Tetrahedron, or Hexahedron. Each of these methods has several overloaded forms, permitting multiple ways to specify the object being added. When called, each of these methods first checks to see if the object has already been added. If it has not, then a new identifier is generated (the smallest one so far unused), the object is added with that identifier, and the ID is returned. If the object has already been added, then the ID it already has is returned and nothing else is done.
When a cell is added, all of its boundary elements are also added, and boundary assignments are set. A cell can be specified using IDs of points already added, or using Point objects that may or may not already be in the mesh. If a cell is specified using Point objects, then the points are added to the mesh if necessary.
The different ways of specifying a cell are
- An IdentifierArrayType (= itk::Array<IdentifierType>) of point identifiers. These point identifiers are the ones returned by calls to AddPoint().
- A parameter list of point identifiers (for instance,
this->AddLine(0, 1)
, if 0 and 1 are point identifiers).
- A parameter list of itk::Point objects (the function then generates the identifiers).
- A parameter list of C-style arrays, with each such array giving the coordinates of one point. This form is useful for copying in geometry from foreign data structures.
For meshes generated using this filter, only one cell can be added for any given set of vertices. If a, b, c, and d are identifiers for four points in R^3, then (a, b, c, d) and (a, c, d, b) determine two different quadrilaterals (at least one of which is either degenerate or nonplanar). If you call
then only the first quadrilateral will actually be added.
To add the topological information to an already constructed mesh (for efficiency of traversal), use this class to generate a copy of the original mesh.
Example: The following code generates a mesh consisting of two triangles sharing an edge.
meshSource->AddTriangle(
meshSource->AddPoint(0, 0, 0),
meshSource->AddPoint(1, 0, 0),
meshSource->AddPoint(0, 1, 0) );
meshSource->AddTriangle(
meshSource->AddPoint(0, 0, 0),
meshSource->AddPoint(1, 0, 0),
meshSource->AddPoint(0, 0, 1) );
This class inherits from itk::MeshSource so it fits conveniently into a pipeline, but GetOutput() is always valid after every Add[Something]() call, and Update() is a no-op. It is not thread safe.
- Examples
- Examples/DataRepresentation/Mesh/AutomaticMesh.cxx.
Definition at line 111 of file itkAutomaticTopologyMeshSource.h.
|
IdentifierType | AddHexahedron (const CoordinateType *p0, const CoordinateType *p1, const CoordinateType *p2, const CoordinateType *p3, const CoordinateType *p4, const CoordinateType *p5, const CoordinateType *p6, const CoordinateType *p7) |
|
IdentifierType | AddHexahedron (const IdentifierArrayType &pointIDs) |
|
IdentifierType | AddHexahedron (const PointType &p0, const PointType &p1, const PointType &p2, const PointType &p3, const PointType &p4, const PointType &p5, const PointType &p6, const PointType &p7) |
|
IdentifierType | AddHexahedron (IdentifierType pointId0, IdentifierType pointId1, IdentifierType pointId2, IdentifierType pointId3, IdentifierType pointId4, IdentifierType pointId5, IdentifierType pointId6, IdentifierType pointId7) |
|
IdentifierType | AddLine (const CoordinateType *p0, const CoordinateType *p1) |
|
IdentifierType | AddLine (const IdentifierArrayType &pointIDs) |
|
IdentifierType | AddLine (const PointType &p0, const PointType &p1) |
|
IdentifierType | AddLine (IdentifierType pointId0, IdentifierType pointId1) |
|
IdentifierType | AddPoint (const CoordinateType *p0) |
|
IdentifierType | AddPoint (const PointType &p0) |
|
IdentifierType | AddPoint (CoordinateType x0=0, CoordinateType x1=0, CoordinateType x2=0, CoordinateType x3=0, CoordinateType x4=0, CoordinateType x5=0) |
|
IdentifierType | AddQuadrilateral (const CoordinateType *p0, const CoordinateType *p1, const CoordinateType *p2, const CoordinateType *p3) |
|
IdentifierType | AddQuadrilateral (const IdentifierArrayType &pointIDs) |
|
IdentifierType | AddQuadrilateral (const PointType &p0, const PointType &p1, const PointType &p2, const PointType &p3) |
|
IdentifierType | AddQuadrilateral (IdentifierType pointId0, IdentifierType pointId1, IdentifierType pointId2, IdentifierType pointId3) |
|
IdentifierType | AddTetrahedron (const CoordinateType *p0, const CoordinateType *p1, const CoordinateType *p2, const CoordinateType *p3) |
|
IdentifierType | AddTetrahedron (const IdentifierArrayType &pointIDs) |
|
IdentifierType | AddTetrahedron (const PointType &p0, const PointType &p1, const PointType &p2, const PointType &p3) |
|
IdentifierType | AddTetrahedron (IdentifierType pointId0, IdentifierType pointId1, IdentifierType pointId2, IdentifierType pointId3) |
|
IdentifierType | AddTriangle (const CoordinateType *p0, const CoordinateType *p1, const CoordinateType *p2) |
|
IdentifierType | AddTriangle (const IdentifierArrayType &pointIDs) |
|
IdentifierType | AddTriangle (const PointType &p0, const PointType &p1, const PointType &p2) |
|
IdentifierType | AddTriangle (IdentifierType pointId0, IdentifierType pointId1, IdentifierType pointId2) |
|
IdentifierType | AddVertex (const CoordinateType *p0) |
|
IdentifierType | AddVertex (const IdentifierArrayType &pointIDs) |
|
IdentifierType | AddVertex (const PointType &p0) |
|
IdentifierType | AddVertex (IdentifierType pointId0) |
|
const char * | GetNameOfClass () const override |
|
const char * | GetNameOfClass () const override |
|
OutputMeshType * | GetOutput () |
|
OutputMeshType * | GetOutput (unsigned int idx) |
|
virtual void | GraftNthOutput (unsigned int idx, DataObject *graft) |
|
virtual void | GraftOutput (const DataObjectIdentifierType &key, DataObject *graft) |
|
virtual void | GraftOutput (DataObject *graft) |
|
void | SetOutput (TOutputMesh *output) |
|
DataObjectPointer | MakeOutput (DataObjectPointerArraySizeType idx) override |
|
virtual void | AbortGenerateDataOn () |
|
virtual void | EnlargeOutputRequestedRegion (DataObject *) |
|
virtual const bool & | GetAbortGenerateData () const |
|
DataObjectPointerArray | GetIndexedInputs () |
|
DataObjectPointerArray | GetIndexedOutputs () |
|
NameArray | GetInputNames () const |
|
DataObjectPointerArray | GetInputs () |
|
MultiThreaderType * | GetMultiThreader () const |
|
DataObjectPointerArraySizeType | GetNumberOfIndexedInputs () const |
|
DataObjectPointerArraySizeType | GetNumberOfIndexedOutputs () const |
|
DataObjectPointerArraySizeType | GetNumberOfInputs () const |
|
DataObjectPointerArraySizeType | GetNumberOfOutputs () const |
|
virtual DataObjectPointerArraySizeType | GetNumberOfValidRequiredInputs () const |
|
NameArray | GetOutputNames () const |
|
DataObjectPointerArray | GetOutputs () |
|
virtual float | GetProgress () const |
|
NameArray | GetRequiredInputNames () const |
|
bool | HasInput (const DataObjectIdentifierType &key) const |
|
bool | HasOutput (const DataObjectIdentifierType &key) const |
|
void | IncrementProgress (float increment) |
|
virtual DataObjectPointer | MakeOutput (const DataObjectIdentifierType &) |
|
virtual void | PrepareOutputs () |
|
virtual void | PropagateRequestedRegion (DataObject *output) |
|
virtual void | ResetPipeline () |
|
virtual void | SetAbortGenerateData (bool _arg) |
|
void | SetMultiThreader (MultiThreaderType *threader) |
|
virtual void | Update () |
|
virtual void | UpdateLargestPossibleRegion () |
|
virtual void | UpdateOutputData (DataObject *output) |
|
virtual void | UpdateOutputInformation () |
|
void | UpdateProgress (float progress) |
|
virtual void | SetReleaseDataFlag (bool val) |
|
virtual bool | GetReleaseDataFlag () const |
|
void | ReleaseDataFlagOn () |
|
void | ReleaseDataFlagOff () |
|
virtual void | SetReleaseDataBeforeUpdateFlag (bool _arg) |
|
virtual const bool & | GetReleaseDataBeforeUpdateFlag () const |
|
virtual void | ReleaseDataBeforeUpdateFlagOn () |
|
virtual void | SetNumberOfWorkUnits (ThreadIdType _arg) |
|
virtual const ThreadIdType & | GetNumberOfWorkUnits () const |
|
unsigned long | AddObserver (const EventObject &event, Command *cmd) const |
|
unsigned long | AddObserver (const EventObject &event, std::function< void(const EventObject &)> function) const |
|
LightObject::Pointer | CreateAnother () const override |
|
virtual void | DebugOff () const |
|
virtual void | DebugOn () const |
|
Command * | GetCommand (unsigned long tag) |
|
bool | GetDebug () const |
|
MetaDataDictionary & | GetMetaDataDictionary () |
|
const MetaDataDictionary & | GetMetaDataDictionary () const |
|
virtual ModifiedTimeType | GetMTime () const |
|
virtual const TimeStamp & | GetTimeStamp () const |
|
bool | HasObserver (const EventObject &event) const |
|
void | InvokeEvent (const EventObject &) |
|
void | InvokeEvent (const EventObject &) const |
|
virtual void | Modified () const |
|
void | Register () const override |
|
void | RemoveAllObservers () |
|
void | RemoveObserver (unsigned long tag) const |
|
void | SetDebug (bool debugFlag) const |
|
void | SetReferenceCount (int) override |
|
void | UnRegister () const noexcept override |
|
void | SetMetaDataDictionary (const MetaDataDictionary &rhs) |
|
void | SetMetaDataDictionary (MetaDataDictionary &&rrhs) |
|
virtual void | SetObjectName (std::string _arg) |
|
virtual const std::string & | GetObjectName () const |
|
Pointer | Clone () const |
|
virtual void | Delete () |
|
virtual int | GetReferenceCount () const |
|
void | Print (std::ostream &os, Indent indent=0) const |
|
|
| AutomaticTopologyMeshSource () |
|
void | GenerateData () override |
|
| ~AutomaticTopologyMeshSource () override=default |
|
void | GenerateInputRequestedRegion () override |
|
| MeshSource () |
|
void | PrintSelf (std::ostream &os, Indent indent) const override |
|
| ~MeshSource () override=default |
|
virtual void | AddInput (DataObject *input) |
|
void | AddOptionalInputName (const DataObjectIdentifierType &) |
|
void | AddOptionalInputName (const DataObjectIdentifierType &, DataObjectPointerArraySizeType idx) |
|
virtual void | AddOutput (DataObject *output) |
|
bool | AddRequiredInputName (const DataObjectIdentifierType &) |
|
bool | AddRequiredInputName (const DataObjectIdentifierType &, DataObjectPointerArraySizeType idx) |
|
virtual void | CacheInputReleaseDataFlags () |
|
virtual void | GenerateOutputInformation () |
|
virtual void | GenerateOutputRequestedRegion (DataObject *output) |
|
DataObject * | GetInput (const DataObjectIdentifierType &key) |
|
const DataObject * | GetInput (const DataObjectIdentifierType &key) const |
|
virtual const DataObjectPointerArraySizeType & | GetNumberOfRequiredInputs () const |
|
virtual const DataObjectPointerArraySizeType & | GetNumberOfRequiredOutputs () const |
|
bool | IsIndexedInputName (const DataObjectIdentifierType &) const |
|
bool | IsIndexedOutputName (const DataObjectIdentifierType &) const |
|
bool | IsRequiredInputName (const DataObjectIdentifierType &) const |
|
DataObjectPointerArraySizeType | MakeIndexFromInputName (const DataObjectIdentifierType &name) const |
|
DataObjectPointerArraySizeType | MakeIndexFromOutputName (const DataObjectIdentifierType &name) const |
|
DataObjectIdentifierType | MakeNameFromInputIndex (DataObjectPointerArraySizeType idx) const |
|
DataObjectIdentifierType | MakeNameFromOutputIndex (DataObjectPointerArraySizeType idx) const |
|
virtual void | PopBackInput () |
|
virtual void | PopFrontInput () |
|
| ProcessObject () |
|
virtual void | PropagateResetPipeline () |
|
virtual void | PushBackInput (const DataObject *input) |
|
virtual void | PushFrontInput (const DataObject *input) |
|
virtual void | ReleaseInputs () |
|
virtual void | RemoveInput (const DataObjectIdentifierType &key) |
|
virtual void | RemoveInput (DataObjectPointerArraySizeType) |
|
virtual void | RemoveOutput (const DataObjectIdentifierType &key) |
|
virtual void | RemoveOutput (DataObjectPointerArraySizeType idx) |
|
bool | RemoveRequiredInputName (const DataObjectIdentifierType &) |
|
virtual void | RestoreInputReleaseDataFlags () |
|
virtual void | SetInput (const DataObjectIdentifierType &key, DataObject *input) |
|
virtual void | SetNthInput (DataObjectPointerArraySizeType idx, DataObject *input) |
|
virtual void | SetNthOutput (DataObjectPointerArraySizeType idx, DataObject *output) |
|
void | SetNumberOfIndexedInputs (DataObjectPointerArraySizeType num) |
|
void | SetNumberOfIndexedOutputs (DataObjectPointerArraySizeType num) |
|
virtual void | SetNumberOfRequiredInputs (DataObjectPointerArraySizeType) |
|
virtual void | SetNumberOfRequiredOutputs (DataObjectPointerArraySizeType _arg) |
|
virtual void | SetOutput (const DataObjectIdentifierType &name, DataObject *output) |
|
virtual void | SetPrimaryInput (DataObject *object) |
|
virtual void | SetPrimaryOutput (DataObject *object) |
|
void | SetRequiredInputNames (const NameArray &) |
|
virtual void | VerifyInputInformation () const |
|
virtual void | VerifyPreconditions () const |
|
| ~ProcessObject () override |
|
DataObject * | GetInput (DataObjectPointerArraySizeType idx) |
|
const DataObject * | GetInput (DataObjectPointerArraySizeType idx) const |
|
DataObject * | GetPrimaryInput () |
|
const DataObject * | GetPrimaryInput () const |
|
virtual void | SetPrimaryInputName (const DataObjectIdentifierType &key) |
|
virtual const char * | GetPrimaryInputName () const |
|
DataObject * | GetOutput (const DataObjectIdentifierType &key) |
|
const DataObject * | GetOutput (const DataObjectIdentifierType &key) const |
|
virtual void | SetPrimaryOutputName (const DataObjectIdentifierType &key) |
|
virtual const char * | GetPrimaryOutputName () const |
|
DataObject * | GetOutput (DataObjectPointerArraySizeType i) |
|
const DataObject * | GetOutput (DataObjectPointerArraySizeType i) const |
|
DataObject * | GetPrimaryOutput () |
|
const DataObject * | GetPrimaryOutput () const |
|
virtual bool | GetThreaderUpdateProgress () const |
|
virtual void | ThreaderUpdateProgressOn () |
|
virtual void | SetThreaderUpdateProgress (bool arg) |
|
| Object () |
|
bool | PrintObservers (std::ostream &os, Indent indent) const |
|
virtual void | SetTimeStamp (const TimeStamp &timeStamp) |
|
| ~Object () override |
|
virtual LightObject::Pointer | InternalClone () const |
|
| LightObject () |
|
virtual void | PrintHeader (std::ostream &os, Indent indent) const |
|
virtual void | PrintTrailer (std::ostream &os, Indent indent) const |
|
virtual | ~LightObject () |
|
template<typename TOutputMesh >
Add the hexahedron specified by the four points, and return its ID. If the points are p0, p1, p2, and p3, then the following additional cells (represented here as ordered tuples) are created (if they don't already exist) and associated as boundaries, in the order given:
Vertices: (p0), (p1), (p2), (p3), (p4), (p5), (p6), (p7).
Lines: (p0, p1), (p2, p3), (p4, p5), (p6, p7), (p0, p2), (p1, p3), (p4, p6), (p5, p7), (p0, p4), (p1, p5), (p2, p6), (p3, p7).
Quadrilaterals: (0, 1, 2, 3), (4, 5, 6, 7), (0, 1, 4, 5), (2, 3, 6, 7), (0, 2, 4, 6), (1, 3, 5, 7),
In particular, if the points are connected topologically as follows
p4------------p5
| \ / |
| p0------p1 |
| | | |
| | | |
| p2------p3 |
| / \ |
p6------------p7
then you would call, for instance, meshSource->AddQuadrilateral(p0, p1, p2, p3, p4, p5, p6, p7)
.
template<typename TOutputMesh >
Add the tetrahedron specified by the three points, and return its ID. If the points are p0, p1, and p2, then the following additional cells (represented here as ordered tuples) are created (if they don't already exist) and associated as boundaries, in the order given:
Vertices: (p0), (p1), (p2), (p3).
Lines: (p0, p1), (p0, p2), (p0, p3), (p1, p2), (p1, p3), (p2, p3).
Triangles: (p0, p1, p2), (p0, p1, p3), (p0, p2, p3), (p1, p2, * p3).