Yes, that would work. Can that static progress dialog be done in Python? I don’t have much time. At this point example code would be most helpful. Thanks.
Has anyone ever seen this error. Don’t spend much time researching right now please. Just want to know if this rings a bell or have a rough guess. Thanks!
[ERROR][Python] 06.08.2021 14:04:58 [Python] (...\lib\SlicerQReads-4.13\qt-scripted-modules\DICOMLib\DICOMUtils.py:728) - DICOM plugin failed to load '3: MR AXIAL FLAIR' as a 'Image sequence'.
Traceback (most recent call last):
File "...\lib\SlicerQReads-4.13\qt-scripted-modules\DICOMLib\DICOMUtils.py", line 722, in loadLoadables
loadSuccess = plugin.load(loadable)
File "... /bin/../lib/SlicerQReads-4.13/qt-scripted-modules/DICOMImageSequencePlugin.py", line 363, in load
self.addSequenceBrowserNode(loadable.name, outputSequenceNodes, playbackRateFps, loadable)
File "... /bin/../lib/SlicerQReads-4.13/qt-scripted-modules/DICOMImageSequencePlugin.py", line 230, in addSequenceBrowserNode
outputSequenceBrowserNode = slicer.vtkMRMLSequenceBrowserNode()
I have occasionally had the DICOM loader erroneously identify a series as a “Sequence” instead of a volume, and then try to load it that way. It looks like that might be what have run into. Alternatively, it sounds like you have been mucking around in DICOMUtils.py, so perhaps some of the logic there is no longer valid and is leading to this error.
Yes, this occurred only with MR series which I have not done much testing. PET, CT and NM works fine. Also, I undid the DicomUtils changes, so I don’t think it’s that.
Thanks
If you aren’t planning to use Sequences you can also try turning off the Sequences plugin. Easiest would be to take it out of the CMakeLists.txt so it doesn’t get included in your installation. (Need to also remove it from the build tree if you are re-building in place). Be aware though that there can be many MR acquisitions that don’t map cleanly to volumes, so sometimes loading a sequence is correct. In this case it’s not clear what your MR data is so probably best to just catch any errors and say that the series type is not supported.
Here’s one option. Replace time.sleep with your call.
import time; d = qt.QMessageBox(qt.QMessageBox.Icon(qt.QMessageBox.Information), "SlicerQReads", "Working...", qt.QMessageBox.NoButton); d.setStandardButtons(0); d.show(); slicer.app.processEvents(); time.sleep(2); d.hide()
Thanks @pieper,
Do you think it could be programmed in such a way as to show the dialog during the image load time when no images are showing and there is a white background in the 3D view, and then hide when the images are displayed? I’m trying to place the d.show() and d.hide() in various sections of the code to have this effect. Haven’t found it yet tho.
Thanks
@pieper: I’m assuming that’s a no.
It seems wherever I put the code, it comes up and immediately disappears. If you blink, you’d miss it.
Thanks
Hello JC, could you tell me where to place the above code to display the dialog box so that it appears when SlicerQREADS’ main window displays and goes away when the images appear?
Thanks
Hi Doug - that example uses the 2 second delay (the time.sleep(2)
part) to emulate calling the load routine. So if you put the first part, up to slicer.app.processEvents()
before your call to load the imags and the d.hide()
after the load call returns then the “Working…” dialog should stay up for as long as it takes for the reading process to complete. Does that make sense to you?
Relevant changes have been implemented in the following pull request:
See https://github.com/KitwareMedical/SlicerQReads/pull/107
@jcfr, @lassoan, that was perfect. I did put it in a try / except block to avoid it hanging up because the DICOM import fails a lot. Otherwise, task manager is the only way to kill it.
Thank y’all so much.
Slicer may need extra plugins for loading exotic information objects, but I don’t find that it fails a lot for commonly occurring data sets. What specific problems did you encounter?
Oh probably it’s because some of my DICOM headers are faulty. I have not specifically identified the cause yet. But it seems to be mainly my MR file headers that I need to fix. QREADS itself is very forgiving of DICOM header imperfections. But when it fails, the patient demographics don’t show up in the title bar and the W/L is not set to the header values. Anyway I’ll try to solve that soon.
Hey @lassoan, how do I disable or eliminate the main window minimize button. We need to disallow minimizing SlicerQREADS because it behaves as a modal dialog. Probably a QT command. Correct?
Thanks.
I did put it in a try / except block to avoid it hanging up because the DICOM import fails a lot. Otherwise, task manager is the only way to kill it.
Following the coomment of @pieper , the corresponding PR has been updated with an additional commit introducing the context manager inProgressDialog
, this allows to cleanly handle the case when exception are raised without preventing the exception from being caught. See https://github.com/KitwareMedical/SlicerQReads/pull/107
how do I disable or eliminate the main window minimize button.
This is implemented in the following PR.
See https://github.com/KitwareMedical/SlicerQReads/pull/108
@lassoan @pieper @jcfr @jamesobutler
I think everything is looking good for the release. One thing that could get us a lot of service calls though:
- Does anyone know how to programmatically detect whether the correct version of OpenGL is installed on the systems for SlicerQREADS to run. Currently, on systems with OpenGL version 1.0, the module displays a dialog indicating insufficient graphics capability, and then does not exit properly, leaving QREADS in a hung state waiting for SlicerQREADS to exit. Maybe there’s somewhere I can place a Try/Catch to avoid this abnormal exit. I believe SlicerQReadsApp-real.exe hangs around in task manager as well.
Thanks
The code that checks that is below. It should be cleaning up nicely, but perhaps for your purposes you want to check the graphics resources earlier and exit right away.
For computers that don’t have GPU (or not accessible due to using the computer via remote desktop connection) then it is possible to run Slicer using a software renderer. See details here. Switching to a software renderer would require copying about 20 DLLs to the bin folder and set two environment variables, so it would not be hard to automate it.
Oh wow! Thanks. I’ll consider that @lassoan. Appreciate it
In my 3D view, I’m doing 3D rendering and ROI cropping, and I’m using presets like CT-Cardiac, CT-Xray, CT-Lung, etc. Is there a preset for CT Bone?
Thanks
Yes, there is a preset called “CT-bone”:
These presets are relatively hard to find (the user needs to go to Volumes module and select a volume). Suggestions are welcome for making them more easily accessible. Maybe in the dropdown menu of the window/level mouse mode selector? Or in the right-click menu of a view?