Computer Assisted Medical Intervention Tool Kit  version 6.0
Loading...
Searching...
No Matches
/build/camitk-9Ht7pk/camitk-6.0.0/sdk/libraries/core/TransformationManager.h

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

/*****************************************************************************
* $CAMITK_LICENCE_BEGIN$
*
* CamiTK - Computer Assisted Medical Intervention ToolKit
* (c) 2001-2025 Univ. Grenoble Alpes, CNRS, Grenoble INP - UGA, TIMC, 38000 Grenoble, France
*
* Visit http://camitk.imag.fr for more information
*
* This file is part of CamiTK.
*
* CamiTK is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License version 3
* only, as published by the Free Software Foundation.
*
* CamiTK is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License version 3 for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* version 3 along with CamiTK. If not, see <http://www.gnu.org/licenses/>.
*
* $CAMITK_LICENCE_END$
****************************************************************************/
#ifndef TRANSFORMATIONMANAGER_H
#define TRANSFORMATIONMANAGER_H
// -- Core stuff
#include "CamiTKAPI.h"
#include "Transformation.h"
// -- QT stuff
#include <QHash>
#include <QString>
#include <QVector>
#include <QPalette>
#include <QVariant>
#include <vtkSmartPointer.h>
#include <vtkTransform.h>
#include <memory>
#include <unordered_set>
namespace camitk {
class Transformation;
class FrameOfReference;
class Application;
class CAMITK_API TransformationManager {
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 // TRANSFORMATIONMANAGER_H
#define CAMITK_API
Definition CamiTKAPI.h:66
const char * description
Definition applications/cepgenerator/main.cpp:38
Definition Action.cpp:40