Yes, I installed TortoiseGit and it is really nice. I’ll tell my team about it for managing GIT for QREADS. Thanks for sharing that @lassoan
2 posts were split to a new topic: Is there a way to load images using the Python Interactor in Slicer?
Is it possible to position the image scroll slider at the bottom of the images rather than the top?
I’m proud of myself. Thanks to @lassoan helping me today, with TortoiseGit, I was able create a branch, make minor changes, commit, push, and then create a pull request. Lots more to learn, but it’s a start.
Can the mouse button event assignment be done in Python? For example, with the Python script, can I assign zoom to the mouse wheel down and drag, and pan to the left button, and W/L to simultaneous left and right buttons?
Maybe the SetEventTranslationClickAndDrag function?
I built the latest code and the title information still does not work. I tried the following and nothing printed in Python interactor. Does this mean that the code never gets executed?. Here’s where I placed the print statements in the code…
def _update():
slicer.app.processEvents()
slicer.app.layoutManager().resetThreeDViews()
QReadsLogic.setZoom(self._parameterNode.GetParameter("Zoom"))
# Dictionary of name and values
values = {QReadsLogic.DICOM_TAGS[tag]: value for tag, value in QReadsLogic.dicomTagValues(node).items()}
print("*" * 40)
print(values)
print("*" * 40)
# Update window title
slicer.util.mainWindow().windowTitle = "CMRN: {PatientID} Patient Name: {PatientName} Study: {StudyDescription} Series: {SeriesDescription}".format(**values)
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?
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)
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.
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.
Wow! That fixed it. Thanks