List of default Identity Transformations : these can be removed if another transform is added later and completes the desired paths.
List of default Identity Transformations : these can be removed if another transform is added later and completes the desired paths Two components C1 and C2 are loaded, create Frame1 and Frame2. C1 is added to a 3D Viewer, which has the FrameOfReference WorldFrame A default identity transformation is added to link Frame1 to WorldFrame, because we need to set Actor1 in the viewer's frame, and there is no known Transformation from Frame1 to WorldFrame. We also add C2 to the 3D Viewer. The problem is identical, a default identity transformation is added from Frame2 to WorldFrame. Now C1 and C2 are registered, and a new Transformation Tr2_1(Frame2, Frame1) must be added. But there is already a path Frame1 --> WorldFrame <– Frame2 linking both Frames. Because the current path contains default identity transformations, these can be deleted, so that the new Frame2 --> Frame1 transformation can be added. When the Viewer updates its content, it will try to find Frame1--> WorldFrame, which was removed, and will create a default identity transformation again. When trying to show C2, it will find the Transformation Frame2 --> Frame1 --> WorldFrame
#ifndef TRANSFORMATIONMANAGER_H
#define TRANSFORMATIONMANAGER_H
#include <QHash>
#include <QString>
#include <QVector>
#include <QPalette>
#include <QVariant>
#include <vtkSmartPointer.h>
#include <vtkTransform.h>
#include <memory>
#include <unordered_set>
class Transformation;
class FrameOfReference;
class Application;
public:
static QString toString();
static std::shared_ptr<FrameOfReference> getFrameOfReferenceOwnership(const QUuid& uuid);
static std::shared_ptr<FrameOfReference> getFrameOfReferenceOwnership(const FrameOfReference*);
static std::shared_ptr<FrameOfReference> addFrameOfReference(QString name, QString
description =
"");
static std::shared_ptr<FrameOfReference> addFrameOfReference(const FrameOfReference&);
static QVector<FrameOfReference*> getFramesOfReference();
static bool hasPath(const FrameOfReference* from, const FrameOfReference* to);
static bool isDefaultIdentityToWorld(const Transformation*);
static Transformation* getTransformation(const FrameOfReference* from, const FrameOfReference* to);
static std::shared_ptr<Transformation> getTransformationOwnership(const Transformation*);
static std::shared_ptr<Transformation> getTransformationOwnership(const QUuid& uuid);
static std::shared_ptr<Transformation> getTransformationOwnership(const FrameOfReference* from, const FrameOfReference* to);
static void ensurePathToWorld(const FrameOfReference* frame);
static bool preferredDefaultIdentityToWorldLink(const FrameOfReference* frame);
static const FrameOfReference* getWorldFrame();
static QVector<Transformation*> getDirectTransformations();
static QVector<Transformation*> getTransformations();
static std::shared_ptr<Transformation> addTransformation(const QVariant&);
static std::shared_ptr<Transformation> addTransformation(const FrameOfReference* from, const FrameOfReference* to);
static std::shared_ptr<Transformation> addTransformation(const std::shared_ptr<FrameOfReference>& from, const std::shared_ptr<FrameOfReference>& to);
static std::shared_ptr<Transformation> addTransformation(const FrameOfReference* from, const FrameOfReference* to, vtkSmartPointer<vtkTransform> vtkTr);
static std::shared_ptr<Transformation> addTransformation(const std::shared_ptr<FrameOfReference>& from, const std::shared_ptr<FrameOfReference>& to, vtkSmartPointer<vtkTransform> vtkTr);
static std::shared_ptr<Transformation> addTransformation(const FrameOfReference* from, const FrameOfReference* to, const vtkMatrix4x4* matrix);
static std::shared_ptr<Transformation> addTransformation(const std::shared_ptr<FrameOfReference>& from, const std::shared_ptr<FrameOfReference>& to, const vtkMatrix4x4* matrix);
static void cleanupFramesAndTransformations();
static bool removeTransformation(std::shared_ptr<Transformation>& tr);
static bool removeTransformation(const FrameOfReference* from, const FrameOfReference* to);
static bool updateTransformation(const FrameOfReference* from, const FrameOfReference* to, vtkSmartPointer<vtkTransform> vtkTr);
static bool updateTransformation(const FrameOfReference* from, const FrameOfReference* to, vtkMatrix4x4* matrix);
static bool updateTransformation(Transformation* tr, vtkSmartPointer<vtkTransform> vtkTr);
static bool updateTransformation(Transformation* tr, vtkMatrix4x4* matrix);
static bool hasSources(const Transformation*);
static QVector<Transformation*> getSources(const Transformation*);
static bool isInverseTransformation(const Transformation*);
static Transformation* getInverseTransformation(const Transformation* tr);
static bool isCompositeTransformation(const Transformation* tr);
static QVariant toVariant();
static void fromVariant(const QVariant&);
private:
static std::shared_ptr<FrameOfReference> worldFrame;
static std::vector<std::shared_ptr<FrameOfReference>> frames;
static std::vector<std::shared_ptr<Transformation>> transformations;
static QHash<QUuid, FrameOfReference*> frameMap;
static QHash<QUuid, Transformation*> transformationMap;
static QHash<const Transformation*, QVector<std::shared_ptr<Transformation>>> transformationSources;
static QHash<const FrameOfReference*, QHash<const FrameOfReference*, Transformation*>> transformationFromTo;
static std::unordered_set<const Transformation*> defaultIdentityToWorldTransformations;
static std::shared_ptr<Transformation> registerTransformation(Transformation* tr, const QVector<std::shared_ptr<Transformation>>& sources = {});
static QVector<std::shared_ptr<Transformation>> getPath(const FrameOfReference* from, const FrameOfReference* to);
static std::shared_ptr<Transformation> addCompositeTransformation(QVector<std::shared_ptr<Transformation>> transforms);
static std::shared_ptr<FrameOfReference> addFrameOfReference(QUuid uuid, QString name, QString
description,
int dimensions = 3,
const AnatomicalOrientation& ao = {}, std::vector<Unit> units = {
"",
"",
"",
"",
""});
static std::shared_ptr<FrameOfReference> addFrameOfReference(const QVariant&);
static bool removeDefaultPaths(const FrameOfReference* from, const FrameOfReference* to);
static void removeTransformationFromInternalStructures(const Transformation* trToDelete);
static void cleanupCompositeTransformations();
static std::shared_ptr<Transformation> getTransformationSharedPtr(const Transformation*);
};
}
#endif
#define CAMITK_API
Definition CamiTKAPI.h:66
const char * description
Definition applications/cepgenerator/main.cpp:38