Hello, getting desperate here. I am in the Segment Editor removing voxels from 256x256x256 cubes in the 3D viewport. I engage the eraser tool and select “sphere brush” and “edit in 3D views”, and then when I go into the 3D view to erase voxels it is impossible due to lag.
Napari trivially erases in 3D with zero lag, so there must be some unnecessary computation in Slicer. Does anyone know what is happening here and how to mitigate it, and can explain exactly how to do so?
Thanks for the response, this has very little effect. There must be constant re-computation of every voxel in the space for the amount of lag there is. We went through this with some in-house software a while back and it took a fair bit of effort to solve.
There’s also some issues where Slicer is performing computations single-threaded - if I use the scissor tool past a certain zoom level, I’ll sit there for 3 minutes while it tries to figure out which 30 voxels to erase. So there’s two issues there, Slicer isn’t performing actions multi-threaded, and something is going wrong past a certain zoom threshold.
Is there a paid dev team for Slicer that has a list of things they work on, with a public facing bug list kind of thing?
Everything is very open, and you can look at slicer.org for the resources like github issues etc including people you can hire to work on special projects. If you can fund projects to improve the software that would be much appreciated.
Most likely the fix is really easy we just need to figure out what is exactly slow.
Surface nets still uses Taubin smoothing by default, so you need to enable surface net smoothing (or disable smoothing) for much faster updates.
You can also improve surface generation speed by reducing the number of triangles by using smoothing effect before enabling “Show 3D”.
You can also avoid costly recomputation of a conplex mesh by editing segments independently by enabling “allow overlap” and editing smaller, simpler segments.
There are many more potential approaches and parameters to adjust, but I would rather learn a bit more about what your application is to avoid shooting in the dark. Could you post a few screenshots and describe the overall goal of your project and what segmentation task you would like to do?
Oh great yes thanks. CTscan data off a particle accelerator. I am trying to pull instances of ancient papyrus sheets out of an initial semantic mask for the Vesuvius Challenge. Cubes are 256x256x256 voxels (says mm in Slicer but the conversion appears to be naive). I use the scissor tool and eraser tool in 3D, and then I use the eraser, island, and brush tools in 2D. The eraser tool is laggy in 2D, and wildly laggy in 3D. Eraser tool always is sphere. The base matte green in the images is the semantic mask.
Slow update after 2D editing means 3D surface generation takes time. Surface nets and surface nets smoothing should mostly address this, but there are additional options to make things even faster.
Note that you can use Slicer (for example, Fiducial registration wizard module in SlicerIGT extension or Baffle planner module in SlicerHeart extension with a few small modifications) to flatten the pages, thwn you can extract the page using Crop volume module, and then finally display the text (if the ink has different density than the paper) using Volume rendering module. You don’t need to spend time with erasing small pieces or filter out noise because Slicer can straighten the entire thick slab around each page and volume rendering can display a readable image even at the presence of lots of noise.
Surface nets + surface net smoothing makes things a little bit less laggy, but it is still far too laggy to use. What else can I do?
As for the rest here, it unfortunately does not apply. All the pages in the green semantic mask are connected, and the purpose of this process is to disconnect them into individual coloured instances, and then take these instances and attempt to train neural networks to automate the creation of instances.
Then eventually (if that ever works) geometry processing techniques are used to grab a mesh off one surface and then neural networks are used to display ink that is invisible to the naked eye (carbon ink on carbonized papyrus).
In the case of such complex surfaces the conversion from labelmap to closed surface can be really slow. In our field we usually don’t have such complexity (lots of layers, branches, holes), but for example if you simply threshold an image (e.g. any sample data), it is similarly complex, and indeed, surface conversion is quite slow until you further process it.
If the suggestions above don’t help, not even disabling smoothing altogether, then the only thing you can do is do the editing in 2D without seeing the 3D and only turn it on when you need it.
If you always need 3D, maybe partition the image and work on a few segments at a time.
The suggestions of @lassoan are great, but if you only have to segment to train a network then maybe not applicable. Please take a second look at them though.
What about setting up a custom volume rendering shader (e.g. “labelmap masking”) in the 3D views context manager to crop on 3D with scissors effect. I think that may work without needing to recreate the 3D mesh with each cut. Core devs may clarify if this approach is possible.
Yes, if one is open to doing custom programming then there are a lot of possible optimizations. A shader is one possibility, but it may also be possible to facilitate this particular task with masking and volume rendering.
I’ll see if these functions have a use case for people, they sound quite interesting and powerful. What we are working with right now is a piece of geometry processing code which takes a volumetric instance from slicer and gives back a mesh of the inner-facing papyrus surface, rendered and textured with the original CTscan data, and flattened for ink detection algorithms.
I’ll explore and see if anyone can write code for Slicer. Coding for Napari has happened quite a bit due to the ease of python scripting, but I think people might be having a harder time with Slicer.
Quick question - is there a way to hide all the segments simultaneously in the segment editor, instead of clicking on 20 eyeballs in the sidebar? We would like to hide and show the masks a dozen times per minute.
If you extract a thin surface from the volume (for exanple, using Probe model with volume module) then your signal to noise ratio will hugely decrease, because only a small fraction of voxels are sampled and if the surface extraction method has any imperfections then you might not even work with the most informative voxels. Instead, you can extract a thick slice around the papyrus sheet (unwrap the volume not a surface) thereby preserving all information that the image contains. You then may not even need much post-processing, because with the right transfer functions volume rendering may clearly show the ink.
3D Slicer is fully python scriptable, and most of newly added modules are implemented in Python. You can also pip install any Python package and use it in your Slicer modules. It should be easier to get started with Slicer than with napari, as you get a fully configured Python environment and GUI application in one, including Python console, slice and 3D views, and rich GUI. I would recommend napari if you work with 2D or 2.5D microscopy images, but for 3D images Slicer offers much more.