TomographicImaging / CILViewer

A simple Viewer for 3D data built with VTK
Apache License 2.0
9 stars 6 forks source link

Decide on naming conventions for the viewer. #217

Open lauramurgatroyd opened 2 years ago

lauramurgatroyd commented 2 years ago

See https://github.com/vais-ral/CILViewer/pull/216#issuecomment-1093772185

paskino commented 2 years ago

possibly similar comments are in #215

paskino commented 2 years ago

I'm now inclined to think that we should mainly adhere to VTK's conventions, with the exception of adopting Qt's conventions when we are dealing with qt stuff.

Possibly this also would mean that we make submodules like

vortex
vortex.qt
vortex.web #trame
vortex.io
vortex.utils
lauramurgatroyd commented 2 years ago

There are basically 3 different conventions we should/could follow:

For each I use example names to show how they are written (case-wise/underscores etc.)

  1. VTK convention: Class name: vtkCellArray() Method names: .GetValue()

  2. Qt convention: Class names: QComboBox Method names: .addItem()

  3. CIL / Python convention: Class names: BlockDataContainer Method names: .get_item() members: self.voxel_number_y

lauramurgatroyd commented 2 years ago

The question is where do we use each of these?

  1. Readers. These are VTK-like classes so use VTK style. At the moment the prefix used is cil. Should we change this to cilviewer or cilv or cilvie to avoid confusion? https://github.com/vais-ral/CILViewer/blob/c9d8604ef7accd5d6eec68b888f2a4396254270c/Wrappers/Python/ccpi/viewer/utils/conversion.py#L567-L568

  2. Viewers https://github.com/vais-ral/CILViewer/blob/c9d8604ef7accd5d6eec68b888f2a4396254270c/Wrappers/Python/ccpi/viewer/CILViewer.py#L425

At the moment these use the Qt convention of camelCase methods names, even though they are completely separate from Qt. So we should consider a change although it will be a big backwards-compatability break. If we change, what do we change to? VTK-Style? Does that mean we would also change the name of the viewers to have a prefix?

  1. Viewer interactor style Again, Qt/Python style name, but VTK-style methods - i.e. methods are all UpperCase words

  2. Qt windows with viewers embedded Has Qt style as expected: https://github.com/vais-ral/CILViewer/blob/master/Wrappers/Python/ccpi/viewer/QCILViewerWidget.py

But iviewer and other viewer windows in this file, don't follow the Qt style, whereas perhaps they should? https://github.com/vais-ral/CILViewer/blob/master/Wrappers/Python/ccpi/viewer/iviewer.py

  1. Qt Viewer interactor style: Is currently Qt-style, but I think it should be VTK-like: https://github.com/vais-ral/CILViewer/blob/master/Wrappers/Python/ccpi/viewer/QCILRenderWindowInteractor.py Note: vtk's QVTKRenderWindowInteractor has a Qt-like name, but uses method names like in VTK

  2. What do we do about classes / methods that we use to generate VTK objects: E.g. https://github.com/vais-ral/CILViewer/blob/c9d8604ef7accd5d6eec68b888f2a4396254270c/Wrappers/Python/ccpi/viewer/utils/colormaps.py#L432 Or: https://github.com/vais-ral/CILViewer/blob/c9d8604ef7accd5d6eec68b888f2a4396254270c/Wrappers/Python/ccpi/viewer/utils/example_data.py#L30 Or: when I would like to add new methods to generate vtk objects: https://github.com/vais-ral/CILViewer/blob/1d741ec9b2c1ef3d4dd297405b3d1cda7012ca65/Wrappers/Python/ccpi/viewer/widgets/box_widgets.py#L5

lauramurgatroyd commented 2 years ago

If we are not renaming the package to something different, we could consider: CILV / CILVie instead of CILViewer