Migration guide from CamiTK 5.2 to CamiTK 6.0
The complete guide to migrate your source code from CamiTK 5.2 to CamiTK 6.0
Frames and geometrical Transformations
If your extension manages frames of components and geometrical transformations between them, you will need to port your code to the new framework.
Here is a short preview:
- Previously, components had a
Component::get/setParentFrame()and a transformation to it that you could set usingComponent::setTransform()and other helper functions. - Now Frames and Transformations are managed by the
TransformationManager(see API), so that multiple components can use the same frame. - When you load or create a MeshComponent, a new Frame is created for it.
- When you load an ImageComponent, it comes with three frames: the Data Frame (were the voxels are defined), the main Frame (which is usually the coordinates system of the imaging machine, e.g. CT scanner) and an arbitrary frame to manage the position and orientation of the arbitrary slice that CamiTK can display.
- Ownership: you need to be careful about the ownership of Frames and Transformations: When you use frames and transformation to process coordinates, you do not need to own the Frames and Transformations. This is why
Component::getFrame(),ImageComponent::getDataFrame()return raw, non owning pointer. - If you really need ownership of a Frame, usually because you want to set the Frame of a new Component, you can either use
myNewMesh->setFrameFrom(myOldMesh), or the more explicitmyNewMesh->setFrame( TransformationManager::getFrameOwnership(myOldMesh->getFrame()) ) - If your extension creates a new Component, please set its Frame in a logical way: if the data is expressed in the same Frame as the input component, just set the Frame of your output component to the Frame of the input Component
- If you know the transformation between two Components, you can add a Transformation between their Frames using
TransformationManager::addTransformation
New extensions
You should use DevStudio to create new extensions instead of the wizard. The code will be simpler, and Python extensions are supported as well.
Old extensions created using the Wizard will still compile and work (if you fix the deprecated methods below).
Removed methods
Since CamiTK 5.2
Here is a list of methods that were deprecated in the previous version (5.2) and removed in 6.0:
- All the methods that were based on the previous component frame system are now removed (see above)
camitk::Action::setComponent()andcamitk::Action::setComponent()were renamed to the much more explicitsetComponentClassName()because these methods set the name of the Component class accepted by the Action and the Viewer.getComponent()was also renamedgetComponentClassName.MainWindow::removeViewerwas removed because now Viewers are hidden, not removed, and allowing destroying Viewers may have caused crashes.MainWindow::showViewerwas renamedMainWindow::showDockViewerComponent::setVisibility(Viewer*, bool)was removed, you should useComponent::setVisibility(QString viewerName, bool)Component::getVisibility(Viewer*)should be replaced byComponent::getVisibility(QString viewerName)Component::refreshInterfaceNode()was removed because the refresh is automatic now.SingleImageComponent::get/setViewSliceIn3D()was removed,get/setVisibility()fromComponenthas the same effect.RendererWidget::actorTransformwas removed because it may interfere with the new Frame and Transformation system.MedicalImageViewer::setToolbarAutoVisibilitywas removed. UseMedicalImageViewer::setToolbarVisibility- CamiTK 6.0 uses Qt 5.15 or Qt6. Some older Qt code may be deprecated in your extension, such as
QMouseEvent::globalPos()which should be replaced byQMouseEvent::globalPosition().toPoint()in Qt6, orqtAsConstwhich should be replaced bystd::as_const.