DiffDRR icon indicating copy to clipboard operation
DiffDRR copied to clipboard

Add structure channel for rendering with masks

Open eigenvivek opened this issue 1 year ago • 1 comments

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 shape B (HW) N
  • onehot channels for shape B C (HW) N
  • multiply channels and voxels, nansum over N, and make img with shape B C (HW)

current limitation: onehot is memory intensive for C = 118 (ie, totalsegmentator)

eigenvivek avatar Apr 13 '24 18:04 eigenvivek

onehot can be bypassed: https://stackoverflow.com/questions/78323859/broadcast-pytorch-array-across-channels-based-on-another-array

eigenvivek avatar Apr 16 '24 02:04 eigenvivek