Create 3d dicom volume rendering slicelet

Operating system: Ubuntu 19.10
Slicer version:4.10

How can I create .py(slicelet) that can render a 3d dicom volume?

https://www.slicer.org/wiki/Documentation/Nightly/Developers/Slicelets

You can also find useful code snippets that load volume and display it using volume rendering in the script repository: https://www.slicer.org/wiki/Documentation/Nightly/ScriptRepository

Actually I want four 3d volume rendering windows.So that I can load four volumes in each of the window.How can I create the layoutWidget(four 3d windows)? is there a built-in layout?
Even if I created the layoutWidget, how can I load the volumes to respective windows?
How can i write the logic that load the dicom to volume?I am too confused in this scenario.Please help me…

question
And also
Getting this error while loading the DICOM too…

If you want four 3D views you need to make a custom layout using XML like here:

https://www.slicer.org/wiki/Documentation/Nightly/ScriptRepository#Customize_viewer_layout

Then make volume rendering display node for each and set the corresponding view node id to the view where you want it to appear.

To load dicom to volumes, follow the examples here:

https://www.slicer.org/wiki/Documentation/Nightly/ScriptRepository#DICOM_2

As a side note, when asking questions, it’s best to try narrowing down to a. specific question with a small snippet of code with the context to show what you tried and what happened. Your screenshot only shows the error, not the input.

That last error indicates that something you entered in the python interactor tried to iterate over a boolean value. We can’t see what you entered, so we can’t tell what caused the error.

The Irregular volume geometry message is just a warning and did not cause the error.

Without seeing your code, we can only guess. My guess would be that you use Slicer Stable version and you are trying an example code snippets provided for latest Slicer Preview version.

question Screenshot from 2020-08-15 11-35-34
sorry for the incovinience…
this is the code I used


this image is more clear to understand the error

Code snippets on the “Nightly” script repository page is for latest Slicer Preview version.

I had even checked the stable version code.But it didn’t tell how to get the volumenode of the loaded DICOM directory. How can I get the volume node of DICOM in stable version?

I’ve just tried this DICOM file loading script with the latest Slicer Preview release and it works well. List of volume node IDs are returned in loadedNodeIDs variable.

but its not working in the stable release…

I would recommend to use the latest Preview Release. It should work well and contains many important improvements and fixes and we will release it as the new stable version in a couple of weeks. If you have any issue with the latest Preview Release then let us know.

OK I will use the preview version


with this code I had created a layout with consists of two 3d windows…
How to load a dicom volume into these windows?

For each of the volume display nodes for the volumes you set it to only appear in the corresponding view by setting the ViewNodeIDs instance variable.

It works like this example:

https://www.slicer.org/wiki/Documentation/Nightly/ScriptRepository#Change_markup_fiducial_display_properties


i had configured the display nodes and view nodes, but the volume is not appearing in the view node