I am currently working on introducing a scale or ruler feature in VTK within a vtkResliceImageViewer. My goal is for the scale to dynamically update as I zoom in or move the data in the viewer, reflecting the current position and zoom level accurately. I am a beginner with VTK, using C++ as my programming language and VTK version 8.2. Could you please suggest how to achieve this functionality?
I am attaching a GIF to demonstrate my requirement for better clarity. Any guidance on implementing this would be greatly appreciated.
I tried vtkLegendScaleActor but it’s doesn’t satisfied my whole requirement. I’m stuck in this, I would appreciate any step-by-step guidance on implementing this feature. As a beginner in VTK, detailed instructions would be incredibly helpful and encouraging.
As most the other essential medical image computing features, this is already implemented in 3D Slicer using VTK (it works in both 2D and 3D views):
As always, you can copy the code to your application - there are no restrictions on how you use Slicer or its source code. However, probably this is not the only feature that you’ll need. Your users will require measurements, panoramic image construction, curved planar reformat view, straightened 3D view, AI segmentation of bone, tooth and nerve, etc. and 3D Slicer and its extensions provide help for all these. You can copy all these features to your application, too, but testing and maintaining these features, refactoring your application a few times to accommodate them all, etc. means a lot of work. You can save a time and money and focus on just developing new features that matter by building your application on 3D Slicer as a platform. You can customize the application at many levels to do only what you need, exactly the way you need it. There are now several FDA-approved applications that are built on the 3D Slicer platform.
Is there any class related to VTK, to setup annotate the render window with scale information with respective to XY,YZ and XZ orientation.[For zoom and pan operations - For different render windows]
Hi Andras,I am also a beginner with VTK, using C++ as my programming language and VTK version 9.3.0.
The example you showed is exactly what I need to achieve, but since I am not using 3D Slicer but directly using the vtk library for volume rendering, I cannot directly apply the example you provided to vtk volume rendering. How can I write it so that I can directly use the vtk library to achieve this function? I am currently trying to use “vtkLegendScaleActor” to achieve it, but it will also scale the scale when rotating, but the 3D body is not scaled at this time, it is just simply rotated.
Looking forward to your reply,thanks!
Slicer uses VTK for all visualization, so you can extract from Slicer everything you need.
That said, it is hard to justify developing medical applications from scratch. Any minute that you spend with redeveloping this ruler is largely wasted effort. Perhaps the only benefit is that you learn some some low-level implementation details.
@lassoan The feature in the animation you previously uploaded is very different that what was in the original post from @christeen. What you presented was just a dynamic “scale bar” which gives the user a sense of “zoom” but not “position” which was identified as the objective. I also have a use case for a more versatile vtkLegendScaleActor https://discourse.vtk.org/t/legend-grid-annotation-from-paraview-12-with-vtk-filters/13479/3 and as a formal proposal here LegendScaleActor SetModeToFocalPlane . Additionally in the example animation from @christeen the way the ticks/numbers respond to zooming in/out is much prefered to the default behavior of vtkLegendScaleActor.
I believe that improvements here is not wasted effort in that the user experience as described and illustrated by @christeen is not readily achievable with existing implementations.
Yes, you are right, if the goal is to show position not just scale then the vtkAxisActor2D position may not need those dynamic updates that are implemented in the example above. Also, yes, there are other VTK actors that may be used for displaying coordinate system axes.
Regarding what is valuable/waste of efforts:
Any new features that are implemented in VTK and can be used in many applications are very valuable. We should continue to collaborate on developing and improving VTK classes.
Still, no matter how good VTK is, it is significant work to build an application from VTK and other libraries. Repeating this work for each application from scratch would be wasted effort, because instead you could choose a VTK-based open-source application that already has most of the needed features (ParaView, 3D Slicer, MITK, etc.) and then customize/extend it to fulfill the exact requirements.
Yes, I don’t mind if an idea doesn’t get traction as I am not a paying customer and also I should say that I am looking at customizing/extending vtkLegendAnnotationActor when I find time to learn enough c++ to work with the source. When I say this doesn’t work currenlty I mean the default methods included with the class do not offer the customization I am looking for but I am sure the source is extendable enough and my goals can be better achieved by extending the source for my specific use case, plus my use case may be too specific to bake into the maintained supported implementation.