There is a reason the colour goes muddy when you flip a curve. Three separate things have to happen: the orange mask is divided out, the inversion runs in linear light, and a print curve goes on top.
1. Measure the film base (Dmin)
The orange mask is a filter over the whole frame. Measure it on unexposed film rather than inside the picture, or that frame's own colour ends up in the mask. negaflow finds it by grouping connected regions in the brightness distribution; the eyedropper and direct RGB entry are there too.
2. Divide, do not subtract
The mask is a transmission, so it divides out in linear light. D = log₁₀(Dmin/T). Subtract it from a gamma-encoded 8-bit image instead and the channels come apart — that is the crossed colour everyone knows.
3. Invert in linear
Invert after gamma and the shadows are the first thing to block up. negaflow finishes the inversion and the tone work in 32-bit float linear, then hands off to the output colour space.
4. Print response curve
A negative has no black and no white of its own. Photographic paper decided those. A curve anchored on black, 18% grey and white is what makes the result read as a photograph.
5. Keep the roll together
One base measurement covers a roll shot under one light. Set it per frame and the tone wanders across the roll. Carry one value through all of them and correct exposure frame by frame.
6. Pick a look, then export
Development targets are selectable looks, not copies of a lab scanner’s software or output. Export 16-bit TIFF for further editing, or JPEG with the roll information written to EXIF for a ready-to-use file.