CamiTK Community Edition issueshttps://gricad-gitlab.univ-grenoble-alpes.fr/CamiTK/CamiTK/-/issues2024-02-23T11:20:59+01:00https://gricad-gitlab.univ-grenoble-alpes.fr/CamiTK/CamiTK/-/issues/180Simplify CamiTKVersion.h management2024-02-23T11:20:59+01:00Emmanuel PromayonSimplify CamiTKVersion.h management| | |
|--|--|
| **As a** | CamiTK developer and packager |
| **I would like to** | simplify the release and packaging process |
| **So that** | it would be easier to publish and package a new version |
| **Epic/Topics** | release managem...| | |
|--|--|
| **As a** | CamiTK developer and packager |
| **I would like to** | simplify the release and packaging process |
| **So that** | it would be easier to publish and package a new version |
| **Epic/Topics** | release management |
## Description / Overview
This point for this issue is:
- gather explanation about/rationale behind the existence of `CamiTKVersion.h` and `CamiTKVersion.h.in` file
- explain some consequence of the existence of this file
- work on how it can be simplified
## Hints
`CamiTKVersion.h` contains static information about the version number, debug postfix and `libDir`.
This file generates some complicated maneuvers during release management and packaging (see below).
### Some background on plugins
- CamiTK has a core library and uses plugins to add I/O (components), processing (actions) and viewer functionalities
- the plugins are made available using .so stored in "camitk repository", a directory that has a specific structure with subdirectories to sort plugins depending on their nature (actions, components, viewers)
- at run time, the core library looks into different paths for locating the existing camitk repositories (working directory, user installed, locally installed, or globally installed) in order to dynamically load all the available plugins.
- The libDir variable is used to check the camitk repository paths, that should all be ending with "some/path/" + libDir + "/camitk-x.y" (where x.y are major.minor camitk version numbers).
- The CamiTKVersion.h header file is used to specify this statically.
- On the upstream develop branch, libDir is generated at configure time by CMake, using the CMAKE_INSTALL_LIBDIR variable which is either set to "lib/ARCH" (if CMAKE_INSTALL_PATH is set to "/usr") or to just "lib/" (if CMAKE_INSTALL_PATH is empty).
- on the upstream master branch (the stable version, used to generate the tar ball), this is fixed to "lib". **TODO: describe rationale behind this**
### Generated burden
It might not be the best way to proceed, it is a bit complicated... That's what we came up with at the time (pre 2011) to answer to the following support constraints :
- multiple os,
- multiple camitk repositories,
- and multiple build situation (inbuild, sdk, install, cep dev)
It looks more like technical debt and could probably be simplified as it impact
- the release management process
- the packaging process (s.g. during 5.2 release `CamiTKVersion.h` was different on debian salsa master and in the upstream tarball), see also d/r and the line that uses `sed` to correct the file on debian...
### Note on `libDir` introduction in CamiTK version
`libDir` in CamiTKVersion was introduced #109 and #117 (commit de1794622009c4edd6cf4220773b61dbd644c37e) in order to support gentoo, and was later modified to take into account more situations:
- lib (default)
- lib64 (used on some Linux/platform)
- lib/<multiarch-tuple> (on Debian)
### Fixing this issue
Fixing this issue can be done either by
- option 1: confirming that a static `CamiTKVersion.h` (part of all of it) is required in `master`
- option 2: removing `CamiTKVersion.h` in master and generated release version tarball
## Acceptance tests
- [ ] option 1: better documentation to explain why a static `CamiTKVersion.h` is required
- [ ] option 2: a branch fixing this issue is merged (therefore CI passed)
- [ ] option 2: successful debian packaging process test
## Track
## Misc
- Automatic subscription of issue creator:https://gricad-gitlab.univ-grenoble-alpes.fr/CamiTK/CamiTK/-/issues/169add dbus connection2023-10-29T13:49:12+01:00Emmanuel Promayonadd dbus connection## About you
CamiTK dev
## Product
CamiTK Core / Application
## Overview
Issue #168 was not detected during configure/make/test as it is not possible to set a test where an application that starts a user interaction loop would be ru...## About you
CamiTK dev
## Product
CamiTK Core / Application
## Overview
Issue #168 was not detected during configure/make/test as it is not possible to set a test where an application that starts a user interaction loop would be run and stopped automatically after a while. For example, in the case of `camitk-fancy` that would have allowed for a simple start and exit. In the presence of a bug similar to #168, the test would then have failed.
A possible way of offering extended testing for application would be to add the possibility for any CamiTK application to listen to dbus messages.
- it would then be possible to send message from outside the application (e.g. a shell, a test script or program...) such as "run action `Quit`".
- it would also add the **great** advantage of opening a whole lot of testing and automation. For instance by sending message analog to state in the action state machine (e.g. by sending XML/json message containing the action to apply and its parameter).
## Relevant logs and/or screenshots
### Adding dbus message support in CamiTK::Application
For instance by using:
```cpp
QDBusConnection::sessionBus().connect(QString(), QString(), "camitk.action", "apply", this, SLOT(applyActionFromDBus(QString)));
...
void Application::applyActionFromDBus(const QString &message) {
if(message=="...") {
...
}
}
```
### From the test application
```cpp
QProcess myProcess;
myProcess.start("camitk-fancy", "");
if (!myProcess.waitForStarted())
return false;
QDBusMessage msg = QDBusMessage::createSignal("/", "camitk.action", "apply");
message="Quit"
QDBusConnection::sessionBus().send(msg);
if (!myProcess.waitForFinished())
return false;
```
**Note**
DBus is supported on Linux desktops by default. A [windows port exists](https://www.freedesktop.org/wiki/Software/dbus/#download) but this need further checks.
### dbus not allowed by default
For security reason, the default behaviour should be _not_ to listen to DBus, and flag `--dbus` should be added to the arguments to enable the feature in the application.
### See also
[KDE doc for creating dbus interface](https://develop.kde.org/docs/features/d-bus/creating_dbus_interfaces/)
---https://gricad-gitlab.univ-grenoble-alpes.fr/CamiTK/CamiTK/-/issues/137Unix file separator "/" is used explicitely in some file handling code of the...2023-05-31T12:15:49+02:00Manik BhattacharjeeUnix file separator "/" is used explicitely in some file handling code of the SDK instead of a portable value such as QDir::separator()## About you
CamiTK developper
## Overview
While reading code in libraries/core/viewer/RendererWidget.cpp I found a line of code which assumes that file path are using the unix separator '/'.
```c++
QString filePrefix = QFileInfo(filen...## About you
CamiTK developper
## Overview
While reading code in libraries/core/viewer/RendererWidget.cpp I found a line of code which assumes that file path are using the unix separator '/'.
```c++
QString filePrefix = QFileInfo(filename).absolutePath() + "/" + QFileInfo(filename).baseName();
```
The same type of separator use is found at multiple places in the SDK:
```bash
$ grep -n --include "*.cpp" --include "*.h" '"/"' * -R
```
```c++
actions/application/file/SaveAsAction.cpp:178: QFileDialog saveFileDialog(nullptr, tr("Save File As..."), QFileInfo(compfileName).dir().canonicalPath() + "/" + suggestedName, test);
actions/application/file/SaveAsAction.cpp:183: QString filename = QFileDialog::getSaveFileName(nullptr, tr("Save File As..."), QFileInfo(compfileName).dir().canonicalPath() + "/" + suggestedName, test);
applications/actionstatemachine/SaveActionState.cpp:107: (*outIt)->setFileName(saveDirName + "/" + compName + ".mha");
applications/actionstatemachine/SaveActionState.cpp:109: (*compIt)->setFileName(compDir + "/" + compName + compExt);
applications/actionstatemachine/SaveActionState.cpp:114: (*logStream) << compDir + "/" + compName + compExt << "' type='" << compType << "'/>" << Qt::endl;
applications/testcomponents/main.cpp:190: comp->setFileName(outputDirectory + "/" + inputComponent.fileName());
applications/wizard/GeneratingCEPState.cpp:105: QString outputFileName = dir.absolutePath() + "/" + cepDirName + "/libraries/" + libraryName + "/" + shortFileName;
components/vtkimage/VtkImageComponentExtension.cpp:251: QString filePattern = fileInfo.absoluteDir().absolutePath() + "/" + fileInfo.baseName();
components/off/OffExtension.cpp:71: QString baseFilename = QFileInfo(component->getFileName()).absolutePath() + "/" + QFileInfo(component->getFileName()).completeBaseName();
components/obj/ObjExtension.cpp:68: QString baseFilename = QFileInfo(component->getFileName()).absolutePath() + "/" + QFileInfo(component->getFileName()).completeBaseName();
libraries/core/viewer/RendererWidget.cpp:572: QString filePrefix = QFileInfo(filename).absolutePath() + "/" + QFileInfo(filename).baseName();
libraries/core/utils/CamiTKLogger.cpp:158: QFile::rename(fileToMove.absoluteFilePath(), logFileDirectory.path() + "/" + logFileName);
libraries/core/utils/CamiTKLogger.cpp:162: logFile = new QFile(logFileDirectory.path() + "/" + logFileName);
libraries/core/ExtensionManager.cpp:322: QString privateLibToLoad = Core::getGlobalInstallDir() + "/" + QString(Core::libDir) + "/" + QString(Core::shortVersion) + "/" + libname.cap(1);
libraries/core/ExtensionManager.cpp:328: privateLibToLoad = Core::getGlobalInstallDir() + "/" + QString(Core::libDir) + "/" + QString(Core::shortVersion) + "/" + libname.cap(1);
libraries/core/ExtensionManager.cpp:367: // add one cdUp() for each "/" inside Core::libDir (to take into account any multiarch configuration that
libraries/core/ExtensionManager.cpp:576: appFilePath.replace("/", "\\");
libraries/core/ExtensionManager.cpp:717: if (potentialPath.cd(potentialLibDir + "/" + QString(Core::shortVersion))) {
libraries/core/Core.cpp:314: QStringList installDirectories = getInstallDirectories(QString(Core::libDir) + "/" + QString(Core::shortVersion) + "/" + extensionType);
libraries/core/Core.cpp:318: QStringList libInstallDirectories = getInstallDirectories("lib/" + QString(Core::shortVersion) + "/" + extensionType, false);
libraries/cepgenerator/CepGenerator.cpp:95: devDirectoryName = devDirectoryName + "/";
libraries/cepgenerator/ComponentExtensionGenerator.cpp:309: QString testFileName = currentDirectory.absolutePath() + "/" + "empty." + suffix;
```
Same with '/':
```cpp
libraries/core/ExtensionManager.cpp:369: for (int i = 0; i < QString(Core::libDir).count(QLatin1Char('/')); i++) {
components/vtkmesh/VtkMeshUtil.cpp:230: size_t nbegin = vtkFileName.find_last_of('/');
```
Outside the SDK, tutorials and modeling also contain instances of the same problem:
```cpp
modeling/libraries/mml/monitoring/MonitoringManager.cpp:565: if (mmlIn->simulatorFile().get()[0] != '/') {
modeling/libraries/mml/monitoring/AnsysSimulator.cpp:48: if (workingDir[workingDir.length() - 1] != '/') {
modeling/libraries/mml/monitoring/ArtiSynthSimulator.cpp:44: if (workingDir[workingDir.length() - 1] != '/') {
modeling/applications/pmltools/obj2pml/obj2pml.cpp:111: unsigned int slash = buff.find('/');
modeling/actions/mml/GenerateModel.cpp:86: QString baseFilename = QFileInfo(originalFilename).absolutePath() + "/" + QFileInfo(originalFilename).completeBaseName();
modeling/libraries/mml/monitoring/MonitoringManager.cpp:53: size_t slashPlace = mmlPath.find_last_of("/");
modeling/libraries/mml/monitoring/MonitoringManager.cpp:97: QString guessPMLFilename = QFileInfo(fi).absolutePath() + "/" + QFileInfo(fi).baseName() + ".pml";
modeling/libraries/mml/monitoring/SofaSimulator.cpp:80: QString scnFileName = mmlFileInfo.absolutePath() + "/" + mmlFileInfo.baseName() + ".scn";
modeling/libraries/mml/monitoring/SofaSimulator.cpp:88: scnFileName = QDir::tempPath() + "/" + mmlFileInfo.baseName() + ".scn";
modeling/libraries/mml/monitoring/SofaSimulator.cpp:92: QString mshFileName = QDir::tempPath() + "/" + QFileInfo(monitoringManager->getPmlFileName().c_str()).baseName() + ".msh";
modeling/libraries/mml/monitoring/SofaWidget.cpp:87: size_t slashPlace = scnFileTemp.find_last_of("/");
modeling/libraries/mml/monitoring/AnsysSimulator.cpp:49: workingDir = workingDir + "/";
modeling/libraries/mml/monitoring/ArtiSynthSimulator.cpp:45: workingDir = workingDir + "/";
modeling/libraries/mml/monitoring/Reference.cpp:82: size_t slashPlace = refpath.find_last_of("/");
modeling/components/mmlcomponent/MMLComponent.cpp:61: file = QDir::tempPath() + "/" + QFileInfo(fi).baseName() + ".mml";
modeling/applications/pmltools/extractCells/extractCells.cpp:147: extracted = new StructuralComponent(pm, c1 + "/" + c2 + " extracted");
modeling/applications/pmltools/extractCells/extractCells.cpp:172: cout << '\r' << (i + 1) << "/" << ok;
modeling/applications/pmltools/extractCells/extractCells.cpp:192: pm->setName(pm->getName() + " " + c1 + "/" + c2 + " Extracted");
```
```cpp
tutorials/components/mixed/MixedComponent.cpp:41: QString mhaFile = QFileInfo(file).absolutePath() + "/" + filename.c_str();
tutorials/components/mixed/MixedComponent.cpp:43: QString vtkFile = QFileInfo(file).absolutePath() + "/" + filename.c_str();
tutorials/applications/fancy/FancyMainWindow.cpp:221: ui.slideValue->setText(QString("%1").arg((currentSliceId + 1), 3) + "/" + QString("%1").arg(maxSliceId, 3));
tutorials/applications/nogui/main.cpp:85: QString outputFileName = QDir::currentPath() + "/" + QFileInfo(image->getFileName()).completeBaseName() + "-output." + QFileInfo(image->getFileName()).suffix(
```
## Actual VS Expected Result
As CamiTK is multiplaform, the code should not assume that the path separator is the '/' char.
Using Qt Resources might be an exception to this, so each line of code should be checked manually before replacing '/' by QDir::separator().
## Interpretation & Possible fixes
Replacing '/' char with QDir::separator() when building file paths.
## CamiTK Version
CamiTK 5.1.dev.develop.f3f104d8
---
**please do not remove anything below this line**Manik BhattacharjeeManik Bhattacharjeehttps://gricad-gitlab.univ-grenoble-alpes.fr/CamiTK/CamiTK/-/issues/127Support of ITK5 on debian2022-11-20T10:08:49+01:00Emmanuel PromayonSupport of ITK5 on debian## About you
CamiTK developer
## Product
camitk community edition
## Overview
debian got rid of itk4, and will only support itk5 from now on.
Next ubuntu LTS has a debian freeze on February 24
## Challenge
get camitk5 back into un...## About you
CamiTK developer
## Product
camitk community edition
## Overview
debian got rid of itk4, and will only support itk5 from now on.
Next ubuntu LTS has a debian freeze on February 24
## Challenge
get camitk5 back into unstable and therefore support ITK5 and all new sid niceties and updates...Emmanuel PromayonEmmanuel Promayon2022-02-14https://gricad-gitlab.univ-grenoble-alpes.fr/CamiTK/CamiTK/-/issues/84Bug in refreshInterfaceNode in Explorer.cpp2019-05-30T10:04:25+02:00Matthias TummersBug in refreshInterfaceNode in Explorer.cppI am a CamiTK developer working on the FOCUS CEP
When Working with multiple components with parent/child relationships, Explorer::refreshInterfaceNode() will fail to remove all the components from the maps but effectively delete de the ...I am a CamiTK developer working on the FOCUS CEP
When Working with multiple components with parent/child relationships, Explorer::refreshInterfaceNode() will fail to remove all the components from the maps but effectively delete de the components. This leaves the Explorer with invalid references to components in its maps and will eventually cause a crash.
## CamiTK Version:
- CamiTK version........................... CamiTK 4.1.2
- CamiTK Short Version..................... camitk-4.1
- CamiTK SO NAME........................... 4
- Operating System......................... WIN32
- Build type............................... DEBUG
- QT Version............................... 5.6.1
- VTK Version.............................. 6.3.0
- Global Installation Directory [G]........ C:/dev/CamiTK/install
- Local Installation Directory [L]......... C:/Users/tummersm/AppData/Roaming/CamiTK
- Current Working Directory [W]............ C:/dev/CamiTK/install/bin
- Test Data Directory...................... C:/dev/CamiTK/install/share/camitk-4.1/testdata
- Component Extension Directories.......... C:/dev/CamiTK/install/lib/camitk-4.1/components
- Action Extension Directories............. C:/dev/CamiTK/install/lib/camitk-4.1/actions
- Number of Component Extensions........... 15 (locations: 15 global, 0 local, 0 in working directory, 0 manually installed by user)
- Number of File Extensions Supported...... 39
- Number of Action Extensions.............. 28 (locations: 28 global, 0 local, 0 in working directory, 0 manually installed by user)
- Number of Actions........................ 106
- Registered components:
- [G] Alias Wavefront OBJ Component...... obj
- [G] FocusImageComponentExtension....... fcs, fcs3
- [G] ItkImages Component................ hdr, spr, gipl, pic, lsm, nrrd, hdr.gz, nii, nii.gz, img, img.gz
- [G] MML Component...................... mml, scn
- [G] Msh Component...................... msh
- [G] Off Component...................... off
- [G] PML Component...................... pml
- [G] Pick Me Component.................. pickme
- [G] STL Component...................... stl, STL
- [G] Testing Abort Component............ abort
- [G] Testing Mixed Component............ mixed
- [G] VRML 2 Component................... vrml, wrl
- [G] VTK Component...................... vtk
- [G] vtkImages Component................ jpg, png, tiff, tif, bmp, pbm, pgm, ppm, mhd, mha, raw
- [G] DICOM.............................. directory
- Registered actions:
- [G] Application Level Actions.......... 21 actions
- [G] AverageVoxelValuesExtension........ 1 actions
- [G] Basic Mesh Extension............... 9 actions
- [G] Basic Picking Tutorial............. 1 actions
- [G] Basic Topology..................... 2 actions
- [G] BoxVOIExtension.................... 1 actions
- [G] FocusActionExtension............... 1 actions
- [G] Frame Edition Extension............ 1 actions
- [G] ITK Filters........................ 14 actions
- [G] ITK Segmentation................... 3 actions
- [G] Image LUT.......................... 1 actions
- [G] ImageAcquisitionActionExtension.... 7 actions
- [G] MML................................ 2 actions
- [G] Mesh Point Data.................... 1 actions
- [G] Mesh Processing.................... 17 actions
- [G] Mesh Selection..................... 1 actions
- [G] MultiPickingExtension.............. 1 actions
- [G] PMLExploreExtension................ 2 actions
- [G] Pixel Color Changer................ 1 actions
- [G] PropertiesExtension................ 3 actions
- [G] Reconstruction..................... 1 actions
- [G] Reorient Image Extension........... 1 actions
- [G] ResampleExtension.................. 1 actions
- [G] Shaker Extension................... 3 actions
- [G] ShowIn3DExtension.................. 5 actions
- [G] Sleeping While Working............. 2 actions
- [G] VolumeRenderingExtension........... 1 actions
- [G] Vtk Widget Tutorial................ 2 actions
---
**please do not remove anything below this line**Matthias TummersMatthias Tummers