SlicerQR Development

To help others understand the context:

This code is called after a node is created, failing to see the information reported in the log file or python interactor probably means there are other errors happen beforehand during the loading of the data.

@jamesobutler @lassoan @pieper @jcfr

How do I show and un-show the ruler at the bottom of the image?

image

I can’t find it in the Script Repository.

Thanks

This is how I do it:

#For the 3D view
ThreeDViewNode = slicer.mrmlScene.GetSingletonNode("1", "vtkMRMLViewNode")
ThreeDViewNode.SetRulerType(1)# Change 1 by 0, 2 to get no ruler or thick
ThreeDViewNode.SetRulerColor(0)# Change 0 to 1, 2 to get other colors

#For red slice
redSliceNode = slicer.mrmlScene.GetSingletonNode("Red", "vtkMRMLSliceNode")
redSliceNode.SetRulerType(1)
redSliceNode.SetRulerColor(2)
1 Like

Thanks @mau_igna_06,

Do you also implement an interactive measuring tool? One where the user can draw a line on the image and a measurement is given?

I think you can implement it yourself using a vtkMRMLMarkupsLineNode, some event listeners and GUI buttons. But the experts may guide you further

Some info is here I believe. In case you want to know.

@pieper @lassoan @jcfr @jamesobutler

My module works perfectly except if I push the “Set Thickness” button first. Then hardly anything works. If I push other buttons first, everything works perfectly. We beta test next Monday, so HELP!!!

This issue is listed in tracker here: https://github.com/KitwareMedical/SlicerQReads/issues/103

Here’s the deal. After I push the “Set Threshold” button I get this error…

Traceback (most recent call last):
  File "/home/jcfr/Projects/SlicerQReads-Release/Slicer-build/lib/SlicerQReads-4.13/qt-scripted-modules/QReads.py", line 389, in updateGUIFromParameterNode
    QReadsLogic.slabThicknessInMmToNumberOfSlices(volumeNode, slabThicknessInMm))
  File "/home/jcfr/Projects/SlicerQReads-Release/Slicer-build/lib/SlicerQReads-4.13/qt-scripted-modules/QReads.py", line 612, in slabThicknessInMmToNumberOfSlices
    assert tichknessInMm > 0
AssertionError

Here’s the code segments at 389 and 612

 def updateGUIFromParameterNode(self, caller=None, event=None):
      QReadsLogic.setSlab(       (line 389)
          QReadsLogic.slabModeFromString(slabModeStr),
          QReadsLogic.slabThicknessInMmToNumberOfSlices(volumeNode, slabThicknessInMm))
@staticmethod
  def slabThicknessInMmToNumberOfSlices(volumeNode, tichknessInMm):
     if volumeNode is None:
      return 1
    assert tichknessInMm > 0  (line 612)
    return int(tichknessInMm / max(volumeNode.GetSpacing()))

… and no jokes anout

Can you upload an Windows installation package and send the link so that we can test it?

You can also check it yourself by attaching a Python debugger and check where the 0 slice thickness value comes from.

To ensure messages posted on the forum benefit the community, we suggest to provide minimally reproducible example.

In that particular case, it turns out I started to look at this and it is a simple logic issue.

1 Like

@lassoan

Yes, I would have done that if I could get my debugger to work. I’ve successfully attached the Python Debugger fro VS Code, and tried to set break points, but get this error…

pydev debugger: warning: trying to add breakpoint to file that does not exist: c:\programdata\na-mic\slicer 4.13.0-2021-04-22\qreads.py (will have no effect)
Traceback (most recent call last):
  File "C:/SlicerQReads-0.1.0-2021-04-27-win-amd64/lib/SlicerQReads-4.13/qt-scripted-modules/QReads.py", line 55, in eventFilter
    slicer.util.mainWindow().writeSettings()
AttributeError: qSlicerAppMainWindow has no attribute named 'writeSettings'

Although my SlicerQREADS module folder was set to “C:/SlicerQReads-0.1.0-2021-04-27-win-amd64/lib/SlicerQReads-4.13/qt-scripted-modules/QReads.py”, why is it trying to set break points in “c:\programdata\na-mic\slicer 4.13.0-2021-04-22\qreads.py?”

Thanks

started to look at this and it is a simple logic issue.

This has been fixed in BUG: Fix toggling of SlabThickness mode by jcfr · Pull Request #105 · KitwareMedical/SlicerQReads · GitHub

qSlicerAppMainWindow has no attribute named 'writeSettings'

Consider rebuilding the application, the error reported indicate you didn’t rebuilt. Changes have been integrated.

See BUG: Ensure window geometry and position is restored · KitwareMedical/SlicerQReads@2150063 · GitHub

Sorry @jcfr,

I’ll try to speak more in the context of addressing the Slicer community rather than the experts. Got it.

And thanks so much for the fix, I was losing a little sleep over this one. You just added a couple more days to my life I think.

Thanks

This is a recent regression in Visual Studio Code’s Python debugger. On Windows, you need to remove pathMappings section from the default debugger configuration - see instruction here.

@lassoan

Wow! That fixed it. Thanks

2 Likes

@jcfr @lassoan,

Hello, have you tried running Slicer on a VDI? Does it work?.

We have successfully used Slicer in several virtual environments (VirtualBox, VMWare, Hyper-V) and it works well in docker containers, Windows subsystem for Linux, etc. There was only one exception, Parallels on macOS, which only supported an embarrassingly old OpenGL version (this was about 1-2 years ago, the situation may have improved since then).

There might also be some issues with versions of microsoft’s remote desktop protocol and the version of opengl they support. But other remote desktop solutions like VNC, nomachine, google remote desktop, teamviewer, etc all work well.

Hello @lassoan @pieper @jcfr,

I was asked by a radiologist if there’s a way to present other types of 3D renderings in the 3D view of SlicerQREADS. I’m thinking this would be fairly easy with this amazing development environment. How could I implement some kind of toggle that would show a MIP and other 3D rendering in that 3d view in addition to the current intersecting planes?

Thanks!

Yes, that would be very straightforward. The full volume rendering API is scriptable and can be triggered of events or UI actions. See:

https://slicer.readthedocs.io/en/latest/developer_guide/script_repository.html#show-volume-rendering-automatically-when-a-volume-is-loaded

@spycolyf We can give more specific advice if you attach a few screenshots of the kind of renderings that you would like to see.