There are certain repeated actions that I do repeatedly that are becoming repetitious…
For instance, adding yellow rulers to each of the three slice viewers requires many mouse clicks. (This is true no matter whether it’s done through the View Controllers module or the equivalent drop-down toolbars in, say, the four-up view port.)
Assuming that I want these always to appear by default when I launch 3D Slicer, is there a convenient way to configure that? (And similar things such as no interpolation of background, preferred display of orientation marker, …) [I have no idea.]
If the settings are desired, say, 50% of the time, is there a convenient way to write a script for this in Python, so that the user-defined display settings can be implemented collectively with just a couple of mouse clicks? [I guess that it may be possible, given the existence of the Python Interactor — which I’ve never used.]
Pretty much everything can be automated through python coding. See the Slicer script repository for some examples. There also other posts on the forum that have answered the coding type questions you have asked.
I would strongly recommend not doing this. It introduces staircases in the image signal that are not present in the original continuous signal. See details in this discussion:
Hello, Andras.
From your cited discussion I found:
So this is interesting for two reasons.
Firstly, I am mainly interested in this for segmentation.
Secondly, I am not sure of what is being used to define the grid of a segment if not the grid of a scalar volume.
On the latter point, so far I had found the segments (e.g. from the Threshold effect) rather jagged for small features, so recently I have been creating new scaled cropped volumes from these small objects (through the Crop Volume module, with Spacing scale set to, say, 0.50x or 0.20x and with the Interpolator set to “B-spline”).
So I suspect — correct me if I’m wrong — that this would avoid some of the staircase issues you’re talking about, because interpolation is still performed somewhere along the way.
On the other hand, perhaps I’m overlooking a clever feature in Slicer whereby I can use a refined grid for the segment, different from any extant volume??
There are simply too many ways people want to configure things. Preferences are only allows a a small subset of common things.
That’s why there is a startup script (.slicerrc.py) that you can configure not exposed options in the UI in the way you want.
You can use many volumes to create the segments and not all of them have the same size and resolution. Also, you typically want the segmentation to be isotropic and sometimes you want it to be somewhat finer resolution than the input volume (to be able to represent small details that are actually not visible in the image, but the clinician knows that they are there and may want to define them with higher precision than the input image).
Staircase effect is mostly due to anisotropic spacing. Using Crop volume with isotropic spacing option eliminates this artifact. You can set the segment’s geometry using the “Specify geometry” button, then the user does not need to resample the volume (the segment editor module resamples it internally). However, typically it is simpler, more clear, and more memory efficient if the user crops and resamples the input volume before segmentation.
Thanks, Muratmaga, but I did not express the preference for all options to be able to be set individually through the settings menu — actually, I expressed the opposite view (emphasis added above).
—DIV
P.S. Another alternative (which I haven’t raised before) is for Slicer to simply ‘remember’ (almost) all settings from the previous session automatically (e.g. ruler colour, but not the zoom). This could get complicated if multiple instances of Slicer are launched with different viewport settings, and some users mightn’t like it, so if implemented there could be a tickbox in the settings menu to enable/disable it.
Each Segmentation must be associated with a Volume (providing radiodensity) and a Geometry (providing the grid) at any given moment.
The Geometry of the Segmentation can be identical to the geometry of its Master Volume, or it can be a modified version of that (e.g. forced to be isotropic), or it can be based on a totally different source (possibly a Volume, with prespecified geometry, or perhaps a ROI with a customisable user-specified geometry).
From time to time the Volume and/or Geometry on which a Segmentation is based can be changed.
Thank-you, Andras, I appreciate your advice, and will be aware of the benefits of applying isotropic sampling in future. I had avoided this until now because I naïvely assumed that applying more transformations would likely introduce more artefacts!
I am glad to hear that cropping the volume is considered an efficient approach — at least for my purposes, where the individual features of interest might occupy less than 1% of the whole original scan volume.
—DIV
You only need a volume for editing segmentations. Some Segment Editor effects would not need it, but it was easier to just make this a prerequisite for segmentation.
Correct.
Correct. Since image resampling is a lossy operation, and it is particularly bad for binary images, it is better to avoid changing geometry of existing segmentations. However, a one-time cropping and resampling to isotropic spacing before starting segmentation is usually beneficial.