Skip to content

Commit 73f6c56

Browse files
authored
Merge pull request #19 from yajivunev/master
components logic redux
2 parents 1ad5ca9 + 9b77698 commit 73f6c56

File tree

2 files changed

+301
-172
lines changed

2 files changed

+301
-172
lines changed

lsd/train/gp/add_local_shape_descriptor.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,24 @@ class AddLocalShapeDescriptor(BatchFilter):
4343
to compute a weighed average of statistics inside an object.
4444
``sphere`` accumulates values in a sphere.
4545
46+
components (string, optional): The components of the local shape descriptors to
47+
compute and return. Should be a string of integers chosen from 0 through 9 (if 3D)
48+
or 6 (if 2D), in order. Example: "0129" or "345". Defaults to all components.
49+
50+
Component string lookup, where example component : "3D axes", "2D axes"
51+
52+
mean offset (mean) : "012", "01"
53+
orthogonal covariance (ortho) : "345", "23"
54+
diagonal covariance (diag) : "678", "4"
55+
size : "9", "5"
56+
57+
Example combinations:
58+
59+
diag + size : "6789", "45"
60+
mean + diag + size : "0126789", "0145"
61+
mean + ortho + diag : "012345678", "01234"
62+
ortho + diag : "345678", "234"
63+
4664
downsample (int, optional): Downsample the segmentation mask to extract
4765
the statistics with the given factore. Default is 1 (no
4866
downsampling).
@@ -57,6 +75,7 @@ def __init__(
5775
unlabelled=None,
5876
sigma=5.0,
5977
mode="gaussian",
78+
components=None,
6079
downsample=1,
6180
):
6281

@@ -65,6 +84,7 @@ def __init__(
6584
self.lsds_mask = lsds_mask
6685
self.labels_mask = labels_mask
6786
self.unlabelled = unlabelled
87+
self.components = components
6888

6989
try:
7090
self.sigma = tuple(sigma)
@@ -149,6 +169,7 @@ def process(self, batch, request):
149169

150170
descriptor = self.extractor.get_descriptors(
151171
segmentation=segmentation_array.data,
172+
components=self.components,
152173
voxel_size=self.voxel_size,
153174
roi=voxel_roi_in_seg,
154175
)

0 commit comments

Comments
 (0)