I want to perform a value conversion on a DICOM image by solving an equation with 2 unknown variables (a and b) :
output value = (a - input value) / (b + input value)
To do that we decided to perform least-square error minimization with non linear regression based on levenberg-marquardt model
To calibrate the model we have to use 2 segmentation volumes in the image were the value is fixed to calibrate the model.
RT structure set is somewhat less deterministic (due to complex rasterization procedure that includes contour interpolation, branching, end-capping, keyhole resolution), but in most cases they should give equivalent results.
You first need to get data using arrayFrom* methods, probably apply some masking operation, and finally fit your model using least_squares or similar method.