Combining surface registration and model-to-model distance functionalities

I have an established workflow and I’d like to streamline & combine the functionalities of - ALPACA, model-to-model distance, and shape-population-viewer (in order).

For example, if possible, I’d like to take the product of ALPACA (aligned models) and automatically feed them into model-to-model distance for distance computation, in 1 click.

I noticed that Model-to-model distance module does not have .py file so I cannot edit/make changes. How can I best approach this? Any advice would be appreciated.

Model-to-model documentation: Documentation/Nightly/Extensions/ModelToModelDistance - Slicer Wiki

Andras, thanks for this piece of code - I was able to successfully integrate it into my code without having to use model-to-model & shape population viewer.

There are just a few changes I’d like to make - it looks like with this piece of code it can only show a positive difference (for ex. the area where it’s the target model has been trimmed too much with respect to the source model, but not vice versa). How can I make it show a negative difference?

Also how can I alter the colour range? For example -0.5 to 0.5 similar to how it’s done in shape population viewer

thanks a lot

The distance filter computes signed distance by default, so probably you just need to tune the color mapping.

Thanks for the tip Andras. Would you know what piece of code I need to change the “Displayed Range” section? I’ve tried setScalarRange however it does not seem to change anything.

Screen Shot 2021-06-27 at 8.15.17 AM

Any advice would be great

I would like to change it to “Manual” and range (-0.2, 0.2) through code.

There are several color presets that display different colors for positive/negative values. You can also create custom ones as shown in these examples.

Thank you, I’ve created a custom one by editing the .txt. file.
Would you know how I can programatically alter the “Scalar Range Mode” and the “Displayed Range” as shown in the screenshot above?

Issue resolved: this code worked.

display.SetScalarRangeFlag(0) // returns 'manual'
display.SetScalarRange(-0.1, 0.1) // 'changes the range manually'
1 Like