DiffDRR
DiffDRR copied to clipboard
Add structure channel for rendering with masks
output of drr.forward should be B C H W where C is the number of structures in drr.subject.mask (C=1 if subject has no mask).
current idea is
- use the same indexes for the volume on the mask, ie
channels = torch.take(mask, idxs)with shapeB (HW) N - onehot
channelsfor shapeB C (HW) N - multiply
channelsandvoxels, nansum overN, and makeimgwith shapeB C (HW)
current limitation: onehot is memory intensive for C = 118 (ie, totalsegmentator)
onehot can be bypassed: https://stackoverflow.com/questions/78323859/broadcast-pytorch-array-across-channels-based-on-another-array