Use the extra dimensionality to store labels as a "time" dimension. This could be an arbitrary dimension name, but time allows viewing in Display/register.
Create a diff:
$ diff-labels.sh old.mnc new.mnc diff.mnc
Apply a diff
$ patch-labels.sh old.mnc diff.mnc new.mnc
Steps to compute a diff:
- Use minclookup to split up two label sets to diff. One file per label, all values 1
- Use minccalc to do "new - old"
- 0 no change
- 1 added voxel
- -1 removed voxel
This creates a per-voxel index of changes to label set.
- Stack these labels in a time dimension using mincconcat, use the label numbers as the time coordinates
Steps to apply a diff:
- Split input label set into one file per label.
- Split out time dimension on diff into per file diffs
- Apply diff to label file using minccalc, multiply by label value
- Merge label files back into a single file