Replies: 2 comments 8 replies
-
Could you please help share some comments? Thanks. |
Beta Was this translation helpful? Give feedback.
0 replies
-
Hi, if you're only doing binary segmentation then you can simply count the number of voxels greater than 0. You could add a new function to your post-transforms, something along the lines of (completely untested): class GetVol(MapTransform):
def __init__(keys, select_fn = lambda x: (x>0).sum(), output_key_suffix="_vol"):
super().__init__(keys)
self.select_fn = select_fn
self.output_key_suffix = output_key_suffix
def __call__(data):
d = dict(data)
for key in self.key_iterator(d):
vol = self.select_fn(d[key])
d[key + self.output_key_suffix] = vol
return d If your data is a simple tensor with batch (i.e., vols = [(b>0).sum() for b in inferred_seg_batch] Once you have the number of voxels, you simply multiply on the spacing per voxel to get the volume. |
Beta Was this translation helpful? Give feedback.
8 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi,
I used the spleen segmentation algorithm to segment the decathlon and my own dataset, and wanted to know if I could integrate a function for measuring the splenic volume (in mm3 or mL).
Thanks!
Beta Was this translation helpful? Give feedback.
All reactions