Issues interacting with the linewidget2

Hi VTK folks:

Currently I’m doing a project to integrate VTK to a Qt program. The part I’m doing now is to display the three orthogonal planes, overlaying on the top with the two cross hair lines. I know there are some existing cross-hair classes in VTK, but I did the simplest try with only two vtkLineWidget2.

The slicer that I used is the vtkImageResliceMapper controled by the corresponding camera. Then the location control slider is used as the trigger to set camera FocalPoint, at the same time change two end points of the vtkLineWidget2.

The issue I observed is that most of the time the two lines are displaying well with image slice, but only at some random locations, the lines are hided behind the slice. I was thinking the reason is probably that the imageslice is coincidentally at the same depth with the lines, so I tried to shift the lines forward for several millimeters, but the lines flip flop can still happen for some datasets, at some locations. I attached two pictures showing this.


I considered to figure out, like using multiple renderer layers, but I also need to use picker, so have no idea how to deal with this with multiple layers.

Is someone facing the same issue? Could you guys give me some suggestions please?

Thanks!

Best regards,
Wenhai

All these kinds of issues have been already solved many times before. Then, about 15-20 years ago it was realized that even if you built on excellent toolkits, such as VTK, ITK, DCMTK, Qt, etc. it took a lot of time to develop a medical imaging application from scratch. That’s why many open-source application platforms were developed - to make sure that you never need to reimplement these again and you can spend your time on things that matter. Over time, only a few platforms remained. The most successful free, open-source VTK-based medical application platforms are 3D Slicer and MITK, but there are also some smaller and non-VTK-based and commercial ones, and non-medical (e.g., Paraview).

If you have trouble figuring out these problems by yourself, the community does not seem to have volunteers to help you with this, and you don’t want to pay for commercial support - or don’t want to spend too much time with reimplementing these features, then I would recommend to switch to VTK-based application platform that has already most of the features that you need.

Hi Andras:

Sorry for my late response, but thank you anyway for your reply! Yes, it’s true to build a whole medical imaging application from zero is very complicated and and time consuming, but at current stage what I need are only some simple visualizations, so I tried some VTK classes to do that. And you are right, like 3D Slicer, MITK, they are indeed good tools to utilize, probably next I will manage to use them. May I ask whether there are any issues to switch to those successful platforms for commercial use?

By the way, the issue that I mentioned has been solved. For guys facing the similar problem, I suggest to add vtkOrientationMarkerWidget to double check if your camera direction is always as what you expected. Adding the shifts on those lines towards camera will indeed make the cross-hairs always ahead but you have to always ensure your camera direction is correct and not changing. And all in all, it is worth switching to those existing imaging platforms without wasting too much time yourself…

Best regards,
Wenhai.

There should be no problems. Both 3D Slicer and MITK are used as a basis of commercial products.

Thank you for your advice!